nopSolutions / nopCommerce

ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
https://www.nopcommerce.com
Other
9.31k stars 5.33k forks source link

Tax (fixed or by country/state/zip) plugin payment method additional fee error #4936

Closed AndreiMaz closed 3 years ago

AndreiMaz commented 4 years ago

nopCommerce version: 4.3

Expected behavior: Valid Total Tax calculation including Payment additional fee when Payment fee is taxable

Actual behavior: Payment fee tax added to Total Tax multiple times

Steps to reproduce the problem: Configuration > Settings > Tax settings > Payment Payment method additional fee is taxable, Payment method additional fee tax category > something, not 0

The solution: In FixedOrByCountryStateZipTaxProvider.cs file > GetTaxTotal class the //payment method additional fee section should be INSIDE the following if statement brackets: if (!(_httpContextAccessor.HttpContext.Items.TryGetValue("nop.TaxTotal", out var result) && result is TaxTotalResult taxTotalResult)) { }

Currently it is after the closing bracket.

Source: https://www.nopcommerce.com/en/boards/topic/84841/tax-fixed-or-by-countrystatezip-plugin-payment-method-additional-fee-error

RomanovM commented 3 years ago

Currently it is after the closing bracket.

It's by design to avoid circular reference when calculating payment method additional fee during the checkout process.

But the payment tax is indeed calculated incorrectly if the percentage additional fee is used.