protected function FedEx::getAddressForFedEx in Commerce FedEx 8
Gets a FedEx address object from the provided Drupal address object.
Parameters
\Drupal\address\AddressInterface $address: The Drupal address object.
Return value
\NicholasCreativeMedia\FedExPHP\Structs\Party The address for FedEx.
File
- src/
Plugin/ Commerce/ ShippingMethod/ FedEx.php, line 586
Class
- FedEx
- Provides the FedEx shipping method.
Namespace
Drupal\commerce_fedex\Plugin\Commerce\ShippingMethodCode
protected function getAddressForFedEx(AddressInterface $address) {
$custom_resolver = 'addressResolve' . $address
->getCountryCode();
if (method_exists($this, $custom_resolver)) {
$party = $this
->{$custom_resolver}($address);
}
else {
$party = new Party();
$party
->setAddress(new Address(array_filter([
$address
->getAddressLine1(),
$address
->getAddressLine2(),
]), $address
->getLocality(), $address
->getAdministrativeArea(), $address
->getPostalCode(), NULL, $address
->getCountryCode(), NULL, FALSE));
}
return $party;
}