feat(main): Log VIES failures and support Northern Ireland VAT numbers
This commit is contained in:
@@ -7,6 +7,7 @@ use PH7\Eu\Vat\Provider\Europa;
|
||||
use PH7\Eu\Vat\Exception;
|
||||
use Websmid\VatCheck\Config\Config;
|
||||
use Websmid\VatCheck\Model\VatCache;
|
||||
use PrestaShopLogger;
|
||||
|
||||
class EuValidatorAdapter
|
||||
{
|
||||
@@ -27,6 +28,16 @@ class EuValidatorAdapter
|
||||
try {
|
||||
$euVatValidator = new Validator(new Europa, $this->vatNr, $this->isoCode);
|
||||
} catch(Exception $e){
|
||||
PrestaShopLogger::addLog(
|
||||
sprintf(
|
||||
'ws_vatcheck: VIES check failed for VAT number %s%s: %s',
|
||||
$this->isoCode,
|
||||
$this->vatNr,
|
||||
$e->getMessage()
|
||||
),
|
||||
3
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ class VatNumber
|
||||
'FR' => 'FR',
|
||||
'FX' => 'FR',
|
||||
'DE' => 'DE',
|
||||
'GB' => 'XI',
|
||||
'GR' => 'EL',
|
||||
'IE' => 'IE',
|
||||
'IT' => 'IT',
|
||||
@@ -53,6 +54,7 @@ class VatNumber
|
||||
'DE' => '\d{9}',
|
||||
'DK' => '(\d{2} ?){3}\d{2}',
|
||||
'EE' => '\d{9}',
|
||||
'GB' => '\d{9}(\d{3})?|[A-Z]{2}\d{3}',
|
||||
'GR' => '\d{9}',
|
||||
'ES' => '[A-Z]\d{7}[A-Z]|\d{8}[A-Z]|[A-Z]\d{8}',
|
||||
'FI' => '\d{8}',
|
||||
|
||||
Reference in New Issue
Block a user