validate-vat-ts
validate-vat-ts copied to clipboard
Vies Response Error
Hey, after validateVat, the response from the vies is: 'ViesClientError: Failed to parse vat validation info from VIES response'. Any sugestions?
Hi there,
I experienced the same issue, I am using my own code based on this library, but not exactly this library. To fix this issue, I did the following two things:
- The regex used in hasFault does not work, as there is some whitespace including linefeeds.
const hasFault = (soapMessage: string): boolean => {
return soapMessage.match(/<soap:Fault>(.|\s)*<\/soap:Fault>/g) !== null;
};
- There is an issue with the request headers, I changed them as follows. Problem is the SOAPAction from the request headers, which has to be removed at all.
const headers = {
"Content-Type": "application/xml",
"User-Agent": "node-soap",
"Accept": "text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8",
"Accept-Encoding": "none",
"Accept-Charset": "utf-8",
"Connection": "close",
"Host": "ec.europa.eu"
};
Cheers, Dietmar
This was already fixed in the "non-TS" version of this package: https://github.com/viruschidai/validate-vat
You can use it as a workaround until it was fixed here as well.
It was fixed in this commit https://github.com/viruschidai/validate-vat-ts/commit/ee582740d8f9904ce93ca1d74ba775fe3bf48f36#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80
Any plan on releasing the fix?
Looks like it was in 1.2.1. Its working for me :). I'd say this can be closed.
Looks like it was in 1.2.1. Its working for me :). I'd say this can be closed.
I did not see any tag/release on this repo, so I assumed it was not yet released. It seems to be deployed on npm though with the correct commit hash.
Thanks!