Conversation
…, there is an incorrect behavior in the tax calculation logic, and product discounts/order discounts are not taken into account at all. It looks really strange. So I fixed it this way: we use orderLine.TotalPriceWithProductDiscounts - as a product price for calculation (it already has a discount), and removed strange check: if (string.Equals(line.TaxCode, Provider.TaxCodeShipping, StringComparison.Ordinal)) So if the orderDiscount > 0, we mark all order lines as discounted. I suppose it will fix the error and calculation logic.
MatthiasSort
approved these changes
Dec 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NOTE: we have unmerged changes in the: #2
So we need to merge it first, AND THEN probably update the package version here if needed.
The task: https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/26742
Fixed an exception that occurred when there was an Order Discount in the Order.
In addition, there is an incorrect behavior in the tax calculation logic, and product discounts/order discounts are not taken into account at all. It looks really strange. So I fixed it this way: we use
orderLine.TotalPriceWithProductDiscounts- as a product price for calculation (it already has a discount), and I also removed strange check:So if the
orderDiscount > 0, we mark all order lines as discounted.I suppose it will fix the error and calculation logic.
BUT, I'll probably need some review, since the previous code was ported from DW9, and I'm changing the logic. I can only assume that Avalara has always handled discounts incorrectly before.