From 5abb94665909285a3bf128df55d3bc4c9d3f8763 Mon Sep 17 00:00:00 2001 From: Joseph Southan Date: Tue, 28 Mar 2023 12:22:12 +0100 Subject: [PATCH 1/2] Add FO and GL to contructable countries This is to allow Betalingsservice to be used from these local details --- lib/ibandit/constants.rb | 2 +- lib/ibandit/iban_assembler.rb | 2 +- spec/ibandit/iban_assembler_spec.rb | 48 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/lib/ibandit/constants.rb b/lib/ibandit/constants.rb index 615e2fb..1be0c5d 100644 --- a/lib/ibandit/constants.rb +++ b/lib/ibandit/constants.rb @@ -2,7 +2,7 @@ module Ibandit module Constants - CONSTRUCTABLE_IBAN_COUNTRY_CODES = %w[AT BE BG CY CZ DE DK EE ES FI FR GB GR + CONSTRUCTABLE_IBAN_COUNTRY_CODES = %w[AT BE BG CY CZ DE DK EE ES FI FO FR GB GL GR HR HU IE IS IT LT LU LV MC MT NL NO PL PT RO SE SI SK SM].freeze diff --git a/lib/ibandit/iban_assembler.rb b/lib/ibandit/iban_assembler.rb index 25b67b4..175ab15 100644 --- a/lib/ibandit/iban_assembler.rb +++ b/lib/ibandit/iban_assembler.rb @@ -89,7 +89,7 @@ def self.valid_arguments?(local_details) def self.required_fields(country_code) case country_code - when "AT", "CY", "CZ", "DE", "DK", "EE", "FI", "HR", "IS", "LT", "LU", + when "AT", "CY", "CZ", "DE", "DK", "EE", "FO", "FI", "GL", "HR", "IS", "LT", "LU", "LV", "NL", "NO", "PL", "RO", "SE", "SI", "SK" %i[bank_code account_number] when "BE" diff --git a/spec/ibandit/iban_assembler_spec.rb b/spec/ibandit/iban_assembler_spec.rb index a5c08cb..b1bbc68 100644 --- a/spec/ibandit/iban_assembler_spec.rb +++ b/spec/ibandit/iban_assembler_spec.rb @@ -210,6 +210,54 @@ end end + context "with FO as the country_code" do + let(:args) do + { country_code: "FO", + bank_code: "1199", + account_number: "0003179680" } + end + + it { is_expected.to eq("FO9111990003179680") } + + it_behaves_like "allows round trips", "FO91 1199 0003 1796 80" + + context "without a bank_code" do + before { args.delete(:bank_code) } + + it { is_expected.to be_nil } + end + + context "without an account_number" do + before { args.delete(:account_number) } + + it { is_expected.to be_nil } + end + end + + context "with GL as the country_code" do + let(:args) do + { country_code: "GL", + bank_code: "1199", + account_number: "0003179680" } + end + + it { is_expected.to eq("GL9111990003179680") } + + it_behaves_like "allows round trips", "GL91 1199 0003 1796 80" + + context "without a bank_code" do + before { args.delete(:bank_code) } + + it { is_expected.to be_nil } + end + + context "without an account_number" do + before { args.delete(:account_number) } + + it { is_expected.to be_nil } + end + end + context "with EE as the country_code" do let(:args) do { From bb21ab778586603cbf9fb996e93f9e082c659865 Mon Sep 17 00:00:00 2001 From: Joseph Southan Date: Tue, 28 Mar 2023 12:24:26 +0100 Subject: [PATCH 2/2] Bump v1.14.0 --- CHANGELOG.md | 5 +++++ lib/ibandit/version.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eac64d0..5bc971f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.14.0 - March 28, 2023 + +- Update IBAN registry #233 +- Add GL and FO to the IBAN constructor for local details + ## 1.13.0 - March 6, 2023 - Update BLZ data - BLZ_20230306 diff --git a/lib/ibandit/version.rb b/lib/ibandit/version.rb index da12e1b..e951698 100644 --- a/lib/ibandit/version.rb +++ b/lib/ibandit/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Ibandit - VERSION = "1.13.0" + VERSION = "1.14.0" end