AVALARA TAX PROVIDER provided by the NOP Commerce Team Serious Logic Issues

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Greetings,

We are experiencing some unwanted behavior with Version 3.8 (and 3.9) of the "AVALARA TAX PROVIDER provided by the NOP Commerce Team".

The issue results in the AvalaraOrderProcessingService.cs...the following code is the culprit.

//prepare order details
                var details = PreparePlaceOrderDetails(processPaymentRequest);

                //the only difference from the original PlaceOrder() method
                //get tax total from the Avalara tax service, it may slightly differ from the previously calculated tax
                var taxTotal = GetTaxTotal(processPaymentRequest, details);
                if (taxTotal.HasValue)
                {
                    details.OrderTotal += (taxTotal.Value - details.OrderTaxTotal);
                    processPaymentRequest.OrderTotal = details.OrderTotal;
                    details.OrderTaxTotal = taxTotal.Value;
                }

The main issues are:
1.  If a gift certificate is used to cover the entire order, and the tax that Avalara returns for the taxTotal is 1 cent higher (this happens around the $250 order total amount and rounding) than what the store calculates, then the customer is unable to checkout because the store is trying to charge the extra 1 cent to a payment method, which there is no payment method because the customer is using a gift card.  Customer can't check out.

2.  The TaxRates Dictionary calculation happens before the above code so if Avalara returns a different tax rate amount ( for example customer orders an article of clothing and a hard good and ships to Minnesota).  Minnesota does not charge tax on clothing, but the store first calculates tax for the entire order using every item in the cart and shipping, completely ignoring tax Nexus data or calculations from Avalara and that tax amount the store calculates is being left in the TaxRates Dictionary and not getting updated with correct tax amount that Avalara returns.  The tax rate amount shown on the order in the admin section does not match the actual tax charged.

3.  Order totals at the bottom of the page are never accurate.  On the confirmation page, the tax and order total do not match what is actually being charged to the customer.  Again using Minnesota as an example, if customer has hard goods and clothing in their cart, order total and tax total on order confirmation page do not match what is actually charged to the customer as the above code and the final tax call (var taxTotal = GetTaxTotal(processPaymentRequest, details) ) happens after the confirm button is hit.  The customer sees the total tax charge for all the goods and shipping, regardless of what Avalara returns.

4.  Gift Certificates are not deducted properly again using Minnesota as a guide.  If the tax returned from Avalara is less than what the stores calculates, the gift certificates has the full tax the store calculated deducted from it instead of the adjust tax total from Avalara deducted from it.  The Gift Certificate total deducted is calculated before the final Avalara Tax Call the tax used to determine the Gift Certificate total is the tax the store has determined outside of the Avalara Tax Plugin.  The Gift Certificate logic happens before the final Avalara tax call code above.

In summary, we migrated to the Avalara Tax system Jan 1st of 2019 and now we have a hug accounting tax nightmare due the "Certified" Avalara Tax Plugin from NOP Commerce.  This has cost us thousands of dollars in manual labor to adjust the orders and to refund tax dollar amounts not to mention the high cost of the Avalara Tax program itself.  When doing our research for a tax provider, we saw the certified Avalara Tax plugin from NOP Commerce and went with it, before finding out the plugin simply does not work as intended as both 3.8 and 3.9 exhibit the same behavior.

We are hoping that someone from the NOP Commerce team can lend a hand and correct the logic errors so that we have a working plugin that correctly displays and calculates the correct tax and order totals to us and our customers.


Thanks,
Brian
5 years ago
Thanks for the detailed info. We'll investigate it.
5 years ago
Can we expedite the fixes to the 3.8 version of plugin via premium services?  We need to have a resolution asap and we would even be willing to pay for it.  Help!!!!

I have 50 plus NOP 3.8 stores that are all calculating tax incorrectly.

-Brian
5 years ago
There is a new issue that we are seeing when the ship to address and the bill to address do not match, the plugin crashes.  The Avalara Tax plugin needs to give each address a unique id, but in this case it is not.  The tax plugin is given both the billing and shipping address an ID of 0 and sending that off to Avalara but Avaklara can not calculate tax if each address does not have a unique ID associated with it.
5 years ago
I have patched code in the 3.8 plugin to at least get the final Avalara tax calculation, gift certificate, and Tax dictionary calculating correctly.  
I had to add the following functions to the AvalaraOrderProcessingService:

protected virtual decimal GetOrderTotalDiscount(Customer customer, decimal orderTotal, out List<Discount> appliedDiscounts)

public override PlaceOrderResult PlaceOrder(ProcessPaymentRequest processPaymentRequest)

(I sent off tax request off to Avalara before calling this function and the added shoppingCartTax to the call)
public virtual decimal? GetShoppingCartTotal(IList<ShoppingCartItem> cart,
            decimal shoppingCartTax,
            out decimal discountAmount, out List<Discount> appliedDiscounts,
            out List<AppliedGiftCard> appliedGiftCards,
            out int redeemedRewardPoints, out decimal redeemedRewardPointsAmount,
            bool ignoreRewardPonts = false, bool usePaymentMethodAdditionalFee = true)

protected override PlaceOrderContainter PreparePlaceOrderDetails(ProcessPaymentRequest processPaymentRequest)

(removed the Avalara tax call from here and move it into the PlaceOrderResult)
public override PlaceOrderResult PlaceOrder(ProcessPaymentRequest processPaymentRequest)

The cart totals at the bottom are still off as the actual Avalara tax call happens after you hit the confirm button, but at least the tax amount, order totals, gift certificates and tax dictionary are all correct.

You may cancel the request, I figured it out on my own.

Thanks,

Brian
5 years ago
Thanks again for reporting! We've just fixed the issues. Please re-download a new plugin here

Please note that we've fixed it only for versions 4.00 and 4.10. This plugin is available with source code so you can always apply the same changes to the previous versions.
5 years ago
Thank you.  I will begin the back port to 3.8 for our sites.

-Brian
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.