You are here

public function OrderSubscriber::commitTransaction in Drupal Commerce Connector for AvaTax 8

Commits a transaction or the order in AvaTax.

Parameters

\Drupal\state_machine\Event\WorkflowTransitionEvent $event: The workflow transition event.

File

src/EventSubscriber/OrderSubscriber.php, line 61

Class

OrderSubscriber

Namespace

Drupal\commerce_avatax\EventSubscriber

Code

public function commitTransaction(WorkflowTransitionEvent $event) {

  /** @var \Drupal\commerce_order\Entity\OrderInterface $order */
  $order = $event
    ->getEntity();
  if ($this->config
    ->get('disable_commit') || !Avatax::hasAvataxAdjustments($order)) {
    return;
  }
  $this->avataxLib
    ->transactionsCreate($order, 'SalesInvoice');
}