/** * If AvaTax GetTaxRequest failed and if configuration is set to prevent checkout, throw exception * * @param \Magento\Framework\Event\Observer $observer * @return $this * @throws LocalizedException */ public function execute(\Magento\Framework\Event\Observer $observer) { /** @var \Magento\Sales\Api\Data\OrderInterface $order */ $order = $observer->getOrder(); if ($this->coreRegistry->registry(Tax::AVATAX_GET_TAX_REQUEST_ERROR)) { $errorMessage = $this->config->getErrorActionDisableCheckoutMessage($order->getStoreId()); throw new LocalizedException($errorMessage); } return $this; }
/** * Check to see if there was an error during tax calculation, and if so, throw exception to prevent further progress * * @param $storeId * @return void * @throws LocalizedException */ protected function ensureTaxCalculationSuccess($storeId) { if ($this->coreRegistry->registry(Tax::AVATAX_GET_TAX_REQUEST_ERROR)) { $errorMessage = $this->config->getErrorActionDisableCheckoutMessage($storeId); throw new LocalizedException($errorMessage); } }