adyen-magento2 icon indicating copy to clipboard operation
adyen-magento2 copied to clipboard

[PW-7145] Klarna Offer matching leaves Cancelled Orders against Authorised Payments in Magento

Open AdrianSullivan opened this issue 1 year ago • 1 comments

Making your own contribution is easy, encouraged and greatly appreciated! We will put effort into reviewing and merging your PR quickly. For more info, please refer to the contribution guidelines: https://github.com/Adyen/adyen-magento2/blob/develop/CONTRIBUTING.md

Describe the bug Small number of customers are starting Klarna payment on magento checkout and completing in Klarna portal. Not exactly clear why it happens but is causing problems with order processing in magento (order is cancelled after authorisation) and shipment of orders without payment.

To Reproduce Steps to reproduce the behavior: We have not managed to reproduce in a test environment, but we have an understanding of what is happening. Carlos Perales from your support team has been helpful with this, and I am copy-pasting his summary here. Further details, and a potential fix, can he found in this support ticket: https://www.adyen.help/hc/en-us/requests/3222578

Offers (general flow, not Klarna specific): A payment that is pending authorisation is referred to as an open offer. This is specific to payment methods where authorisation is asynchronous, for example when the payment requires a redirect to the issuer (like Klarna).

As we saw during the call, shoppers can Cancel Offers if they click on the Go back button in the Klarna page. Once this happens, the Offer goes into OfferCancelled status, and that Offer cannot become a payment, and an OFFER_CLOSED Notification is sent, informing of this change to the plugin.

Klarna Offer matching: As we talked about during the call, even though the offer has already been cancelled on our end, shoppers can still authenticate these offers through Klarna portal. In this situation, Klarna provides us with the shopper's proof of payment in a matching request. This way, owe look up the transaction and check that we have received the funds in our bank account, and match the payment in Klarna with the offer, making the offer become a payment on our end.

This is of course an edge case, and is not considered part of the normal payment flow, but it's quite easy to support this with custom integrations, as there are no platform limitations like the ones in Magento (Cancel status being a final, non-mutable status).

Once this happens, and AUTHORISATION Notification is sent out to the plugin, as all events are informed regardless of whether they followed an edge case or not.

Notifications: Asynchronous notifications are quite important for our plugin, since they're used to update the status of the orders. All notifications are accepted when they arrive, and processed by a cronjob that looks up every order, and update the status accordingly. However, the cronjob is unaware of what specific flow the payment followed, it just matches the notification content with the correct status.

Since Cancelled orders cannot be reopened in Magento, once the OFFER_CLOSED is processed by the cronjob, the order will not be reopened, even if the payment status in Adyen is Authorised.

Expected behavior Orders with payments completed as above are not cancelled in magentp.

Magento version 2.4.4

Plugin version 8.2.2

Additional context Add any other context about the problem here.

AdrianSullivan avatar Aug 29 '22 10:08 AdrianSullivan

Hi @AdrianSullivan,

Thank you for reporting this issue with us. An internal ticket has been created and we will be looking into this.

Kind regards, Rok, Adyen

RokPopov avatar Sep 02 '22 11:09 RokPopov