Basically coming from #3266942: Duplicate Payment Items and a Slack discussion with @jsacksick, we have identified the RedirectController as a potential problem for raising duplicate checkout complete events.
The order entity provided by route parameter should not be used as is, but reloaded with the special loadForUpdate() function provided by the order storage.
This should reduce risk of this sort of problem. In the long run, we'll want to implement #3480167: Klarna Payments Authorization Callback, making this redirect controller possibly obsolete, but that requires more work. So improving the current logic would reduce the pressure on implementing the authorization callback. There we'll also have to take care to use the correct loading function, so we keep being reminded, when the existing controllers follow this pattern
Issue fork commerce_klarna_payments-3484283
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
agoradesign commentedI'll test this now in a sandbox, report back then
Comment #4
agoradesign commented