function _commerce_avatax_transaction_get_customer_code in Drupal Commerce Connector for AvaTax 7.5
Helper function used to determine the customerCode sent.
1 call to _commerce_avatax_transaction_get_customer_code()
- commerce_avatax_create_transaction in includes/
commerce_avatax.calc.inc - Prepares the transaction request array to be sent to AvaTax.
File
- includes/
commerce_avatax.calc.inc, line 226 - AvaTax calculation/requests functions.
Code
function _commerce_avatax_transaction_get_customer_code($order_wrapper) {
// Get User name or e-mail address.
if ($order_wrapper->uid
->value() === 0) {
$mail = $order_wrapper->mail
->value();
if ($mail == '') {
$customer_code = 'administrator';
}
else {
$user_email = $mail;
$customer_code = commerce_avatax_email_to_username($user_email);
}
}
else {
$customer_code = $order_wrapper->owner->name
->value();
}
return $customer_code;
}