UPSRequest.php in Commerce UPS 8.3
File
src/UPSRequest.php
View source
<?php
namespace Drupal\commerce_ups;
abstract class UPSRequest implements UPSRequestInterface {
protected $configuration;
public function setConfig(array $configuration) {
$this->configuration = $configuration;
}
public function getAuth() {
if (empty($this->configuration['api_information']['access_key']) || empty($this->configuration['api_information']['user_id']) || empty($this->configuration['api_information']['password'])) {
throw new \Exception('Configuration is required.');
}
return [
'access_key' => $this->configuration['api_information']['access_key'],
'user_id' => $this->configuration['api_information']['user_id'],
'password' => $this->configuration['api_information']['password'],
];
}
public function useIntegrationMode() {
if (!empty($this->configuration['api_information']['mode']) && $this->configuration['api_information']['mode'] == 'live') {
return FALSE;
}
return TRUE;
}
}