-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible miscalculation of discounts in transactions #41
Comments
Hi @jkelleyj Thanks for reporting this issue. We will fix it soon. |
Thanks @avneetmalhotra I've been working with the extension and making some changes in my own repo, so I haven't fully confirmed this issue. According to TaxJar's api, the discounts on the line item should be the full discount amount for that line (not the per unit discount): It says the API will raise a 400 error if the amount and the line item amounts + discounts don't line up, so I'm surprised no one using this extension has seen that error if this is actually a bug. Will let you know as I find more details in our testing. |
I'm also a little suspicious of using Maybe a better approach is: This weightage could be multiplied by the taxable amount of the line item so we get a pure ratio that will be guaranteed to add up to 100% of the adjustments sum |
In transactions, the "weightage" function used to distribute the discounts across line items is a little off. It uses the unit_price instead of the
unit_price * quantity
https://github.com/vinsol-spree-contrib/spree_taxjar/blob/master/app/models/spree/taxjar.rb#L207I believe this will under-represents the discounts, though this may have no bearing on the tax reported if TaxJar uses the amount field exclusively.
Have you experienced any API validation errors regarding the discounts not matching the totals?
The text was updated successfully, but these errors were encountered: