Klarna provides the merchant_reference1 field, which should be used to set the order number - otherwise the merchant won't easily be able to match the Klarna invoice with the Commerce order. I see that the problem is here that we create the Klarna invoice before we have the order number (as it isn't placed at that time).

However we could easily act on the order place transition and send an update request to Klarna... Patch to follow

Comments

agoradesign created an issue. See original summary.

agoradesign’s picture

Status: Active » Needs review
StatusFileSize
new1.86 KB

This should do the trick - however the Klarna Playground went into maintenance a few seconds before I could verify that the order number was set correctly... I'll comment on this later

agoradesign’s picture

StatusFileSize
new2.1 KB

next try

agoradesign’s picture

Now it works as expected

tuutti’s picture

Status: Needs review » Needs work

I think we should check if merchant_reference1 field has value before updating it so we don't accidentally override it.

agoradesign’s picture

StatusFileSize
new2.2 KB

Added the check... need to another test now, b/c I currently have 3 patches applied, it's easier to post the patch first, then test ;)

agoradesign’s picture

Status: Needs work » Needs review

still works for me

  • tuutti committed 6fbaba5 on 8.x-1.x authored by agoradesign
    Issue #3013336 by agoradesign: Set the order number on order placement
    
tuutti’s picture

Status: Needs review » Fixed

Yep, seems to work. Nice work!

agoradesign’s picture

thanks for all the quick responses and commits :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.