mollie / magento2

Mollie Payments for Magento 2
https://www.mollie.com
Other
100 stars 53 forks source link

Quote is restored if customer places second order within 5 minutes #592

Closed bolleba closed 1 year ago

bolleba commented 1 year ago

Describe the bug After going to the checkout, the quote of the last order is restored again if the second order is placed in less than 5 minutes after the first order.

Used versions

To Reproduce Steps to reproduce the behavior:

  1. Add a product to the cart
  2. Complete order using mollie payment method
  3. Add a new product
  4. Complete order using mollie payment method

Expected behavior The second order is placed, and the cart is empty.

Actual behavior The second order is placed, but the items remain in the cart.

Additional context This seems to be related to the fix from https://github.com/mollie/magento2/issues/560. I added some logging into Observer/ControllerActionPredispatchCheckoutIndexIndex/RestoreQuoteOfUnsuccessfulPayment.php to debug the time difference check on line 56.

$createdAt = $this->timezone->date(new \DateTime($order->getCreatedAt())); $now = $this->timezone->date(); $diff = $now->diff($createdAt);

This shows the following results: $createdAt = 2022-12-05 14:58:04 $now = 2022-12-05 15:02:28 $diff = 4 -> the quote is restored because there is only a difference of 4 minutes

So when a customer places a new order within 5 minutes of his last order, the quote gets restored.

Frank-Magmodules commented 1 year ago

Hi @bolleba ,

Thank you for opening this issue! It's a tricky one because you can't really look at the bottom status. It is sometimes pending, for PayPal that is fine, but not for iDeal, for example. That is why it is difficult to see whether an order has been paid or not.

I will discuss this internally to check if we can come up with a good idea on this.

Frank-Magmodules commented 1 year ago

Hi @bolleba ,

We are happy to share that we’ve just released the new 2.21.0 version where we covered your case.
Thank you for opening this issue and for the detailed issue report. 

We are closing this issue now but please feel free to reopen the issue if this still occurs.