diff --git a/Model/TransactionProcessor.php b/Model/TransactionProcessor.php index d42fe150..a7ca84c8 100644 --- a/Model/TransactionProcessor.php +++ b/Model/TransactionProcessor.php @@ -215,8 +215,6 @@ private function processReservedTransaction(QuoteInterface $vippsQuote, Transact $vippsQuote->setStatus(QuoteInterface::STATUS_RESERVED); $this->quoteManagement->save($vippsQuote); - $this->sendOrderConfirmation($order); - return $order; } @@ -421,18 +419,6 @@ private function authorize(OrderInterface $order, Transaction $transaction) $this->orderRepository->save($order); } - /** - * Send order conformation email if not sent - * - * @param Order|OrderInterface $order - */ - private function sendOrderConfirmation($order) - { - if ($order->getCanSendNewEmailFlag() && !$order->getEmailSent()) { - $this->orderManagement->notify($order->getEntityId()); - } - } - /** * @param $lockName * diff --git a/Observer/CheckoutSubmitAllAfter.php b/Observer/CheckoutSubmitAllAfter.php index 805b25db..cc1bc13a 100644 --- a/Observer/CheckoutSubmitAllAfter.php +++ b/Observer/CheckoutSubmitAllAfter.php @@ -71,20 +71,21 @@ public function __construct( */ public function execute(Observer $observer) { - try { - /** @var OrderInterface $order */ - $order = $observer->getData('order'); + /** @var OrderInterface $order */ + $order = $observer->getData('order'); + if ('vipps' == $order->getPayment()->getMethod()) { + try { + // send order placed email + $this->notify($order); - // send order placed email - $this->notify($order); - - // updated vipps quote - $vippsQuote = $this->quoteRepository->loadByOrderId($order->getIncrementId()); - $vippsQuote->setOrderId((int)$order->getEntityId()); - $vippsQuote->setStatus(QuoteInterface::STATUS_PENDING); - $this->quoteRepository->save($vippsQuote); - } catch (\Throwable $t) { - $this->logger->error($t->getMessage()); + // updated vipps quote + $vippsQuote = $this->quoteRepository->loadByOrderId($order->getIncrementId()); + $vippsQuote->setOrderId((int)$order->getEntityId()); + $vippsQuote->setStatus(QuoteInterface::STATUS_PENDING); + $this->quoteRepository->save($vippsQuote); + } catch (\Throwable $t) { + $this->logger->error($t->getMessage()); + } } }