Closed pano9000 closed 1 year ago
Hi @pano9000! Thank you for opening this issue. It is a really good idea
Maybe we can throw an error for everything when there is a userError. And for preventing INVALID_INPUT I can also add country types
How does it sound?
sounds reasonable to me, thanks for the quick response!
one heads up: the userError
property is filled, even if there was no real error - in those cases, it will say "VALID"
Let me know what you think: #3
thank you for the quick response, I've left a comment there, but other than that, I think it looks good - I did not test it locally yet though, as I don't have any TypeScript environment set up currently.
Great! It think that even without TypeScript you can benefit from it in your IDE
Changes merged. Since now it throws errors, I have published a major version, just in case. https://www.npmjs.com/package/vies-checker/v/3.0.1
Hi,
I have ran into some issue today, where I would get inconsistent results back from the
isValid
function invies-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 userErrorHowever that userError is not taken into account currently, as far as I can tell,
vies-checker
only checks theisValid
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
My feeling would be to only have "INVALID_INPUT" return false, while all other exceptions should potentially be handled differently.
What do you think?