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
Update SalesTaxService.php #4
Conversation
Makes sure discounts for specific line items take in any Avatax Tax Code overrides that may be present for that line item.
Hi @mildlygeeky - I guess I thought that discounts needed their own discount-specific code but that test case you sent over definitely shows line item discounts need to be handled differently especially when tax exemptions are in the mix. Let me do some testing and maybe verify with Avalara the right way to send those line item discounts. |
thanks for looking @imagehat — taking a look at https://developer.avalara.com/avatax/dev-guide/discounts-and-overrides/discounts/ and looking at "Negative Amount Line Items" (the way you are sending them over), you can see that the Expected API Call shows that the Tax Codes are expected to match between a taxable line item and its discount adjustment. From their instructions (emphasis mine):
Without the tax codes matching, Avalara just assumes that any/all tax code line items are subject to the discount, and can result in some pretty odd results (for us, we had negative sales tax being calculated for a low-priced item that was in the same order as a discounted high-price item that was sales tax exempt). |
I would even say that their note on how they think about discounts should probably negate the need for the |
@mildlygeeky - No worries. I'm just checking with Avalara since we specifically went over discounts as part of their certification process. Their main stipulation was that a store owner could set their own discount code, but I think the way you're seeing as just matching either the default or line item tax codes makes more sense. I'd say we're aiming to get an answer and test your patch early next week at the latest. |
Hey @imagehat - any chance this could be pushed to a dev branch while it goes through internal testing? That way I could point to it with composer while it goes through validation with Avalara. Thanks! |
@mildlygeeky - For now I've pushed this pr into a new dev-discounts branch. I think you should be able to grab it with The Avalara folks laid out several discount scenarios I'm hoping to get to spend some time digesting and getting implemented in the next few days (along with a couple other bugfixes). |
Would appreciate you checking to make sure that my logic is sound, but we were running into an issue where discounts for a specific line item were being applied always with the default discount code, though our line items were using the Avatax Tax Code override field.
This checks a discount adjustment to see if it applies to a specific line item, and if so checks that Product to see if there is an Avatax tax code override — if so, then that will be the discountCode used.