Adyen / adyen-shopware5

MIT License
11 stars 12 forks source link

Empty cart on cancellation/refusal order #16

Closed floorjubbega closed 3 years ago

floorjubbega commented 4 years ago

Describe the bug After an order is cancelled or refused the cart is emptied within Shopware 5. If the shopper would like to add an extra product to their cart from the checkout process, this can cause a bad user experience.

To Reproduce Steps to reproduce the behavior:

  1. Complete a transaction with incorrect cvc
  2. Cart is emptied and shopper will have to add the items again

Expected behavior Cart should have the items that were in the cart before the initial transaction attempt.

runelaenen commented 4 years ago

Hello @floorjubbega

I cannot reproduce your issue. Normally, the customer is redirected to the last page of the checkout again, and gets a notice that their payment was not successful.

The cart is rebuilt based on the old order, a new cart is generated automatically, and the checkout is loaded again using this new cart. The product should thus be automatically selected again. This happens in \AdyenPayment\Components\BasketService::cancelAndRestoreByOrderNumber

Is it possible some custom code in your shop is interfering with the 'cart rebuild' logic of the Adyen plugin?

Screenshot 2020-08-13 at 14 13 56
danielDigitalArt commented 4 years ago

Hello @runelaenen ,

we reported this bug to Floor, we also tried to disable most plugins which might interfere in the checkout process but still the problem persists.

What we had was in the checkout we used the AMEX Credentials, while the account in the adyen backend does not allow adyen Cards. When we click on the buy button the shop loads and immediately goes back to the checkout window stating that the "payment details are not supported": Bildschirmfoto 2020-08-14 um 12 13 39

When i click to change the selected payment the system says that the cart is empty.

While the checkout got this error, i still got an email which says that the order was received, so i guess the problem is related to the case, where no matter hat payment of adyen is selected, it immediately processes the payment, even when the user did not set up any payment credentials whatsoever. Thus emptying the cart, because the order was already processed, but i never saw the order confirmation page.

runelaenen commented 4 years ago

Hi @danielDigitalArt

After a payment is cancelled and you are returned to Shopware, your old cart should be regenerated, based on the temporary order. This all happens in \AdyenPayment\Components\BasketService::restoreFromOrder.

However, this means that you should not get an e-mail. When you receive an e-mail, that means that the order was accepted. This only happens when a notification from Adyen is received & processed, saying that the order was all OK.

I have tried reproducing the issue with your new information (using an amex card) but still cannot reproduce the issue. I'm going to forward this to a colleague of mine who can take a look too.

danielDigitalArt commented 4 years ago

@runelaenen please be aware that i dont think it is specifically related to amex but the account that is connected will not allow amex-cards, so it will create the error message that you see above. Shopware itself then still contiues to process the order and thus empties the cart, which would explain the behavior from the first post.

runelaenen commented 4 years ago

12 seems to describe the same issue, however, as you can see in the video screencap I've posted there, the bug does not occur on my 'empty' shopware installation.

I'm still asking my colleague to take a look at it. Maybe he can spot something that I don't.

acampos1916 commented 3 years ago

Hello all,

After some fixes to the way we received the parameters from redirect payment methods and how the order is restored after a failed payment looks like this isn't an issue anymore. I will close this issue now but feel free to comment with ways to reproduce it if encountered again.

Best, Ángel