You are here

protected static function AvataxLib::formatAddress in Drupal Commerce Connector for AvaTax 8

Formats an address for use in the order request.

Parameters

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

Return value

array Return a formatted address for use in the order request.

1 call to AvataxLib::formatAddress()
AvataxLib::prepareTransactionsCreate in src/AvataxLib.php
Prepares the transaction request body. (This method should not be public but that makes the tests easier).

File

src/AvataxLib.php, line 452

Class

AvataxLib
The AvaTax integration library.

Namespace

Drupal\commerce_avatax

Code

protected static function formatAddress(AddressInterface $address) {
  return [
    'line1' => $address
      ->getAddressLine1(),
    'line2' => $address
      ->getAddressLine2(),
    'city' => $address
      ->getLocality(),
    'region' => $address
      ->getAdministrativeArea(),
    'country' => $address
      ->getCountryCode(),
    'postalCode' => $address
      ->getPostalCode(),
  ];
}