logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
Joe Payne @ Solunar  
#1 Posted : Tuesday, April 19, 2022 10:09:16 AM(UTC)
Joe Payne @ Solunar

Rank: Member

Groups: Developers, Registered, HelpDesk
Joined: 11/7/2018(UTC)
Posts: 23

Thanks: 5 times
I can see the code was added to recalculate taxes on an existing order when using Avalara.

But the code seems to be written so it will only call Calculate() if the order does not already contain Avalara sales tax(es).

Calculate() doesn't commit the transaction into Avalara. It just returns updated sales tax amounts to be populated into the AC9 order. So the order will contain the correct tax amount, but Avalara has not recorded that the merchant just taxed the shopper. No Avalara transaction is created.

And in that situation you have a merchant collecting sales tax they will not know to remit to the tax authority. Because the merchant will rely on Avalara reports to determine what to remit to the tax authorities, and AC9 isn't creating that Avalara transaction.



Joe Payne, AbleMods Hosting LLC
https://www.ablemodshosting.com

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

Katie S  
#2 Posted : Tuesday, April 19, 2022 2:18:38 PM(UTC)
Katie S

Rank: Advanced Member

Groups: System, Administrators, Developers, Registered, HelpDesk
Joined: 10/29/2018(UTC)
Posts: 472

Thanks: 4 times
Was thanked: 34 time(s) in 33 post(s)
Hi Joe,

There is a new setting on the AvaTax configuration page. It is called Commit Tax and the choices are 1) when order is created, and 2) when order is paid.

So the issue report title doesn't accurately reflect this change. If post-order changes are expected, then using the option to commit tax when the order is paid should be used. This gives you the ability to recalculate, make order edits, etc. and the tax transaction sent to Avalara will happen with the order is paid.

The old behavior is the other setting to commit tax when the order is created.

Let me know if you have any questions.

And yes, I haven't had the chance to get this into the documentation yet. Sorry, it's on my to-do list.
Thanks for your support!

Katie
Secure eCommerce Software and Hosting
mazhar  
#3 Posted : Wednesday, April 20, 2022 1:05:39 AM(UTC)
mazhar

Rank: Administration

Groups: Admin, Administrators, HelpDesk, System, Authorized User, Developers, Registered
Joined: 10/5/2018(UTC)
Posts: 175

Thanks: 8 times
Was thanked: 17 time(s) in 15 post(s)
In 9.0.6 we made updates to Avalara and now it allows you to commit the taxes to Avalara when order is paid. In Avalara settings page there is a new setting to control the behavior, the default is to commit taxes upon order creation. Recalculate now have to post the adjustments to Avalara if an order has tax already committed to Avalara. If tax is not committed yet, then recalculate will just calculate the new tax after any updates made to order but wouldn't commit/adjust anything.
Joe Payne @ Solunar  
#4 Posted : Wednesday, April 20, 2022 8:38:09 AM(UTC)
Joe Payne @ Solunar

Rank: Member

Groups: Developers, Registered, HelpDesk
Joined: 11/7/2018(UTC)
Posts: 23

Thanks: 5 times
But what happens if the order is already paid, and then the order is changed?

Recalculate() is going to get new tax amounts. Now the order total is different. But Recalculate() never updated the existing (committed) transaction in Avalara. So now Avalara is reporting different sales totals and sales tax than what is actually showing in the AC9 order.

Here's a simple scenario:
If someone places an order, pays for the order and then calls to cancel a portion of the order, Avalara will never know. The merchant will edit the line items, and then click the Recalculate() button. The order now gets a much lower tax amount and the shopper is issued a partial refund.

But Avalara doesn't know. The Avalara transaction was never updated when tax was recalculated. so the merchant will pay more sales tax to the tax authority than they actually collected from the shopper.

On a $27.50 order, this isn't much to care about. On a $ 43,000 order this is a serious problem.
Joe Payne, AbleMods Hosting LLC
https://www.ablemodshosting.com
ray22901031  
#5 Posted : Wednesday, April 20, 2022 10:01:30 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
This is almost the same as Paying State Sale Taxes and there is an adjustment to be made after the fact. You will need to contract Avalara and see what form they have to make an adjustment to the amount paid.

They could also offer this on the customer’s portal. There is only so much anyone or any software can do after payment and reporting have been sent.

Hope this helps.

UPDATE: Avalara reports the excess payment amount in the Overpayment to be Carried Forward section of the AU-11 form. This creates a credit balance with the state, and automatically reduces the tax liability you owe for the next filing period

https://help.avalara.com...dit_I_have_in_a_state%3F

Edited by user Wednesday, April 20, 2022 2:44:34 PM(UTC)  | Reason: Not specified

mazhar  
#6 Posted : Thursday, April 21, 2022 2:42:25 AM(UTC)
mazhar

Rank: Administration

Groups: Admin, Administrators, HelpDesk, System, Authorized User, Developers, Registered
Joined: 10/5/2018(UTC)
Posts: 175

Thanks: 8 times
Was thanked: 17 time(s) in 15 post(s)
Quote:
Recalculate() is going to get new tax amounts. Now the order total is different. But Recalculate() never updated the existing (committed) transaction in Avalara. So now Avalara is reporting different sales totals and sales tax than what is actually showing in the AC9 order.


If taxes are already committed, and you recalculate. In this case we not only recalculate the tax but also post tax adjustments in Avalara. If taxes are not committed yet and you do recalculate. In this case we just calculate the new tax without any adjustments to Avalara.

Quote:
Here's a simple scenario:
If someone places an order, pays for the order and then calls to cancel a portion of the order, Avalara will never know. The merchant will edit the line items, and then click the Recalculate() button. The order now gets a much lower tax amount and the shopper is issued a partial refund.


Recalculate do post the adjustments if taxes are already committed and you are making updates.
Joe Payne2  
#7 Posted : Friday, May 13, 2022 8:36:17 AM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
An example from today:

An order placed and paid for during checkout. Avalara gateway set to commit when paid, and it correctly pushed the order as a transaction in Avalara. The doc-status is 'Committed' in Avalara. So far, so good.

Now the shopper wants to add to the original order. Admin user adds the requested items, clicks Recalculate to update the order taxes and then processes a payment for the new additional balance due. Taxes did properly recalculate in the Able order. But Avalara still shows the old order amount. Now we've collected more tax than what we're reporting to the state taxing authority.

The error log shows "AvaTax returned an error while committing tax for order XXXXXX. Message(s) from Gateway: DocStatus is invalid for this operation."

That additional payment tried to push the order to Avalara again. But that DocId 155459 already exists and the transaction is set to Committed. You can't create a new transaction in the API using the same DocId.

At this point you have to...

A) Modify the existing transaction (different API call) but that's not happening

or

B) Void the original Avalara transaction and create a new Avalara transaction with a suffix on the DocId to make it unique. The suffix is required because Avarala won't permit multiple transactions with the same DocId even if one is set to 'void'.

or

C) Manually pull up the transaction in Avalara and manually edit all the amounts

The only way to resolve situations where order is modified after being paid is to manually edit the Avalara transaction. That's a huge pain.

And there is no UI feedback in the Recalculate button on the Items tab of the order when Avalara throws an error. So the admin user has no idea the new amounts were never posted to Avalara.

This will throw off every single Avalara tax report. Some in our favor, some as a loss. Either way, none of it is accurate so long as AC9 cannot properly handle post-payment order modifications in an elegant fashion.
Katie S  
#8 Posted : Friday, May 13, 2022 1:40:42 PM(UTC)
Katie S

Rank: Advanced Member

Groups: System, Administrators, Developers, Registered, HelpDesk
Joined: 10/29/2018(UTC)
Posts: 472

Thanks: 4 times
Was thanked: 34 time(s) in 33 post(s)
Hi Joe,

Bear with me as I try to dig out some information from our development discussions.

This is what should be happening -

1) We implement the tax adjustments to committed transactions using AdjustTaxRequest whenever changes are made to order.

2) In both cases where items are removed or added we simply create a new adjustment transaction which will override the previous one unless the previous transaction is locked by Avalara.

3) if successfully adjusted we update our local tax details for order.

---

Can you first confirm the transaction is not locked?

Then, if you can look at the transaction details, there should be a line "Adjustment Reason" shown. What do you see there?
Thanks for your support!

Katie
Secure eCommerce Software and Hosting
Joe Payne2  
#9 Posted : Friday, May 13, 2022 2:29:41 PM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
Your process flow design is correct. But that's not what we're seeing here.

The transaction is not locked. It's still set to Committed since it hasn't been reported to the taxing authority yet.

The transaction has no adjustment reason because it never got adjusted. The gateway tried to create a new transaction when it should have tried to adjust the existing one.

I'll do a full run-through next week and document the results here for you.

Joe Payne2  
#10 Posted : Wednesday, May 18, 2022 2:55:24 PM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
Katie try this scenario and see how it works for you:

Place an order, pay it during checkout (I used PO and marked received in admin)
Order is correctly pushed to Avalara and numbers match between Able and Avalara

Now add something to the order. I added another item rather than edit existing item.
Click Recalculate

Tax is now recalculated. And if you check Avalara, it too also shows the new line item you just added.

But the order now has a balance because you added to it. So go add another PO payment and mark it received.

I think that's causing the
Quote:
Message(s) from Gateway: DocStatus is invalid for this operation.
because the WhenOrderIsPaid() is firing again and wants to create another transaction in Avalara. But that DocId already exists and so Avalara response is error.

At that point, in my testing, now Avalara numbers are different from the Able order totals. The difference is the shipping. When I click Recalculate, Able recalculates taxes AND shipping. But the Avalara gateway isn't pushing the updated shipping charge (you added something to your order). The gateway seems to be only pushing product line items.

So now my Avalara order total is different than my Able order total :(
Katie S  
#11 Posted : Wednesday, May 18, 2022 3:12:26 PM(UTC)
Katie S

Rank: Advanced Member

Groups: System, Administrators, Developers, Registered, HelpDesk
Joined: 10/29/2018(UTC)
Posts: 472

Thanks: 4 times
Was thanked: 34 time(s) in 33 post(s)
Hi Joe,

Thanks for posting these details. I was trying to test last week but realized my install wasn't completely up-to-date. That was fixed about an hour ago, so I will repeat a test using your instructions.

I should have an answer for you tomorrow.

Thanks
Thanks for your support!

Katie
Secure eCommerce Software and Hosting
Joe Payne2  
#12 Posted : Wednesday, May 18, 2022 3:16:10 PM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
I have a theory.

The sequence in which things are getting recalculated could be the problem.

If taxes recalculate (and post to Avalara) BEFORE both shipping is recalculated and the order is updated with new shipping charges, that would explain the behavior.

In test # 3, I just fired another recalculate after making a huge change on my test order. Avalara now shows the previous shipping charge from Test #2. Not the first shipping charge.

That tells me it is updating shipping in Avalara, it's just doing it before shipping was recalculated rather than afterwards.

I think it's a sequence-of-events thing.......
Katie S  
#13 Posted : Thursday, May 26, 2022 12:24:29 PM(UTC)
Katie S

Rank: Advanced Member

Groups: System, Administrators, Developers, Registered, HelpDesk
Joined: 10/29/2018(UTC)
Posts: 472

Thanks: 4 times
Was thanked: 34 time(s) in 33 post(s)
Hi Joe,

The developers have confirmed the issue, and you are correct that it has to do with the order of calculation. We will have it fixed for the next release, but in the meantime, there is an easy workaround:

Have the Order Admin first recalculate shipping (uncheck the calculate taxes option) and then click recalculate button for taxes.

Thanks for your time in helping us find the issue.

Katie
Thanks for your support!

Katie
Secure eCommerce Software and Hosting
thanks 1 user thanked Katie S for this useful post.
Joe Payne2 on 5/26/2022(UTC)
ray22901031  
#14 Posted : Thursday, May 26, 2022 3:32:05 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
Hi Katie,

So much confusion here because all 50 states have different procedures. First let me start by saying, in the state of Florida shipping is not taxable, but it is in other states, so having the order recalculates shipping only and then recalculating taxes will only work in specific states.

That's your first problem.

Your second issue is, an order usually becomes taxable once it is set to complete, complete can have many definitions, it could mean the order was picked up, the order was shipped, and 20,000 other scenarios. Typically, in the state of Florida, it means the customer took possession.

If an order is complete for whatever reason, one should not be adding to a completed order, a new order is better suited for that. Maybe this is not the way a developer thinks, but it's the way accountants think.

Yes, I'm aware that could create issues for the customer, but it creates even more issues if you don't have someone in the accounting department that knows what they're doing.

Everything that Joe is bringing up, could be better handled by someone in accounting that knows what they're doing. You cannot program AbleCommerce with case statements to try to anticipate the will of 50 different states, and then the different cities within those states. The software can only do so much.

So if the software is miscalculating in one state, it's probably working perfectly in another. This is where good reporting comes in, and based on those reports you should have someone in accounting to make adjustments to the proper agencies.

This is why when an order is set to complete, we don't change it unless it gets reviewed by accounting for this very reason. This is also why we lock our orders after a specific time frame, even an administrator cannot manipulate a lock order, unless you go to the database itself and unlock it.

I have over 32 years in accounting, there's only so much software can do, anything after an order gets completed should go to accounting for review. It will eliminate a lot of the concerns being discussed here.

Probably the reason Avalara is having difficulties is that it's following a set of rules known as GAP principles. Good luck trying to work around General Accounting Principles, you will fail.

Not attempting to step on people's toes here, but it is the responsibility of the business owner to have certain procedures in place for situations like this.

Good luck with this, but you're not going to find a solution if you're trying to deviate from GAP.
ray22901031  
#15 Posted : Thursday, May 26, 2022 5:00:44 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
A new feature to consider based on this thread.

Under the store setting, have an option that says, "No edit after complete".

In other words, once a ticket reaches a status of complete, it can only be manipulated by an admin or superuser. A regular user can, no longer, edit the ticket in any way.

If the information being sent to the proper agency was correct in the first place, this will prevent anyone from making adjustments that might lead to a miscalculation. An administrator or superuser will have to intervene in this case, based on the advice of accounting, to make sure all calculations are correct. This is also another way to be able to tag a ticket for review by accounting later that month.

Adjustments can be made to the proper portals at that time.

Edited by user Thursday, May 26, 2022 5:01:31 PM(UTC)  | Reason: Not specified

Katie S  
#16 Posted : Thursday, May 26, 2022 7:07:48 PM(UTC)
Katie S

Rank: Advanced Member

Groups: System, Administrators, Developers, Registered, HelpDesk
Joined: 10/29/2018(UTC)
Posts: 472

Thanks: 4 times
Was thanked: 34 time(s) in 33 post(s)
Hello,

The concern here is that the re-calculation in Able does not match the tax adjustment in AvaTax. It's a bug, and luckily, an easy fix.

I've seen Able used in many different ways, and it's really up to each business to decide how to handle the post-order edits. We allow it with no restrictions, but custom order statuses could be used along with internal business practices to prevent editing once the accounting has been finalized. If you want to take it a step further and modify the code to prevent edits, that works too.

Thanks for the feedback!
Thanks for your support!

Katie
Secure eCommerce Software and Hosting
ray22901031  
#17 Posted : Thursday, May 26, 2022 8:54:00 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
Thank you for your clarification, if it's a bug that can be identified, of course it needs to be fixed. My only concern was that manual procedures still function in the 21st-century, and nothing will take the place of someone in accounting that reconciles regularly.

The modification or recalculation of orders that have state or federal liabilities attached to them is not a good practice, regardless if the software gets it right the first time or not.

As you say, the software can be used many different ways, but if you're ever in an audit, either state or federal, they are only interested in making sure they collect what is due them. They're not interested in software glitches, software functionality or any other excuses.

I speak as an accountant and not a developer here. Every software has glitches, including high-priced accounting software. MAS90 is one of the top ranking accounting software, used by PepsiCo at one time, the only accounting software we ever used where the balance sheet never properly match with the AP or AR.

My point is, in case I was not successful in clarifying it, too much is expected on software, and common accounting principles are nowhere to be found.

Thanks, Katie
Users browsing this topic
Guest (4)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.