protected function AvataxLib::resolveCustomerProfile in Drupal Commerce Connector for AvaTax 8
Resolves the customer profile for the given order item. Stolen from TaxTypeBase::resolveCustomerProfile().
Parameters
\Drupal\commerce_order\Entity\OrderItemInterface $order_item: The order item.
Return value
\Drupal\profile\Entity\ProfileInterface|null The customer profile, or NULL if not yet known.
1 call to AvataxLib::resolveCustomerProfile()
- 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 473
Class
- AvataxLib
- The AvaTax integration library.
Namespace
Drupal\commerce_avataxCode
protected function resolveCustomerProfile(OrderItemInterface $order_item) {
$order = $order_item
->getOrder();
$customer_profile = $order
->getBillingProfile();
// A shipping profile is preferred, when available.
$event = new CustomerProfileEvent($customer_profile, $order_item);
$this->eventDispatcher
->dispatch(TaxEvents::CUSTOMER_PROFILE, $event);
$customer_profile = $event
->getCustomerProfile();
return $customer_profile;
}