You are here

public static function FedExAddressResolver::addressResolveAU in Commerce FedEx 8

Resolve Addresses in Austriaila.

Parameters

\Drupal\address\AddressInterface $address: The address to resolve.

Return value

\NicholasCreativeMedia\FedExPHP\Structs\Party A Fedex Compatible party.

File

src/FedExAddressResolver.php, line 23

Class

FedExAddressResolver
Allow Country level modifications when converting Drupal addresses to fedex.

Namespace

Drupal\commerce_fedex

Code

public static function addressResolveAU(AddressInterface $address) {
  $provinces = [
    'NSW' => 'NS',
    'NT' => 'NT',
    'QL' => 'QL',
    'SA' => 'SA',
    'TAS' => 'TS',
    'VIC' => 'VI',
    'WA' => 'WA',
  ];
  $party = new Party();
  $party
    ->setAddress(new Address(array_filter([
    $address
      ->getAddressLine1(),
    $address
      ->getAddressLine2(),
  ]), $address
    ->getLocality(), $provinces[$address
    ->getAdministrativeArea()], $address
    ->getPostalCode(), NULL, $address
    ->getCountryCode(), NULL, FALSE));
  return $party;
}