Sylius / PayPalPlugin

Official integration with PayPal Commerce Platform
36 stars 54 forks source link

Fix and enhance the tax provider #298

Open maikrosenthal opened 2 months ago

maikrosenthal commented 2 months ago
Q A
Branch? 1.6 (bug fixes, improvements)
Bug fix? yes
New feature? no

This PullRequest fixes or changes the following aspects of the taxes to be submitted to PayPal:

  1. The OrderItemNonNeutralTaxesProvider determines both the TaxAdjustemts of the OrderItem and the respective TaxAdjustemts of all units and adds their amounts to an array. The PayPalItemDataProvider then iterates over these amounts and creates an item with quanity 1, unitPrice and tax. However, since an item can also have a quantity higher than 1, the totals no longer match in such a case.

To fix this error, the TaxAdjustments of the OrderItems are distributed to the respective units.

  1. The OrderItemNonNeutralTaxesProvider only determines the non-neutral taxes. In order to transmit all taxes, the neutral taxes are also determined and processed.

Unfortunately, I am not a professional when it comes to tax law in different countries. Therefore, I would be grateful for any feedback if any problems arise.