taxjar / taxjar-magento2-extension

Magento 2 Sales Tax Extension by TaxJar
http://www.taxjar.com/guides/integrations/magento2/
Open Software License 3.0
22 stars 29 forks source link

Customize the TaxJar API rate response in Magento 2 to round off from two decimal points to four decimal points. #374

Open mohitgohel80 opened 2 months ago

mohitgohel80 commented 2 months ago

Description

We are currently encountering an issue with our Magento 2 store's tax calculations, specifically regarding the integration with the TaxJar sales tax extension from GitHub. After thorough analysis, we have identified a discrepancy between the tax rates in Magento and QuickBooks.

Upon inspecting the API response from TaxJar, we noticed that the combined_tax_rate is returned as 0.08 after two decimal points. However, for accurate synchronization with our systems, we require the combined_tax_rate to be rounded to four decimal points.

To ensure consistency between Magento and QuickBooks, we need assistance in customizing the API response to display the combined_tax_rate with four decimal points. This modification will enable us to align our tax calculations accurately.

Could you please guide us on how to modify the combined_tax_rate to display four decimal points in Magento 2? Any instructions or support you can provide on implementing this customization would be greatly appreciated.

Expected Result

Tax rate is 8.1250%

How does Taxjar calculate sales tax? Please refer to the following equations.

Total Product Price : 19.99 × 0.08 = 1.5992 Shipping Cost : 10.75 × 0.08 = 0.86 Tax : 1.5992 + 0.86 = 2.4592 Roundup 2.46

How does Quickbook calculate sales tax? Please refer to the following equations.

Total Product Price : 19.99 × 0.08125 = 1.6241875 Shipping Cost : 10.75 × 0.08125 = 0.8734375 Tax : 1.6241875 + 0.8734375 = 2.497625 roundup 2.50

Actual Result

So the above calculation is a mismatch form Taxjar and QuickBooks due to Taxjar API response of two decimal points like 0.08 instance of 0.08125.

Versions