AvaTax plugin sending shipping address to Avalara to get tax quotes

Started by ebrilz, July 02, 2019, 20:09:24 PM

Previous topic - Next topic

ebrilz

Joomla 3.9.8, VM 3.4.5 10063

This issue does not apply to website visitors without an account.
If a logged in user has different billing and shipping addresses, when viewing the cart, it is clear that the AvaTax plugin is sending the shipping address to Avalara when it should be sending the billing address.  This results in an incorrect tax quote. This incorrect tax quote ends up being charged to the credit card (or Paypal, etc.) and saved as part of the VM order.  However, on the Avalara end, they correctly record the transaction's taxes based off of the billing address. So, not only did the shopper get charged the wrong amount, but VM and Avalara are out of sync on the charges.
It seems like I should be filing a bug somewhere.


ebrilz

Here's a note I left on the ticket I posted:

It appears as though I have this issue exactly backwards, and the title should probably be changed. It's clear from the code in avalara.php that the intention is to always send the shipping address to Avalara for the tax quote. This works for logged in users. However, in my setup this does not work with shoppers without an account.
It's worth noting that I may have a unique setup that prevents the shipping address from being stored in the session, so others may not be seeing this issue. I'm using a component called OnePage Checkout from Rupostel, and that may be preventing the shipping address from being properly stored in the session. This is the best explanation I've been able to come up with, because in my debugging I've found the ST address to always be empty for users without an account.
Regardless, I'm certain there is a bug in the creditMemo function. It calls fillValidateAvalaraAddress always with the BT address. Instead it should first get the address from getShopperDataFromCart. I have fixed this on my site and could provide the source if you want.