DragonBe / vies

Component using the European Commission (EC) VAT Information Exchange System (VIES) to verify and validate VAT registration numbers in the EU, using PHP and Composer.
http://ec.europa.eu/taxation_customs/vies/faqvies.do#item16
MIT License
266 stars 59 forks source link

Checks if the VIES service is online and available #83

Closed krzaczek closed 3 years ago

krzaczek commented 5 years ago

There seems to be a new endpoint we could use to check if the VIES service is up and running.

For the SOAP service you may send your xml request by using the following WSDL link:

http://ec.europa.eu/taxation_customs/vies/checkVatTestService.wsdl

and by using the below values (common for all Member States/ CountryCodes) for each required result:

“vatNumber” value=100, response= VALID

“vatNumber” value=200, response = INVALID

I'll will try to implement it.

DragonBe commented 5 years ago

This was also referenced in ticket #64 and what I learned from it was that it's only for testing purposes for client implementations. But you're absolutely right, this is a good addition for checking if the service is up and running. Awesome 👍

Seldaek commented 5 years ago

As far as I understand the main problem they have with uptime is that VIES is only an aggregator service, which then dispatches to country-based services depending on the VAT number you are validating. They don't have a centralized database. This means VIES can be "up" but validating a certain number will fail because that country's service is down. This is also shown on http://ec.europa.eu/taxation_customs/vies/help.html (see Unavailability Shifts).

Therefore I am not sure what the value is of knowing that VIES itself is up, as calling it might still fail.. IMO you are better off calling when you need it and retrying later if it fails.

krzaczek commented 5 years ago

@Seldaek I will have to check but since the service requires to send a country code along with the test vatNumbers (100, 200) maybe it actually checks the corresponding country database and not just the VIES service itself.

It should be easy to verify since the technical breaks for different counties are on different time of day. http://ec.europa.eu/taxation_customs/vies/help.html

VIES monitors all member states and You can see the current status here: http://ec.europa.eu/taxation_customs/vies/monitoring.html

DragonBe commented 4 years ago

@krzaczek @Seldaek I've tested it locally and also by adding functionality to access the test integration service of VIES (see #109), but even for all countries I get no issues accessing them during "unavailable" time mentioned at the VIES help page. So, my guess is that at this point we need to monitor the downtime of a backend service to see how VIES responds.

The heartbeat functionality was created during the time VIES Soap service was taken offline for maintenance. So yes, VIES did go down from time-to-time.

DragonBe commented 4 years ago

Haha 😃 I got one… German VIES just failed on me while running automated tests.

1) DragonBe\Test\Vies\ValidatorTest::testArgumentValidationSucceedsForNonLatinArgumentValues with data set "German Trader Name" (array('DE', '811569869', 'DE', '811569869', 'Deutsche Bahn', 'AG', 'Potsdamer Platz 2', '10785', 'Berlin'))
DragonBe\Vies\ViesServiceException: Back-end VIES service cannot validate the VAT number "DE811569869" at this moment. The service responded with the critical error "MS_UNAVAILABLE". This is probably a temporary problem. Please try again later.

Maybe I should put a markTestSkipped for when we receive such a failure 🤔 or move the whole Soap service into a mock object?