You are here

protected function USPSShipmentInternational::setRateClass in Commerce USPS 8

Set the rate class of the package.

1 call to USPSShipmentInternational::setRateClass()
USPSShipmentInternational::buildPackage in src/USPSShipmentInternational.php
Returns an initialized rate package object.

File

src/USPSShipmentInternational.php, line 50

Class

USPSShipmentInternational
Class that sets the shipment details needed for the USPS request.

Namespace

Drupal\commerce_usps

Code

protected function setRateClass() {

  // Set the appropriate rate class, if configured.
  if (!empty($this->configuration['rate_options']['rate_class'])) {
    switch ($this->configuration['rate_options']['rate_class']) {
      case 'commercial':
        $this->uspsPackage
          ->setField('CommercialFlag', 'Y');
        break;
      case 'commercial_plus':
        $this->uspsPackage
          ->setField('CommercialPlusFlag', 'Y');
        break;
    }
  }
}