Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

Incorrect subtotal_amount with Paypal and a non-free shipping amount #121

Open
real34 opened this issue Jun 22, 2017 · 3 comments
Open

Incorrect subtotal_amount with Paypal and a non-free shipping amount #121

real34 opened this issue Jun 22, 2017 · 3 comments

Comments

@real34
Copy link

real34 commented Jun 22, 2017

We found an issue with the latest version of this module on PHP 7.0.13.
It seems to be related to the topological sort implemented in the Mage_Sales_Model_Config_Ordered override.

We have reverted the extension to v2.0.0 and it works properly

To reproduce:

  • add items to a cart (1 item is sufficient)
  • select a non-free shipping method (it works fine with free shipping method)
  • select Paypal as payment method

What happens

When being redirected to Paypal the customer gets an error The totals of the cart item amounts do not match order amounts.

Expected

Totals should be calculated correctly

More details

Below are the totals sent to Paypal in 3 different use cases, with the same cart : with the override (with / without a free shipping method), without the override (with a non-free shipping method).

It seems that the totals calculation error is that the shipping tax amount is subtracted from the subtotal.

// with override
// with non free shipping (12.7€ incl. Taxes)
(
    [AMT] => 25.53
    [ITEMAMT] => 10.34 <-- here is the problem. 10.34 is the items amt (12.46) minus the shipping tax (12.7-10.58)
    [TAXAMT] => 4.61
    [SHIPPINGAMT] => 10.58
    [L_NUMBER0] => julius-k9_162-LRW-G-W
    [L_QTY0] => 1
    [L_AMT0] => 12.46
)
// with free shipping
(
    [AMT] => 14.95
    [ITEMAMT] => 12.46
    [TAXAMT] => 2.49
    [SHIPPINGAMT] => 0.00
    [L_NUMBER0] => julius-k9_162-LRW-G-W
    [L_QTY0] => 1
    [L_AMT0] => 12.46
)

// without override
(
    [AMT] => 27.65
    [ITEMAMT] => 12.46
    [TAXAMT] => 4.61
    [SHIPPINGAMT] => 10.58
    [L_NUMBER0] => julius-k9_162-LRW-G-W
    [L_QTY0] => 1
    [L_AMT0] => 12.46
)

Without the override the amounts are what is expected.

@mokadev
Copy link

mokadev commented Oct 24, 2017

Hi

Same problem here with Paypal Express Checkout

Hoping that revertind to 2.0.0 will not break anything else.

Thanks @real34 👍

@ZieClaw
Copy link

ZieClaw commented Oct 31, 2017

@real34 @mokadev This is probably related to the usort issue I ran into, try adding a sort order to the msrp via the config.xml of the module will most likely fix it as it also fixed my issues with the tax being applied wrong acting as if prices where entered including tax instead of excluding it

For an example of what it should look like, check out my opened issue.

@ivanweiler
Copy link
Contributor

Related to #123 #124

Thx everyone for reporting. It will be fixed in next release, or reverted back to logic in v.2.0.0 since everyone reported that works:

<!-- Fix for incorrect sorting in the calculation of the discount -->
<sales>
<quote>
<totals>
<msrp>
<before>grand_total</before>
</msrp>
<shipping>
<after>subtotal,freeshipping,tax_subtotal,msrp</after>
</shipping>
</totals>
</quote>
</sales>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants