mollie / Magento

Mollie Payments for Magento 1.x
https://www.mollie.com/
BSD 2-Clause "Simplified" License
39 stars 30 forks source link

Klarna returns error when totalAmount differs from sum of orderLine when using discount (on the whole order instead of orderLine) #218

Closed frekel closed 2 years ago

frekel commented 2 years ago

When we add a coupon for the complete order (thus giving a discount on the whole order), the totalAmount is not the same as the sum of the orderLines. Klarna then returns an error that the amount are not the same.

How can we fix this? (we can't add a new orderline with just the discount as Magento does not support this)

We did try to upgrade to the latest version (5.6.8) but that did not solve the problem on our acceptance environment.

Klarna response:

2022-02-18T08:06:50+00:00 DEBUG (7): request: {"amount":{"currency":"EUR","value":"124.00"},"orderNumber":"100319472","billingAddress":{"organizationName":"[COMPANYNAME]","title":"Dhr.","givenName":"Frank","familyName":"[LASTNAMEl]","email":"[email]@[COMPANYNAME]","streetAndNumber":"[STREET]","postalCode":"[ZIP]","city":"[TOWN]","country":"NL"},"lines":[{"type":"physical","name":"Eames House Bird collectors item","quantity":1,"unitPrice":{"currency":"EUR","value":"189.00"},"totalAmount":{"currency":"EUR","value":"189.00"},"vatRate":"21.00","vatAmount":{"currency":"EUR","value":"32.80"},"sku":"VI04000102","productUrl":"https:\/\/www.flinders.nl\/vitra-eames-house-bird-accessoire","discountAmount":{"currency":"EUR","value":"0.00"}},{"type":"shipping_fee","name":"Dag  tijdvak levering 19 februari 2022 tussen 0800 - 1800","quantity":1,"unitPrice":{"currency":"EUR","value":"0.00"},"totalAmount":{"currency":"EUR","value":"0.00"},"vatRate":"0.00","vatAmount":{"currency":"EUR","value":"0.00"},"sku":"flinders_deliver"}],"redirectUrl":"https:\/\/www.flinders.nl\/mpm\/api\/return\/?order_id=501453&payment_token=6affe699bd1e5b39c4a5a76b2a665113&utm_nooverride=1","webhookUrl":"https:\/\/www.flinders.nl\/mpm\/api\/webhook","locale":"nl_NL","method":"klarnasliceit","metadata":{"order_id":"501453","store_id":"1","payment_token":"6affe699bd1e5b39c4a5a76b2a665113"},"shippingAddress":{"organizationName":"[COMPANYNAME]","title":"Dhr.","givenName":"Frank","familyName":"[LASTNAMEl]","email":"[email]@[COMPANYNAME]","streetAndNumber":"[STREET]","postalCode":"[ZIP]","city":"[TOWN]","country":"NL"}}
2022-02-18T08:06:50+00:00 DEBUG (7): error: Error executing API call (422: Unprocessable Entity): The amount of the order does not match the total amount from the order lines. Expected order amount to be €189.00 but got €124.00. Field: amount. Documentation: https://docs.mollie.com/overview/handling-errors
2022-02-18T08:06:51+00:00 DEBUG (7): info: Canceled order 100319472

THANKS for the assistance!

Frank-Magmodules commented 2 years ago

HI @frekel , 

Thank you for opening this issue, it seems we can't reproduce this issue from our side.

Can you contact us directly through our contact form with the exact steps on how we can reproduce this and which modules you are using that can reflect on this? From there, we can investigate this issue further with you to find a solution.

Frank-Magmodules commented 2 years ago

HI @frekel ,

Due to the lack of information and we can't reproduce this issue, we will close this issue for now. Please feel free to reopen the issue or contact us directly through our contact form so we can investigate this issue further with you.