public function USPSRateRequest::checkDeliveryDate in Commerce USPS 8
Checks the delivery date of a USPS shipment.
Return value
array The delivery rate response.
File
- src/
USPSRateRequest.php, line 109
Class
- USPSRateRequest
- Class USPSRateRequest.
Namespace
Drupal\commerce_uspsCode
public function checkDeliveryDate() {
$to_address = $this->commerceShipment
->getShippingProfile()
->get('address');
$from_address = $this->commerceShipment
->getOrder()
->getStore()
->getAddress();
// Initiate and set the username provided from usps.
$delivery = new ServiceDeliveryCalculator($this->configuration['api_information']['user_id']);
// Add the zip code we want to lookup the city and state.
$delivery
->addRoute(3, $from_address
->getPostalCode(), $to_address->postal_code);
// Perform the call and print out the results.
$delivery
->getServiceDeliveryCalculation();
return $delivery
->getArrayResponse();
}