Skip to content

Commit

Permalink
Merge pull request #1 from artsy/merge-past-fixes
Browse files Browse the repository at this point in the history
chore: Merge past fixes diverging from taxjar upstream
  • Loading branch information
erikdstock authored Aug 21, 2024
2 parents 0956a95 + f82e8af commit 711b7d0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/vat_check/format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/vat_check/requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
1 change: 1 addition & 0 deletions spec/vat_check/format_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 711b7d0

Please sign in to comment.