mollie / magento2

Mollie Payments for Magento 2
https://www.mollie.com
Other
98 stars 49 forks source link

[BUG] "Mark as paid" created new order with wrong totals when using Custom Prices #745

Closed simonmaass closed 3 months ago

simonmaass commented 4 months ago

Describe the bug When clicking "Mark as paid" a new order is created and the old one is set to "Canceled". The new order now has wrong totals!

Used versions

To Reproduce Steps to reproduce the behavior:

  1. Create Order in admin backend with custom price on the product
image
  1. Chose payment method "payment-link" for example
  2. Create Order
  3. When Order is in "payment pending" state click on "Mark as paid"

Expected behavior New order is created with the same product totals as the old order!

Actual behavior The new order is created with the original product price!

Screenshots Old order:

image

New order:

image
simonmaass commented 4 months ago

Update: After doing some more research it seams like this bug only happens when you set the custom price to 0€... my first thought would be that some kind of truthy check fails with 0...

Frank-Magmodules commented 4 months ago

Hi There @simonmaass ,Thank you for opening this issue. We were unable to reproduce this. Could you please try this on a plain Magento 2 installation with only Mollie installed to see if this issue is then still present? Thanks!

simonmaass commented 4 months ago

@Frank-Magmodules I was able to reproduct the bug when setting a custom price to 0€:

Old order:

image

New order created by "Mark as paid":

image
Frank-Magmodules commented 3 months ago

Hello @simonmaass, I have replicated the issue now. It's indeed strange. I'll look into this with the team and provide you with an update shortly. Thank you for providing the additional information. It seems the problem is caused by the 0,00 number. We're not sure if it's Magento or Mollie responsible for this, but we'll investigate and find out.

Frank-Magmodules commented 3 months ago

Hi There @simonmaass ,

Once again, thank you for opening this issue. It seems that this error is on the Magento side.

To be even more precise, it is due to this line: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Quote/Model/Quote/Item/Processor.php#L104 At that point $customPrice === (int)0, which returns false when compared with empty.

Since it appears to be a Magento-related problem rather than an issue specifically with the Mollie plugin, we will be closing this ticket for now.

simonmaass commented 3 months ago

I found an open issue for magento for this: https://github.com/magento/magento2/issues/36970

There is also an open pull request: https://github.com/magento/magento2/pull/37625

Frank-Magmodules commented 3 months ago

Perfect @simonmaass , thanks for sharing!