[BUGFIX] Switch order of PaymentEvent & StockEvent#572
[BUGFIX] Switch order of PaymentEvent & StockEvent#572rintisch wants to merge 1 commit intoextcode:mainfrom
Conversation
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: extcode#571
baad7ce to
c07b808
Compare
|
I think this change would already be a breaking change. The original idea to choose this order was that a payment process can take a while until all the data has been entered. In the meantime, another user could buy the last available products and pay faster than the first user. A rather unlikely case, but still possible. Since the current behavior of the payment providers is such that the order is saved even before the redirect to the payment provider and the order is marked as canceled in the event of an error, the stock should rather be updated again in the event of an error. I have to say that I have no idea how often the stock management in cart-products is really used. |
|
That sounds reasonable! I guess you mean you look what needs adaption in the payment extensions (instead of "product extensions")? When no realizing this ticket we need to adapt the documentation: https://docs.typo3.org/p/extcode/cart/main/en-us/Developer/Events/Index.html#confval-extcode-cart-event-order-stockevent |
|
All reasonable arguments, @extcode . Problem of current behavior is: if the payment fails – or even if the customer simply does not process the payment process – the stock remains too low. Therefore it's not clever if the payment provider rolls back the stock in case of a failed payment, because it has no chance to do so if the customer simply closes the payment window. |
|
I close this ticket due to the discussion in #571. Another solution will follow. |
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