You are here

protected function EuropeanUnionVat::getValidationPatterns in Commerce Core 8.2

Gets the validation patterns.

Source: http://ec.europa.eu/taxation_customs/vies/faq.html#item_11

Return value

array The validation patterns, keyed by prefix. The prefix is an ISO country code, except for Greece (EL instead of GR).

2 calls to EuropeanUnionVat::getValidationPatterns()
EuropeanUnionVat::doVerify in modules/tax/src/Plugin/Commerce/TaxNumberType/EuropeanUnionVat.php
Performs the tax number verification.
EuropeanUnionVat::validate in modules/tax/src/Plugin/Commerce/TaxNumberType/EuropeanUnionVat.php
Validates the given tax number.

File

modules/tax/src/Plugin/Commerce/TaxNumberType/EuropeanUnionVat.php, line 145

Class

EuropeanUnionVat
Provides the European Union VAT tax number type.

Namespace

Drupal\commerce_tax\Plugin\Commerce\TaxNumberType

Code

protected function getValidationPatterns() {
  $patterns = [
    'AT' => 'U[A-Z\\d]{8}',
    'BE' => '(0\\d{9}|\\d{10})',
    'BG' => '\\d{9,10}',
    'CY' => '\\d{8}[A-Z]',
    'CZ' => '\\d{8,10}',
    'DE' => '\\d{9}',
    'DK' => '\\d{8}',
    'EE' => '\\d{9}',
    'EL' => '\\d{9}',
    'ES' => '[A-Z]\\d{7}[A-Z]|\\d{8}[A-Z]|[A-Z]\\d{8}',
    'FI' => '\\d{8}',
    'FR' => '[0-9A-Z]{2}\\d{9}',
    'HR' => '\\d{11}',
    'HU' => '\\d{8}',
    'IE' => '[A-Z\\d]{8}|[A-Z\\d]{9}',
    'IT' => '\\d{11}',
    'LT' => '(\\d{9}|\\d{12})',
    'LU' => '\\d{8}',
    'LV' => '\\d{11}',
    'MT' => '\\d{8}',
    'NL' => '\\d{9}B\\d{2}',
    'PL' => '\\d{10}',
    'PT' => '\\d{9}',
    'RO' => '\\d{2,10}',
    'SE' => '\\d{12}',
    'SI' => '\\d{8}',
    'SK' => '\\d{10}',
  ];
  return $patterns;
}