You are here

abstract class USPSRequest in Commerce USPS 8

USPS API Service.

@package Drupal\commerce_usps

Hierarchy

Expanded class hierarchy of USPSRequest

File

src/USPSRequest.php, line 10

Namespace

Drupal\commerce_usps
View source
abstract class USPSRequest implements USPSRequestInterface {

  /**
   * The configuration array from a CommerceShippingMethod.
   *
   * @var array
   */
  protected $configuration;

  /**
   * {@inheritdoc}
   */
  public function setConfig(array $configuration) {
    $this->configuration = $configuration;
  }

  /**
   * Returns authentication array for a request.
   *
   * @return array
   *   An array of authentication parameters.
   */
  protected function getAuth() {
    return [
      'user_id' => $this->configuration['api_information']['user_id'],
      'password' => $this->configuration['api_information']['password'],
    ];
  }

  /**
   * Determines if the shipping method is in test method..
   *
   * @return bool
   *   Returns TRUE if we're in test mode.
   */
  protected function isTestMode() {
    return $this->configuration['api_information']['mode'] == 'test';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
USPSRequest::$configuration protected property The configuration array from a CommerceShippingMethod. 1
USPSRequest::getAuth protected function Returns authentication array for a request.
USPSRequest::isTestMode protected function Determines if the shipping method is in test method..
USPSRequest::setConfig public function Set the request configuration. Overrides USPSRequestInterface::setConfig 1