protected function USPSShipment::setService in Commerce USPS 8
Sets the services for the shipment.
1 call to USPSShipment::setService()
- USPSShipment::buildPackage in src/
USPSShipment.php - Returns an initialized rate package object.
File
- src/
USPSShipment.php, line 77
Class
- USPSShipment
- Class that sets the shipment details needed for the USPS request.
Namespace
Drupal\commerce_uspsCode
protected function setService() {
$rate_class = RatePackage::SERVICE_ALL;
// Determine if the shipping method uses a special
// rate class.
if (!empty($this->configuration['rate_options']['rate_class'])) {
switch ($this->configuration['rate_options']['rate_class']) {
case 'online':
case 'commercial':
$rate_class = RatePackage::SERVICE_ONLINE;
break;
case 'commercial_plus':
$rate_class = 'PLUS';
break;
}
}
$this->uspsPackage
->setService($rate_class);
}