Developer forum

Forum » Ecommerce - Standard features » DW removes Avalara taxes with same tax name

DW removes Avalara taxes with same tax name

Mario Santos Dynamicweb Employee
Mario Santos
Reply

Hi there,

I am experiencing an odd behavior with Avalara, when the cart is loaded on frontend it calculates/adds taxes orderlines but when I open the cart in DW one tax orderline is removed: https://www.screencast.com/t/8N5J5qpD8

After look into Avalara and Ecom logs it looks that the issue seems to be in a DW feature called DeletedDoubleOrderLines that is being activated and propably is deleting what it thinks to be a duplicated tax (log taken from /Log/eCom/CartV2/DeletedDoubleOrderLines):
2018-09-29 13:45:28.8536|INFO|eCom/CartV2/DeletedDoubleOrderLines|OrderId:'CART754' OrderLineId:'OL13892' ProductId:'' VariantId:'' ProductNumber:'Tax Id# 5599359264586970'

The "duplicated" Avalara tax orderline has the same ProductName but this is filled with TaxName xml node (see attached xml response). The TaxName is the same but it refers to a different tax - as you can see JurisCode and JurisName xml nodes are different between taxes.

DW version: 9.4.18

BR, Mario

SpecialTax.PNG

Replies

 
Nicolai Pedersen
Reply

So the same orderline gets 2 taxes?

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

This is the US ;-) They can easily get five taxes....

I reported a similar issue here: https://doc.dynamicweb.com/forum/dynamicweb-9-0-upgrade-issues/dynamicweb-9-0-upgrade-issues/bug-in-tax-providers-with-multiple-lines

Looks like we need to make the names unique somehow...

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply

The same orderline gets 5 taxes but 2 are special taxes with same name: "CA SPECIAL TAX".

 
Nicolai Pedersen
Reply

So the lines are completely the same, there is no field that is different?

We have 3 options

  1. Change the Orderline.Equals method to include the missing field that tells the difference between the 2 taxes (if any) (Change in orderline)
  2. Ensure that equal taxes are merged to one line (That is the provider) (Change in avalara)
  3. Exclude tax lines from the double orderline check (Change in orderline service)

Any comments on what would be smartest?

NP

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply

Here are my thoughts :-)

  1. The only differences between the 2 tax orderlines are the price columns, so maybe it could lead to false positive scenarios.
  2. From my POV, we should keep the exact number of taxes from xml response, so there isn't any manipulation on the taxes.
  3. That would work.

Would a 4th option be add more details to the OrderlineProductName based on the tax xml node, like JurisCode or JurisName?

BR, Mario

 
Nicolai Pedersen
Reply

It could probably be the best option.

JurisName looks the best, but what would be the result for all other tax lines - should it always be added or only when taxlines are named equally?

 
Nicolai Pedersen
Reply

Try the attached provider.

It adds the jurisname if 2 taxes share the same name....

 
Nicolai Pedersen
Reply

TFS#55806

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply

Agree with your approach.

I tried the new assembly but can't get any taxes - the request and response xml looks good.
The TaxProviderErrors loop is retrieving the following: The given key was not present in the dictionary.
The if statement is breaking, it should be a negative validation (see screenshot), right?

Also, could we add the this.SaveLog method when we are adding errors to the TaxProviderErrors collection? It would be easier to track errors.

TaxOrderlines.PNG
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Furher to Mario's second point, in AddTaxOrderLinesToOrder we now have this:

try ...

catch (Exception err)
{
  order.TaxProviderErrors.Add(err.Message);
}
 
In the above case, where we got a .NET error the error message went to the UI, but never made it into any logs, which made troubleshooting difficult. Changing it to this:
catch (Exception err)
{
  order.TaxProviderErrors.Add(err.Message);
  SaveLog(err.ToString());
}
would give us the full details in the /TaxProviders log.
Thanks!
 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Mario & Imar

Yes, wrong conditional. Added more logging.

Attached updated version

Votes for this answer: 2
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Tusind tak! We'll test.

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply

This is working great. Muito obrigado!

BR, Mario

 

You must be logged in to post in the forum