You are here

function commerce_avatax_address_fields_mapping in Drupal Commerce Connector for AvaTax 7.5

Returns a mapping between the Addressfield names and the field names that need to be sent to the Avatax API v1.

2 calls to commerce_avatax_address_fields_mapping()
commerce_avatax_address_compare in includes/commerce_avatax.address.inc
Compare entered address and the validated addresses returned by AvaTax.
commerce_avatax_validate_address in includes/commerce_avatax.address.inc
Validate the address entered on checkout form.

File

./commerce_avatax.module, line 1052
AvaTax service integration from Avalara, Inc.

Code

function commerce_avatax_address_fields_mapping($flip = FALSE) {
  $mapping = array(
    'locality' => 'city',
    'administrative_area' => 'region',
    'country' => 'country',
    'postal_code' => 'postalCode',
    'thoroughfare' => 'line1',
    'premise' => 'line2',
  );

  // Flip the keys/values if necessary.
  if ($flip) {
    $mapping = array_flip($mapping);
  }
  return $mapping;
}