VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: ebrilz on July 02, 2019, 20:09:24 PM

Title: AvaTax plugin sending shipping address to Avalara to get tax quotes
Post by: ebrilz on July 02, 2019, 20:09:24 PM
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.
Title: Re: AvaTax plugin sending shipping address to Avalara to get tax quotes
Post by: ebrilz on July 22, 2019, 21:38:02 PM
Here's the ticket I filed on this issue:

https://extensions.virtuemart.net/index.php?option=com_beestohelpdesk&view=ticket&code=V4S203WWNA
Title: Re: AvaTax plugin sending shipping address to Avalara to get tax quotes
Post by: ebrilz on August 06, 2019, 23:46:44 PM
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.