driesvints / vat-calculator

Handle all the hard stuff related to EU MOSS tax/vat regulations, the way it should be.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

504 Gateway Time-out: What can I do against this?

pmochine opened this issue · comments

How do you handle a request that leads to a 504 Gateway Time-out? Probably because VIES is down.

This issue thread speaks about a timeout, but does it even work? #36

Because when the user starts a request, the website just loads for 30 seconds and throws me a 504 Gateway Time-out error. Not so satisfying for a user.

@driesvints Thank you for your quick answer. Unfortunately, it does not work. It doesn't matter whether I set it to true or false.

if (isset($this->config) && $this->config->get('vat_calculator.forward_soap_faults')) {
    throw new VATCheckUnavailableException($e->getMessage(), $e->getCode(), $e->getPrevious());
}

return false;

The only difference is that an exception is thrown instead of a false.

Ah I see. There's nothing you can do unfortunately. When VIES goes down the only thing to do is to wait until it's up again. Usually the way I handle things is to simply not validate the VAT number to unblock users and not stop people form making purchases.

@driesvints Okay. It's just annoying in my example because I have developed an affiliate program where the affiliate has to validate his VAT number when registering to the affiliate program.

I'll have to figure something out. I just find it so funny how often VIES goes down.

I just find it so funny how often VIES goes down.

Yeah, it's a joke really 😅

@driesvints Not sure if you will read this again. Nonetheless, I just found another package similar to yours. And I didn't try it out yet, but you should also include a timeout option like in this line: https://github.com/ibericode/vat/blob/59831d65c8fbe2885228b09fc33a8ea5e1b5dee4/src/Vies/Client.php#L67

And another cool function would be to validate at least the format of the VAT. Have a look here: https://github.com/ibericode/vat/blob/59831d65c8fbe2885228b09fc33a8ea5e1b5dee4/src/Validator.php#L95

Good thinking. Feel free to send in PR's for those if you want 👍