Implemented Bug wih VAT

More
1 year 2 months ago - 1 year 2 months ago #2394 by Dmitrijs Rekuns
Bug wih VAT was created by Dmitrijs Rekuns
Hi Ruud,
I have discovered an issue on checkout.

A client has reported he is not able to finalize the payment because of VAT checking error.
We have already discovered that it happens due to VAT IES service:
----

Important Disclaimer:

Due to specific upgrade works executed, the VIES on the Web application may not be accessible at all times during the following timeslot: 31/01/2023 19:00 CET - 31/01/2023 22:00 CET.

Apologies for any Inconvenience.

For additional Information please contact TAXUD-VIESWEB

===========================================
As of 01/01/2021, the VoW service to validate UK (GB) VAT numbers ceased to exist while a new service to validate VAT numbers of businesses operating under the Protocol on Ireland and Northern Ireland appeared. These VAT numbers are starting with the “XI” prefix, which may be found in the “Member State / Northern Ireland” drop down under the new entry “XI-Northern Ireland”. Moreover, any quote of “Member State” is replaced by “Member State / Northern Ireland” and any quote of “MS” is replaced by “MS / XI”. All traders seeking to validate UK (GB) VAT numbers may address their request to the UK Tax Administration.
ec.europa.eu/taxation_customs/vies/#/vat-validation

----

But OK - this is just FIY. before we figured it out, I started to check out the issue on our site and here are my steps:

1. I added a product and go to checkout as a guest.
2. The country is selected according to my geo location (Russia).
3. I added the name of client's company and their VAT (Romania).
4. Then I remembered I need to select the right country to emulate client's side process. I selected Romania. And... the system gives this error:
VAT applied: Country (Latvia) is forced to pay VAT.
Latvia is because it is the default county in OchSubs settings.
 

To sum up:
- A guest gets a country according to their geo location.
- I select business type and add name and VAT. No checking is working because the country is not EU state. I select the right EU country and then the system tried to check out VAT with default country.


Best regards,
Eugene

P.S. I've seen you have already implemented Privacy Tool Suite support - it is pretty  cool! I still did not check it out yet due to high loading of work. As soon as I do it, I'll write in another topic. Thanks!

DOWNLOADLINK to test version:
This message contains confidential information
Last edit: 1 year 2 months ago by Ruud van Lent. Reason: added link to test version
The topic has been locked.
More
1 year 2 months ago #2395 by Ruud van Lent
Replied by Ruud van Lent on topic Bug wih VAT
Hi Eugene,
thanks for reporting.
ochSubscriptions actually has two API's it uses for doing the VIES check. The first is the EU VIES (the official one). When that is not working then a fallback is done automatically to the second one.
This is a specific use case as the VIES service is actually 'working' only it didn't do a VIES check (but rather a we are offline message).
I Will check if i can somehow recreate this situation and if so if i can improve (although is is probably a very rare case)

Now for the other issue: this i need to investigate.
Location is detected and prefilled based ion the user's IP address: this is an important step because we need 'proof' that this user is using the billing location for his actual location.
If the geoip location is Russia and the user fills in that he is from Latvia then he will need to set a extra term checkbox in the checkout stating that he is indeed in Latvia: this is sufficient proof for us that we can provide when audited.

I will try to reproduce the next steps you detailed (thanks for that) and see if this is expected or can be improved.
The topic has been locked.
More
1 year 2 months ago #2396 by Dmitrijs Rekuns
Replied by Dmitrijs Rekuns on topic Bug wih VAT
1. the problem is the client was not able to finalize the checkout due to VAT checking issue and he reported me that information about VIES taken from the official EU site. As you said, OchSubs is using the 2nd VIES check, but as far as I see, it does not working, otherwise the client did not contact us.
2. Automatic detection of the country is CORRECT and this is good. I just described you a potential scenario how it might be: you probably may go on vacation anywhere on the Caribbean Sea and using your laptop to buy anything related to your company and the effect will be the same.
You wrote:
"If the geoip location is Russia and the user fills in that he is from Latvia then he will need to set a extra term checkbox "

Please have a look I mentioned Romania too. There are 3 countries I mentioned. Again, let's consider the following scenario:

- I am a customer with a company in Romania.
- I am physically outside of the EU. Let it be any other country, ok. let it me Montenegro (it is not in the EU at the moment).
- I did not notice there is another non-EU country in the list according to my geo location, then I click on "business" type and add a company name and type my VAT.
- then I see I made a mistake and then I select the right country - Romania instead of Montenegro.
and then the component checks and gives an error message: VAT applied: Country (Latvia) is forced to pay VAT.
So, why Latvia? A user is in Montenegro, and later he selected Romania.
But I know why there is Latvia - because it is a default country set in OchSubscriptions or maybe because it is seller's contry. In your case it could be Netherlands.
So, I have to renew the checkout page, select the right country and try once again and all is fine.

and that's why I mentioned there are 2 issues:
- there should be correct checking after  changing the country
- there should not be the default country to be taken.

I hope it is clear now. If now, please let me know and I'll record a screencast for you.

Regards,
Eugene
The topic has been locked.
More
1 year 2 months ago #2406 by Ruud van Lent
Replied by Ruud van Lent on topic Bug wih VAT
Hi Eugene,
screencast please :)

unable to reproduce on my dev environment :(
The topic has been locked.
More
1 year 2 months ago #2408 by Dmitrijs Rekuns
Replied by Dmitrijs Rekuns on topic Bug wih VAT
Hi Ruud,
No problem. Here is the screencast:
www.dropbox.com/s/p9sarxtn6t6xor6/ochsubs-vat.mov?dl=0
The topic has been locked.
More
1 year 2 months ago #2409 by Ruud van Lent
Replied by Ruud van Lent on topic Bug wih VAT
Hi,
I have tried to reproduce and had 1 times the issue, so I think I understand what the issue might be.

The checkout script first checks the country and when it does that, it updates the order with the new country code.
then the script checks the VAT number, where it does a fallback to the default country when the VAT countrycode is not equal to the country code in the order (which was modified by the country check).

Because these javascripts ajax calls are asynchronous, I had one time where the vat check started BEFORE the country check was completed: so It did the fallback.

anyway, this was a one time thing only, I see that your server in the video is very slow in responding, so maybe that is what is causing it for you.

I have added a link to a test version in the first post.
What this will do is not display the fallback country messahe, but will inform you that the selected country doesn't match the VAT country.

If you can check if this works better that would be great.

There is also a small change in the checkout JS, so make sure your do a ctrl-f5 to test with latest version
The topic has been locked.
More
1 year 2 months ago #2410 by Dmitrijs Rekuns
Replied by Dmitrijs Rekuns on topic Bug wih VAT
I have been checked it out, and it seems all is fine.

Thank you, Ruud! A great support! :-)
The topic has been locked.
More
1 year 2 months ago #2413 by Ruud van Lent
Replied by Ruud van Lent on topic Bug wih VAT
Cool!
Thanks for reporting back!
Will be in next version
The topic has been locked.
More
1 year 2 months ago #2443 by Ruud van Lent
Replied by Ruud van Lent on topic Bug wih VAT
Just release v3.8.0 which addresses this issue / request. Closing this topic now.
When you have a new / follow up issue / request feel free to open a new topic.
The topic has been locked.