Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deal with the webservice down #43

Closed
mikeSimonson opened this issue Jan 11, 2018 · 10 comments
Closed

deal with the webservice down #43

mikeSimonson opened this issue Jan 11, 2018 · 10 comments
Assignees

Comments

@mikeSimonson
Copy link

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

@DragonBe
Copy link
Owner

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.

@mikeSimonson
Copy link
Author

Thanks

@marcwales
Copy link

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 :

  • I wish to just validate every VAT number without checking it on the vies server (change the code to if the amount of numbers are correct like 9 digits, it validates the VAT number).
  • Then i'll check it manually when i have to ship the product with the "Delivery adress".

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

@krzaczek
Copy link
Collaborator

krzaczek commented Apr 16, 2018

@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).

@marcwales
Copy link

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

@DragonBe
Copy link
Owner

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.

@DragonBe
Copy link
Owner

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.

@marcwales
Copy link

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

@DragonBe
Copy link
Owner

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.

@DragonBe
Copy link
Owner

Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants