Active
Project:
Commerce Klarna Payments
Version:
8.x-2.0-beta5
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Feb 2022 at 15:02 UTC
Updated:
29 Oct 2024 at 09:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tuutti commentedHi!
With "order receipt" do you mean commerce's default order receipt or something that is sent by Klarna?
Comment #3
elex commentedHi,
I mean the commerce's default order receipt, see attached the commerce order log and transactions.
Comment #4
tuutti commentedI don't think this is caused by #3043180: The changes made to the order on the onNotify method are not applied on the onReturn method because the notification URL is only called on pending orders: https://docs.klarna.com/order-management/integration-guide/pending-orders/
I'm wondering if this is some kind of a race condition in our
OrderTransitionSubscribersince we subscribe to multiplepre_transitionevents.What checkout workflow are you using (Commerce -> Configuration -> Order types -> Edit your order type -> Workflow)?
Comment #5
elex commentedI am using the Fulfillment (order_fulfillment) Workflow. But it is not happening all the times.
Maybe it is a good start to log the causing event in onOrderPlace?
Comment #6
tuutti commentedHmm, onOrderPlace is not called until you fulfill the order, so it's not actually caused by that.
Comment #7
elex commentedHm ... as I have two order transactions, they must be created by the PaymentGateway\Klarna createPayment function? And this is called by?
Comment #8
tuutti commentedcreatePayment() is called by Klarna::onReturn().
In theory this could be caused by misbehaving browser back button, like if the user presses back button at the same time as they've been redirected back to onReturn() callback, causing similar issue as described in #3043180: The changes made to the order on the onNotify method are not applied on the onReturn method.
Comment #9
agoradesign commentedThe back button problem seems to happen quite often, at least at the website, we have added Klarna a few weeks ago
Comment #10
agoradesign commentedHappened again... quite every day now.. one thing, I missed out to add: we never have a second payment entity, but checkout complete event is triggered twice, which triggers the order place transition twice, and any event subscriber will trigger twice. So the customer will receive 2 e-mails with two different order numbers, etc
Comment #11
agoradesign commentedAdded #3484283: Controllers handling order data should use loadForUpdate() and #3480167: Klarna Payments Authorization Callback as related issues, as both should improve/solve this problem