diff --git a/lib/vat_check/format.rb b/lib/vat_check/format.rb index 8efb8ea..7b60681 100644 --- a/lib/vat_check/format.rb +++ b/lib/vat_check/format.rb @@ -10,7 +10,7 @@ def self.valid?(vat) def self.patterns @patterns ||= { 'AT' => /\AATU[0-9]{8}\Z/, # Austria - 'BE' => /\ABE0[0-9]{9}\Z/, # Belgium + 'BE' => /\ABE[01][0-9]{9}\Z/, # Belgium 'BG' => /\ABG[0-9]{9,10}\Z/, # Bulgaria 'CY' => /\ACY[0-9]{8}[A-Z]\Z/, # Cyprus 'CZ' => /\ACZ[0-9]{8,10}\Z/, # Czech Republic diff --git a/lib/vat_check/requests.rb b/lib/vat_check/requests.rb index 95edd8b..f54598a 100644 --- a/lib/vat_check/requests.rb +++ b/lib/vat_check/requests.rb @@ -6,7 +6,7 @@ def self.lookup(vat) client = Savon.client(wsdl: 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl', follow_redirects: true, log: false, log_level: :debug, pretty_print_xml: false) country_code, vat_number = VatCheck::Utility.split(vat) begin - response = client.call(:check_vat, message: {country_code: country_code, vat_number: vat_number}, message_tag: :checkVat) + response = client.call(:check_vat, message: {country_code: country_code, vat_number: vat_number}, message_tag: :checkVat, soap_action: nil) response.to_hash[:check_vat_response].reject { |key| key == :@xmlns } rescue Savon::SOAPFault => e if !!(e.message =~ /MS_UNAVAILABLE/) diff --git a/spec/vat_check/format_spec.rb b/spec/vat_check/format_spec.rb index 3cdec9b..0227667 100644 --- a/spec/vat_check/format_spec.rb +++ b/spec/vat_check/format_spec.rb @@ -4,6 +4,7 @@ valid_vat_ids = [ 'ATU99999999', # AT-Austria 'BE0999999999', # BE-Belgium + 'BE1999999999', # BE-Belgium 'BG999999999', # BG-Bulgaria 'BG9999999999', # BG-Bulgaria 'CY99999999L', # CY-Cyprus