mollie / Magento

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

Total Paid in order set twice with Klarna #185

Closed mybinaryromance closed 3 years ago

mybinaryromance commented 3 years ago

When using Klarna Payment Methods (Pay later) in Magento CE 1.9.4.5 the order total paid amount is doubled. This is only in order view. The invoice is created correctly, and so are creditmemos.

mollie.log (this example order) contains these errors: 2020-07-15T08:27:03+00:00 DEBUG (7): error: Missing Redirect Url, increment ID: #M-100023937 2020-07-15T08:27:09+00:00 DEBUG (7): error: Missing Redirect Url, increment ID: #M-100023937

mollie_overpay_db mollie_overpay

Frank-Magmodules commented 3 years ago

Hi @mybinaryromance ,

I know that there has been direct contact with you and Mollie about this issue but I'm not sure what the current state is of the issue. Can you please let me know if the issue still occurs or close the issue if it's not applicable anymore? Also, feel free to contact us directly.

Thank you!

Frank-Magmodules commented 3 years ago

Hi @mybinaryromance ,

Do you have any update on this issue? Please let me know if you need any further assistance so we can help you out with this issue.

mybinaryromance commented 3 years ago

The issue is still occuring. As a workaround I tried using a local overwrite of Mollie_Mpm_Model_Client_Orders where I added a check for $order->getTotalPaid() before $payment->registerCaptureNotification. this is around line 254 in Mollie_Mpm_Model_Client_Orders::processTransaction().

We use the Magento system setting "On Authorize and set status Paid before shipment" for "When to create the invoice?"

What actually seems to happen is that everything runs smooth in the first place, when the order is placed the invoice is created and the correct order total is marked as paid. some time later there happens another webhook call setting the order status to 'complete'. During this call, Mollie_Mpm_Model_Client_Orders::processTransaction() is run and $payment->registerCaptureNotification will be triggered. As the state of the original invoice is still 'open', magento will capture the total again and add it to the order totalPaid.

The correct fix for this might be to create a new klarna invoice with Mage_Sales_Model_OrderInvoice::STATE PAID

Frank-Magmodules commented 3 years ago

Hi @mybinaryromance,

We are happy to share that we've just released the new 5.6.3 version with a fix for this issue. Thank you again for the detailed reports and patience. We are closing this issue now but please feel free to reopen the issue if this still occurs.