Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EU VAT number validation improvement suggestions #1251

Closed
hostep opened this issue May 9, 2015 · 8 comments
Closed

EU VAT number validation improvement suggestions #1251

hostep opened this issue May 9, 2015 · 8 comments
Labels
feature request Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development up for grabs

Comments

@hostep
Copy link
Contributor

hostep commented May 9, 2015

Hi

This is mostly based on Magento 1 experience, but it looks like not much has changed in Magento 2 currently (testing 0.74.0-beta8).
I'm not a VAT expert, I'm simply getting this from feedback we get from store owners who complain about how bad this is currently implemented in Magento 1. So with Magento 2, it would be a good idea to try to get this right from the start.

Here are some suggestions, please review them, maybe there are better solutions then the ones I'm suggesting ...

  1. If you go through the checkout, you should get instant feedback when you enter a VAT number if it is valid or not, and not after you go through the whole purchase process and it is too late. With the instant feedback you can correct your VAT number before purchasing if you made a typo.
  2. We have experienced a lot of issues with the VAT API service which is currently used in Magento (= VIES VAT number validation), it happens very regularly that the API service is down or times out. So you should think about some kind of way to handle this. Maybe there are alternative API services? Maybe you can do a first preliminary check using regular expressions before going to the API service to lower the load on the service? Maybe add a switch in the backend where store owners can choose what happens when the API service is down: allow the customer to proceed, or let them try again until the API service is back up?
  3. Right now you aren't allowed to enter your country prefix in front of the VAT number, since it uses the country from your address. I believe you should clearly state this in a line of text or in a tooltip or something like that, so the customers know what to enter. Also: it makes a lot more sense to put the VAT number field after the country selector field, because it depends on that value (the same thing applies to the state/region field, but that's another issue).

If others have some opinions about these issues or have other suggestions, please leave a comment, so we can try to improve how Magento 2 handles the EU VAT number validation.

Credit where credit's due: most of these suggestions come from a commercial extension we used a few times in the past: https://www.geissweb.de/eu-vat-enhanced-magento-extension.html, but since the current implementation in Magento is pretty broken, we shouldn't depend on an extension to fix these bugs in Magento I believe?

@choukalos
Copy link

Created JIRA issue MAGETWO-37219 and put into Backlog to improve VAT ID validation

@vpelipenko vpelipenko added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label May 12, 2015
@peterjaap
Copy link
Contributor

@sandermangel and me did some work on extending the M1 VAT validation logic with some extra services and a regex fallback; https://github.com/sandermangel/rkvatfallback

@hostep
Copy link
Contributor Author

hostep commented May 14, 2015

@peterjaap: cool!
I quickly ran through your code to see how it works. But I would put the regex checking before going to the validation service. So if the regex checks fail, you can immediately determine that the number is incorrect without having to wait for the API services.
If the regex check says the number is correct, only then go to the API service.
And if the API service is down, then let the store owner decide what to do with it through a configuration switch, either approve it (since it was already approved by the regex, but this is no guarantee, it can still be incorrect), or don't allow the customer to proceed and let him try again until the API service is back online.

About the regexes, I still don't know if it is a good idea, I don't know if the format of the VAT numbers change a lot over the years as extra VAT numbers are needed per country (for example it changed for Irish numbers in 2013: http://www.vatlive.com/european-news/ireland-vat-number-format-from-january-2013/). And also if extra countries get added to the EU, we should be aware that we will need to add an extra regex each time.
If we do go for the regex checks, we should pay very good attention to see if they are correct. I just compared some of your regexes with some we used in the past, and they are slightly different for some countries, so I'm not sure if yours or ours are actually 100% foolproof.
Over here is an explanation about the format per country (not sure if it is up to date though): http://ec.europa.eu/taxation_customs/vies/faq.html#item_11

About the http://isvat.appspot.com/ service, isn't that an extra service in front of VIES, with the difference that it returns json data? So if VIES is down, that service will probably also be down? Unless it does some kind of caching, but still then it would be an amazing coincidence if they have cached that particular VAT number...

These are just some ideas, I'm sure the Magento devs can come up with a more robust plan for this :)

@peterjaap
Copy link
Contributor

Thanks @hostep for your input.

I agree moving the regex to before the services is a good idea. Keeping the regexes up to date would be community effort I guess, unless Magento is willing to take up the glove.

Would you be in a position to share your regexes so we can improve the ones that are in rkvatfallback now?

About the Appspot one, you are right. I never noticed they got their data from VIES. I just asked @aral on Twitter whether he caches the data, just to be sure.

@versdivers
Copy link

Does someone know if this is already created also for magento 2?

@vkorotun vkorotun removed the CS label Aug 4, 2016
@piotrekkaminski
Copy link
Contributor

Thank you for your submission.

We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues.

Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here).

We are closing this GitHub ticket and have moved your request to the new forum.

@triabhishek95
Copy link

triabhishek95 commented Apr 11, 2018

I am using the latest version of EU VAT in my project but it is not working properly because when a user selects a country & enters a fake VAT no in the field then the TAX amount is automatically becomes 0, means any one can place an order on my site without having a valid VAT ID because they are getting the discount (No TAX) even when they didn't provided the right VAT Number no matter what ever the country is set. I have tried to place an order with VAT Number like "FAKEVAT","TEST","TESTING".
It is working any of this values means make the tax applied = 0 which should not be applied there.

It is working properly only when we either add a valid VAT or put that field to be empty.

@sandermangel
Copy link
Contributor

@versdivers this answer is 2 years and 7 days too late but yes, we ported it: https://github.com/Dutchento/m2-vatfallback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development up for grabs
Projects
None yet
Development

No branches or pull requests

10 participants