itaibo / vies-checker Goto Github PK
View Code? Open in Web Editor NEWEuropean VIES VAT number validator
Home Page: https://npmjs.com/vies-checker
License: MIT License
European VIES VAT number validator
Home Page: https://npmjs.com/vies-checker
License: MIT License
Hi,
I have ran into some issue today, where I would get inconsistent results back from the isValid
function in vies-checker
:
I was testing it with a German VAT No, that I know is definitely valid but the tests flipped between showing "true" and "false" sometimes, which was a bit odd.
I then output the "internal" only response
to the console, and by doing that I can see that the response actually contains an userError
const response = yield (0, request_js_1.default)(country, number);
console.log("vies response", response)
{
isValid: false,
requestDate: '2023-02-06T10:38:46.773Z',
userError: 'MS_MAX_CONCURRENT_REQ',
name: '---',
address: '---',
requestIdentifier: '',
vatNumber: '123456789', //changed
viesApproximate: {
name: '---',
street: '---',
postalCode: '---',
city: '---',
companyType: '---',
matchName: 3,
matchStreet: 3,
matchPostalCode: 3,
matchCity: 3,
matchCompanyType: 3
}
}
However that userError is not taken into account currently, as far as I can tell, vies-checker
only checks the isValid
property and returns its value.
This can lead to some confusion (as it did in my case), as it states that the VAT is invalid, even if it did not actually do a check.
If I check the file here, I can see there are a few possible error messages mentioned:
https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
In case of problems, the returned FaultString can take the following specific values:
- INVALID_INPUT: The provided CountryCode is invalid or the VAT number is empty;
- GLOBAL_MAX_CONCURRENT_REQ: Your Request for VAT validation has not been processed; the maximum number of concurrent requests has been reached. Please re-submit your request later or contact [email protected] for further information": Your request cannot be processed due to high traffic on the web application. Please try again later;
- MS_MAX_CONCURRENT_REQ: Your Request for VAT validation has not been processed; the maximum number of concurrent requests for this Member State has been reached. Please re-submit your request later or contact [email protected] for further information": Your request cannot be processed due to high traffic towards the Member State you are trying to reach. Please try again later.
- SERVICE_UNAVAILABLE: an error was encountered either at the network level or the Web application level, try again later;
- MS_UNAVAILABLE: The application at the Member State is not replying or not available. Please refer to the Technical Information page to check the status of the requested Member State, try again later;
- TIMEOUT: The application did not receive a reply within the allocated time period, try again later.
My feeling would be to only have "INVALID_INPUT" return false, while all other exceptions should potentially be handled differently.
What do you think?
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.