![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/app/code/StripeIntegration/Tax/Observer/ |
<?php namespace StripeIntegration\Tax\Observer; use \Magento\Framework\Event\ObserverInterface; use \Magento\Framework\Event\Observer; use StripeIntegration\Tax\Exceptions\OrderException; use StripeIntegration\Tax\Model\StripeTax; use StripeIntegration\Tax\Model\TaxFlow; class OrderProceed implements ObserverInterface { private $taxFlow; private $stripeTax; public function __construct( TaxFlow $taxFlow, StripeTax $stripeTax ) { $this->taxFlow = $taxFlow; $this->stripeTax = $stripeTax; } public function execute(Observer $observer) { $order = $observer->getEvent()->getOrder(); // Check only if Tax enabled and order is new if ($this->stripeTax->isEnabled() && !$order->getId()) { if (!$this->taxFlow->canOrderProceed()) { throw new OrderException(__('Tax could not be calculated.')); } } } }