I noticed today, that the VIES service actually differentiates between INVALID and INVALID_INPUT userError messages:
INVALID is returned, when you provide a valid country code, but the number is invalid
INVALID_INPUT is returned, when the country code you provide is not valid
in both cases, it should be fine to say that the VAT Check returned "false" – however in the current version, vies-checker will currently throw an error, when you run e.g. await isValid('ES', 'ABC123456') (valid country + invalid vat no -> which would return INVALID as userError value).
To fix this, I've adapted the list of "handled" userErrors accordingly.
I also updated the tests accordingly as well, to now test all 3 cases.
Hi,
I noticed today, that the VIES service actually differentiates between
INVALID
andINVALID_INPUT
userError messages:INVALID
is returned, when you provide a valid country code, but the number is invalidINVALID_INPUT
is returned, when the country code you provide is not validin both cases, it should be fine to say that the VAT Check returned "false" – however in the current version,
vies-checker
will currently throw an error, when you run e.g.await isValid('ES', 'ABC123456')
(valid country + invalid vat no -> which would returnINVALID
as userError value).To fix this, I've adapted the list of "handled" userErrors accordingly.
I also updated the tests accordingly as well, to now test all 3 cases.
Let me know, if there are any questions.
Kind regards,