Currently the method checkVat() just throws a ViesException with the message: 'Error communicating with VIES service'. Bit it is possible to give a more accurate message back. This is from the documentation of the 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 TAXUD-VIESWEB@ec.europa.eu 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 TAXUD-VIESWEB@ec.europa.eu 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.
It would be helpful to know why the check failed. Was it because of a wrong VAT number or a failed request?
What do you think about throwing different exceptions or the ViesException with different messages? We could group it like
INVALID_INPUT: "The provided CountryCode is invalid or the VAT number is empty"
GLOBAL_MAX_CONCURRENT_REQ, MS_MAX_CONCURRENT_REQ, SERVICE_UNAVAILABLE, SERVICE_UNAVAILABLE, MS_UNAVAILABLE: "an error was encountered either at the network level or the Web application level, try again later"
TIMEOUT: when there is a timeout the vatin check could try the validation for a second time. If it fails again the app would return the upper message/error.
Currently the method
checkVat()
just throws aViesException
with the message: 'Error communicating with VIES service'. Bit it is possible to give a more accurate message back. This is from the documentation of the https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl :It would be helpful to know why the check failed. Was it because of a wrong VAT number or a failed request? What do you think about throwing different exceptions or the ViesException with different messages? We could group it like