PAYONE-GmbH / magento-2

PAYONE Payment Extension for Magento 2
28 stars 56 forks source link

Cannot checkout with PayPal Express #508

Closed pzlamaniec closed 1 year ago

pzlamaniec commented 1 year ago

The problem is occurring in stores that deliver to more than one country which have different tax amounts.

This is happening because by default the tax is set to X% and it will be changed after you select a country in PayPal Express. This will cause changes in subtotal, which is causing the problem.

For example:

  1. you are buying a product with a default tax of 19%
  2. in Paypal Express you choose a country where tax is different (for example 20%)
  3. subtotals from cart view and PayPal Express summary do not match and the error is thrown

here is the code responsible for the error: https://github.com/PAYONE-GmbH/magento-2/blob/v3.7.0/Controller/Onepage/PlaceOrder.php#L110

janteuber commented 1 year ago

Hello @pzlamaniec ,

Sorry for the late reply.

I have forwarded the case to our developers. As soon as I have an answer, I will get back to you.

FatchipRobert commented 1 year ago

@pzlamaniec Hmm.. The subtotal does not include tax in Magento usually, so changing tax rates should not trigger the mentioned line of code. The main purpose of the mentioned line of code is preventing tabbed fraud with people changing the basket in another tab.

I tried a lot of different tax calculation configurations and changing from a lower default tax rate to a higher taxed country in PayPal Express and vice versa but I was not able to reproduce this problem yet.

It would be helpful If you could post me your tax calculation configuration here. (Backend->Configuration->Sales->Tax->Calculation Settings)

pzlamaniec commented 1 year ago

Thanks for your reply.

Yes, you are right, subtotal does not contain tax information. However, in case catalog prices contain tax, the subtotal will be affected if tax value changes. For example, you are buying something for €199 total:

conf_sales_tax_caluclation_settings
FatchipRobert commented 1 year ago

Thanks for the reply.

I will check that.

FatchipRobert commented 1 year ago

Hello @pzlamaniec,

I was able to reproduce the problem and I fixed the problem by using another mechanism to check the basket for changes.

The bugfix can be found here: #517

pzlamaniec commented 1 year ago

Hi @FatchipRobert Great news, Thanks!