You are here

public static function AvataxLib::formatDrupalAddress in Drupal Commerce Connector for AvaTax 8

Format an address with AvaTax array data.

Parameters

array $address: The AvaTax address to format.

Return value

array Return a Drupal keyed formatted address.

2 calls to AvataxLib::formatDrupalAddress()
AddressValidationTest::testResolveAddress in tests/src/Kernel/AddressValidationTest.php
@covers \Drupal\commerce_avatax\AvataxLib::resolveAddress @dataProvider addressesData
AvataxLib::validateAddress in src/AvataxLib.php
Validate the give address from Drupal upon AvaTax resolved address.

File

src/AvataxLib.php, line 432

Class

AvataxLib
The AvaTax integration library.

Namespace

Drupal\commerce_avatax

Code

public static function formatDrupalAddress(array $address) {
  return [
    'address_line1' => $address['line1'] ?? '',
    'address_line2' => $address['line2'] ?? '',
    'locality' => $address['city'] ?? '',
    'administrative_area' => $address['region'] ?? '',
    'country_code' => $address['country'] ?? '',
    'postal_code' => $address['postalCode'] ?? '',
  ];
}