From c07b80865cfb1b75d690e78e0cb724e163d05a13 Mon Sep 17 00:00:00 2001 From: rintisch Date: Tue, 1 Oct 2024 10:25:11 +0200 Subject: [PATCH] [BUGFIX] Switch order of PaymentEvent & StockEvent The PaymentEvent has to be placed before the StockEvent because the order can fail in the PaymentEvent so the StockEvent has to be placed after the PaymentEvent. In case a PaymentProvider uses forwarding the PaymentEvent and FinishEvent has to be triggered within the EventListener of the PaymentEvent. This is already described in the docs. Fixes: #571 --- Classes/Controller/Cart/OrderController.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Classes/Controller/Cart/OrderController.php b/Classes/Controller/Cart/OrderController.php index f305493f..6d831b88 100644 --- a/Classes/Controller/Cart/OrderController.php +++ b/Classes/Controller/Cart/OrderController.php @@ -220,18 +220,18 @@ protected function dispatchOrderCreateEvents(Item $orderItem): bool return true; } - $stockEvent = new StockEvent($this->cart, $orderItem, $this->configurations); - $this->eventDispatcher->dispatch($stockEvent); - if ($stockEvent instanceof StoppableEventInterface && $stockEvent->isPropagationStopped()) { - return true; - } - $paymentEvent = new PaymentEvent($this->cart, $orderItem, $this->configurations); $this->eventDispatcher->dispatch($paymentEvent); if ($paymentEvent instanceof StoppableEventInterface && $paymentEvent->isPropagationStopped()) { return true; } + $stockEvent = new StockEvent($this->cart, $orderItem, $this->configurations); + $this->eventDispatcher->dispatch($stockEvent); + if ($stockEvent instanceof StoppableEventInterface && $stockEvent->isPropagationStopped()) { + return true; + } + $finishEvent = new FinishEvent($this->cart, $orderItem, $this->configurations); $this->eventDispatcher->dispatch($finishEvent); if ($finishEvent instanceof StoppableEventInterface && $finishEvent->isPropagationStopped()) {