feat(main): Log VIES failures and support Northern Ireland VAT numbers

This commit is contained in:
2026-09-11 16:43:26 +02:00
parent 89fdc24210
commit fdc6c4eb56
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -7,6 +7,7 @@ use PH7\Eu\Vat\Provider\Europa;
use PH7\Eu\Vat\Exception; use PH7\Eu\Vat\Exception;
use Websmid\VatCheck\Config\Config; use Websmid\VatCheck\Config\Config;
use Websmid\VatCheck\Model\VatCache; use Websmid\VatCheck\Model\VatCache;
use PrestaShopLogger;
class EuValidatorAdapter class EuValidatorAdapter
{ {
@@ -27,6 +28,16 @@ class EuValidatorAdapter
try { try {
$euVatValidator = new Validator(new Europa, $this->vatNr, $this->isoCode); $euVatValidator = new Validator(new Europa, $this->vatNr, $this->isoCode);
} catch(Exception $e){ } 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; return false;
} }
+2
View File
@@ -21,6 +21,7 @@ class VatNumber
'FR' => 'FR', 'FR' => 'FR',
'FX' => 'FR', 'FX' => 'FR',
'DE' => 'DE', 'DE' => 'DE',
'GB' => 'XI',
'GR' => 'EL', 'GR' => 'EL',
'IE' => 'IE', 'IE' => 'IE',
'IT' => 'IT', 'IT' => 'IT',
@@ -53,6 +54,7 @@ class VatNumber
'DE' => '\d{9}', 'DE' => '\d{9}',
'DK' => '(\d{2} ?){3}\d{2}', 'DK' => '(\d{2} ?){3}\d{2}',
'EE' => '\d{9}', 'EE' => '\d{9}',
'GB' => '\d{9}(\d{3})?|[A-Z]{2}\d{3}',
'GR' => '\d{9}', 'GR' => '\d{9}',
'ES' => '[A-Z]\d{7}[A-Z]|\d{8}[A-Z]|[A-Z]\d{8}', 'ES' => '[A-Z]\d{7}[A-Z]|\d{8}[A-Z]|[A-Z]\d{8}',
'FI' => '\d{8}', 'FI' => '\d{8}',