Skip to content

Commit

Permalink
[BUGFIX] Switch order of PaymentEvent & StockEvent
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rintisch committed Oct 1, 2024
1 parent 560a455 commit c07b808
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Classes/Controller/Cart/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit c07b808

Please sign in to comment.