taxjar / vat_check Goto Github PK
View Code? Open in Web Editor NEWValidate EU VAT numbers the easy way with VIES!
Validate EU VAT numbers the easy way with VIES!
Hi,
we use this gem in production and sometimes it failes, cause the VIES service answers with some garbage leading to raise a Savon::HTTPError
which is not handled by this gem.
I would suggest to add this error next to this line:
vat_check/lib/vat_check/requests.rb
Line 11 in 6ddf83c
What do you think?
Here is an example failure response of such a request:
HTTP error (307): <HTML><HEAD>
<TITLE>Network Error</TITLE>
</HEAD>
<BODY>
<FONT face="Helvetica">
<big><strong></strong></big><BR>
</FONT>
<blockquote>
<TABLE border=0 cellPadding=1 width="80%">
<TR><TD>
<FONT face="Helvetica">
<big>Network Error (tcp_error)</big>
<BR>
<BR>
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
A communication error occurred: ""
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica" SIZE=2>
<BR>
For assistance, contact your network support team.
</FONT>
</TD></TR>
</TABLE>
</blockquote>
</FONT>
</BODY></HTML>
As a result of Brexit, regrading VIES:
UK businesses will be able to continue to use the EU VAT number validation service to check the validity of EU businesses, but UK VAT registrations will cease to be included.
The UK Gov has an API in beta for checking VAT numbers:
(API access is controlled by credentials. Users must sign up for GOV UK Developer Hub)
Due to VIES updating to https, current calls to establish the client respond with:
<HTML><HEAD>
<TITLE>Redirect</TITLE>
</HEAD>
<BODY>
<FONT face="Helvetica">
<big><strong></strong></big><BR>
</FONT>
<blockquote>
<TABLE border=0 cellPadding=1 width="80%">
<TR><TD>
<FONT face="Helvetica">
<big>Redirect (policy_request_redirect)</big>
<BR>
<BR>
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
Click <a href="https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl">here</a> if you are not automatically redirected.
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica">
</FONT>
</TD></TR>
<TR><TD>
<FONT face="Helvetica" SIZE=2>
<BR>
For assistance, contact your network support team.
</FONT>
</TD></TR>
</TABLE>
</blockquote>
</FONT>
</BODY></HTML>
I was able to spend a small amount of time looking at this, and it seemed like adding follow_redirects: true
to
vat_check/lib/vat_check/requests.rb
Line 6 in 1898e5a
vat_check.rb
, but I was unable to get the specs back to a passing state with this change.On line 14 of file https://github.com/taxjar/vat_check/blob/master/lib/vat_check.rb#L14, you return true if the VAT number passes the regexp check, but the VIES service is not working for some reason. I don't think this should be the default. At worst, it should be configurable: we need to be sure the VAT number is correct. The reliability of the VIES services is often quite bad, but we need to be sure that a VAT number is a valid VAT number for accounting/reporting reasons.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.