Module: VatValidator

Defined in:
lib/vies_checker.rb,
lib/exceptions.rb,
lib/vat_validator.rb

Overview

Errors: from blog.riff.org/2007_04_08_soap_box_accessing_vies_from_phpgtk ‘INVALID_INPUT’ => ‘The provided CountryCode is invalid or the VAT number is empty’, ‘SERVICE_UNAVAILABLE’ => ‘The SOAP service is unavailable, try again later’, ‘MS_UNAVAILABLE’ => ‘The Member State service is unavailable, try again later or with another Member State’, ‘TIMEOUT’ => ‘The Member State service could not be reached in time, try again later or with another Member State’, ‘SERVER_BUSY’ => ‘The service cannot process your request. Try again later.’

Defined Under Namespace

Classes: VatNumber, VatValidator, ViesChecker, ViesContactError

Constant Summary collapse

VAT_PATTERNS =

Constants ——————————————————————

{
  'DE' => /\ADE[0-9]{9}\Z/,                                # Germany
  'AT' => /\AATU[0-9]{8}\Z/,                               # Austria
  'BE' => /\ABE[0-9]{10}\Z/,                               # Belgium
  'BG' => /\ABG[0-9]{9,10}\Z/,                             # Bulgaria
  'CY' => /\ACY[0-9]{8}[A-Z]\Z/,                           # Cyprus
  'DK' => /\ADK[0-9]{8}\Z/,                                # Denmark
  'ES' => /\AES[0-9]{9}\Z/,                                # Spain
  'EE' => /\AEE[0-9]{9}\Z/,                                # Estonia
  'FI' => /\AFI[0-9]{8}\Z/,                                # Finland
  'FR' => /\AFR[A-Z0-9]{2}[0-9]{9}\Z/,                     # France
  'EL' => /\AEL[0-9]{9}\Z/,                                # Greece
  'HU' => /\AHU[0-9]{8}\Z/,                                # Hungary
  'IE' => /\AIE([0-9][A-Z][0-9]{5}[A-Z]|[0-9]{7}[A-Z])\Z/, # Ireland
  'IT' => /\AIT[0-9]{11}\Z/,                               # Italy
  'LV' => /\ALV[0-9]{11}\Z/,                               # Latvia
  'LT' => /\ALT([0-9]{9}|[0-9]{12})\Z/,                    # Lithuania
  'LU' => /\ALU[0-9]{8}\Z/,                                # Luxembourg
  'MT' => /\AMT[0-9]{8}\Z/,                                # Malta
  'NL' => /\ANL[0-9]{9}[A-Z][0-9]{2}\Z/,                   # Netherlands
  'PL' => /\APL[0-9]{10}\Z/,                               # Poland
  'PT' => /\APT[0-9]{9}\Z/,                                # Portugal
  'GB' => /\AGB([0-9]{9}|[A-Z0-9]{2}[0-9]{3})\Z/,          # United Kingdom
  'RO' => /\ARO[0-9]{9}\Z/,                                # Romania
  'SK' => /\ASK[0-9]{10}\Z/,                               # Slovakia
  'SI' => /\ASI[0-9]{8}\Z/,                                # Slovenia
  'SE' => /\ASE[0-9]{12}\Z/,                               # Sweden
  'CZ' => /\ACZ[0-9]{8,10}\Z/                              # Czech Republic
}