Closed mikeSimonson closed 5 years ago
Hi @mikeSimonson,
Our workflow is to add VAT ID's into a queue that's been picked up by a worker that checks for a heartbeat before processing. If there's no pulse, it waits for 30 minutes and tries again. If there's a pulse it validate the VAT ID from the queue.
I hope this gives you a pointer how to deal with the service. Yes, I know it's not a reliable service, but with the heartbeat we can mitigate the issue before we start processing.
Thanks
Hi, is there a way of blocking the validation process using the vies europe server link. This server is down almost twice a week and is making the checkout process horrible long. Here is what i'm looking for :
This VAT validation on magento is just bullshit because it just checks if the number exist. A simple google search and i can input any validate VAT number from another company to buy exclusif tax and let if ship to my adress. The best way to control is to check the VAT number manually with the adress for the B2B clients.
Hope you can help me. Regards, Marc
@marcwales
Well sure .. If You look at the code . . the validateVat
function calls validateVatSum
here https://github.com/DragonBe/vies/blob/master/src/Vies/Vies.php#L242. Instead of calling ValidateVat that checks the number and if its valid (sum) it calls the api endpoint You could just call validateVatSum
to check it offline (length, check-sum).
Hi krzaczek,
Thank you for your fast reply ;) I'll try to change the code on this module, see if it works. But now that i'm looking at the code, i think it would be easier to change it directly on the native magento VAT module. Just blocking the VIES europe server check or add a fallback to the vatlayer server ( https://vatlayer.com/).
Regards, Marc
Hey @marcwales,
You can also use the "HeartBeat" functionality to verify if the service is online and active, as described in the main example in the README.md
.
The way we do it is to have a worker listening to incoming VAT ID's from a queue system (Gearman, RabbitMQ, ZeroMQ, …), checks if the service is operational using the heartbeat functionality and if it is, processes the queue. If not it waits for 30 minutes to check again. A simple solution, but works very effectively as the validation of VAT ID's is something that can safely run in the background. A faulty VAT ID (e.g. not validated) will be marked in a report with validation ID (from VIES) including timestamp so we can hand it over to the finance department.
If you just want to verify the "correctness" of a VAT ID, you can use the checksum validation mentioned by @krzaczek above.
I'm looking to modify this worker so I can add it to the examples.
Sorry, but during lunch I whipped up this small Proof-of-Concept to process VAT ID's asynchronously. It's rough code and should not be used as-is in production, but it should give you a good idea how to offload the VAT validation process in an asynchronous way.
Please see https://github.com/DragonBe/vies/tree/master/examples/async_processing for details.
Hi DragonBe,
Thanks your for your fast response also ;) I'm not used to get this quick help on a forum. I'll test this week both solution in order to see which one is the best for the checkout process. I'll try to add the vatlayer api because it looks pretty good on their website.
Regards, Sidney
Hey @marcwales, I hope that now things are working out for you. If you have any feedback for us how we can improve the service, please let us know. The easier we can make this tool for you (and the rest of the world) to use, the better.
Closing this issue.
Hi,
I was wondering if there was any general guideline on the behavior to adopt when the service is down (which happens quite regularly) ? Or is it a matter of it depends per application.
Thanks