Skip to content

Commit

Permalink
Merge pull request #234 from gocardless/joesouthan/betaling
Browse files Browse the repository at this point in the history
Add support for constructing IBANs for FO and GL
  • Loading branch information
JoeSouthan authored Mar 28, 2023
2 parents 5564f04 + bb21ab7 commit 773686a
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/ibandit/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/ibandit/iban_assembler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/ibandit/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Ibandit
VERSION = "1.13.0"
VERSION = "1.14.0"
end
48 changes: 48 additions & 0 deletions spec/ibandit/iban_assembler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 773686a

Please sign in to comment.