ibandit 1.34.0 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +19 -5
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile +1 -1
- data/README.md +3 -2
- data/config/locales/de.yml +1 -1
- data/config/locales/sk.yml +21 -0
- data/lib/ibandit/constants.rb +1 -1
- data/lib/ibandit/local_details_cleaner.rb +6 -6
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/iban_spec.rb +13 -0
- data/spec/ibandit/local_details_cleaner_spec.rb +8 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d8bfd630aac225e15cb3f9da75e76cdd628ab808f882b6722421f6fea17660fa
|
|
4
|
+
data.tar.gz: 345b0848da39eed06d67eddd34e89ab9f744730a3a887c92f950778a2a479be3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9789b4df93ee4c41d587dfc8272504af058e2b088be8027e938d3ab8bc8da364e9eb9c3e1ace667e267f828236867566c606a14237d1b1440ade115865480e65
|
|
7
|
+
data.tar.gz: 421bdbf2a1acc66ca3aae3bc0dd2b4c78f2e64b00364da6699d7732596dbeb13053b99b320ed3709d8e6c06994371421714a30ea8ce71ae4894404b4c83ea668
|
data/.github/workflows/tests.yml
CHANGED
|
@@ -2,15 +2,31 @@ name: tests
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
+
branches:
|
|
6
|
+
- "master"
|
|
7
|
+
pull_request:
|
|
5
8
|
|
|
6
9
|
jobs:
|
|
7
|
-
|
|
10
|
+
rubocop:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v7
|
|
14
|
+
- name: Set up Ruby
|
|
15
|
+
uses: ruby/setup-ruby@v1
|
|
16
|
+
with:
|
|
17
|
+
bundler-cache: true
|
|
18
|
+
# Maintain consistency with the TargetRubyVersion in .rubocop.yml
|
|
19
|
+
ruby-version: "3.3"
|
|
20
|
+
- name: Run rubocop
|
|
21
|
+
run: bundle exec rubocop --parallel --extra-details --display-style-guide
|
|
22
|
+
|
|
23
|
+
tests:
|
|
8
24
|
strategy:
|
|
9
25
|
matrix:
|
|
10
|
-
ruby-version: ["3.
|
|
26
|
+
ruby-version: ["3.3", "3.4", "4.0"]
|
|
11
27
|
runs-on: ubuntu-latest
|
|
12
28
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
29
|
+
- uses: actions/checkout@v7
|
|
14
30
|
- name: Set up Ruby
|
|
15
31
|
uses: ruby/setup-ruby@v1
|
|
16
32
|
with:
|
|
@@ -18,5 +34,3 @@ jobs:
|
|
|
18
34
|
ruby-version: "${{ matrix.ruby-version }}"
|
|
19
35
|
- name: Run tests
|
|
20
36
|
run: bundle exec rspec
|
|
21
|
-
- name: Run rubocop
|
|
22
|
-
run: bundle exec rubocop --parallel --extra-details --display-style-guide
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.0.6
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 1.36.0 - September 29, 2026
|
|
2
|
+
|
|
3
|
+
- Add Slovak translations
|
|
4
|
+
- Update German translation for invalid check digits
|
|
5
|
+
- Drop CI testing for Rubies older than 3.3
|
|
6
|
+
|
|
7
|
+
## 1.35.0 - September 28, 2026
|
|
8
|
+
|
|
9
|
+
- Accept one-digit NZ account suffixes and normalise them to the three-digit bank form.
|
|
10
|
+
|
|
1
11
|
## 1.34.0 - September 11, 2026
|
|
2
12
|
|
|
3
13
|
- [Breaking] Reject NZ account numbers whose 3 digit suffix does not start with a zero
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -548,8 +548,9 @@ iban = Ibandit::IBAN.new(
|
|
|
548
548
|
iban.pseudo_iban # => "NZZZ0100043333333044"
|
|
549
549
|
iban.iban # => nil
|
|
550
550
|
|
|
551
|
-
# A 2 digit suffix is padded with
|
|
552
|
-
# must already start with
|
|
551
|
+
# A 1 or 2 digit suffix is padded with leading zeroes to the three-digit bank
|
|
552
|
+
# form. A suffix supplied with 3 digits must already start with a zero: `S`
|
|
553
|
+
# becomes `00S`, `SS` becomes `0SS`, never `SS0`.
|
|
553
554
|
|
|
554
555
|
iban = Ibandit::IBAN.new(
|
|
555
556
|
country_code: 'NZ',
|
data/config/locales/de.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
de:
|
|
2
2
|
ibandit:
|
|
3
3
|
invalid_country_code: "'%{country_code}' ist kein gültiges IBAN-Länderkennzeichen gemäß ISO 3166-1"
|
|
4
|
-
invalid_check_digits: "
|
|
4
|
+
invalid_check_digits: "Prüfsumme ist ungültig (%{expected_check_digits} erwartet, %{check_digits} angegeben)."
|
|
5
5
|
invalid_length: "Länge entspricht nicht der SWIFT-Spezifikation (%{expected_length} Zeichen erwartet, %{length} angegeben)"
|
|
6
6
|
is_required: "ist erforderlich"
|
|
7
7
|
wrong_length: "hat nicht die richtige Länge (sollte %{expected} Zeichen haben)"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
sk:
|
|
2
|
+
ibandit:
|
|
3
|
+
invalid_country_code: "'%{country_code}' nie je platný ISO 3166-1 IBAN kód krajiny"
|
|
4
|
+
invalid_check_digits: "Kontrolné číslice neprešli kontrolou modulo. Očakávané '%{expected_check_digits}', zadané '%{check_digits}'."
|
|
5
|
+
invalid_length: "Dĺžka nezodpovedá špecifikácii SWIFT (očakávaných %{expected_length} znakov, zadaných %{length})"
|
|
6
|
+
is_required: "je povinné"
|
|
7
|
+
wrong_length: "má nesprávnu dĺžku (má byť %{expected} znakov)"
|
|
8
|
+
not_used_in_country: "nie je používaný v %{country_code}"
|
|
9
|
+
non_alphanumeric_characters: "Nealfanumerické znaky nájdené: %{characters}"
|
|
10
|
+
invalid_format: "Neočakávaný formát pre %{country_code} IBAN."
|
|
11
|
+
is_invalid: "je neplatný"
|
|
12
|
+
does_not_support_payments: "nepodporuje platby"
|
|
13
|
+
has_invalid_format: "formát je neplatný"
|
|
14
|
+
failed_checksum_test: "neúspešný test kontrolného súčtu"
|
|
15
|
+
failed_modulus_check: "neúspešná kontrola modulo"
|
|
16
|
+
has_invalid_length: "dĺžka je neplatná"
|
|
17
|
+
bank_code_does_not_exist: "bankový kód neexistuje"
|
|
18
|
+
has_invalid_clearing_code_length: "dĺžka kódu clearingu je neplatná"
|
|
19
|
+
has_invalid_serial_number: "sériové číslo je neplatné"
|
|
20
|
+
branch_code_does_not_exist: "kód pobočky neexistuje"
|
|
21
|
+
|
data/lib/ibandit/constants.rb
CHANGED
|
@@ -468,12 +468,12 @@ module Ibandit
|
|
|
468
468
|
|
|
469
469
|
def self.clean_nz_details(local_details)
|
|
470
470
|
# This method supports being passed the component parts of the NZ account
|
|
471
|
-
# number, or a single 15/16 digit string
|
|
471
|
+
# number, or a single 14/15/16 digit string with a 1/2/3-digit suffix in the
|
|
472
472
|
# account number field.
|
|
473
473
|
#
|
|
474
|
-
# When given a 15/16 digit string, the component parts (i.e bank_code,
|
|
474
|
+
# When given a 14/15/16 digit string, the component parts (i.e bank_code,
|
|
475
475
|
# branch_code and account_number) are extracted, with the 7-digit account
|
|
476
|
-
# number body and 2/3-digit account number suffix making up the actual
|
|
476
|
+
# number body and 1/2/3-digit account number suffix making up the actual
|
|
477
477
|
# account_number field.
|
|
478
478
|
if local_details[:bank_code] && local_details[:branch_code]
|
|
479
479
|
bank_code = local_details[:bank_code]
|
|
@@ -486,7 +486,7 @@ module Ibandit
|
|
|
486
486
|
account_number = cleaned_account_number[6..]
|
|
487
487
|
end
|
|
488
488
|
|
|
489
|
-
if account_number && account_number.length
|
|
489
|
+
if account_number && [8, 9].include?(account_number.length)
|
|
490
490
|
# > Some banks (such as BNZ) include three digits of the suffix in their
|
|
491
491
|
# > presentation of the account number to the end customer. Other banks
|
|
492
492
|
# > only show the last two digits of the suffix to the end customer.
|
|
@@ -494,8 +494,8 @@ module Ibandit
|
|
|
494
494
|
# > first digit of the suffix is always 0 so it's usually ignored.
|
|
495
495
|
# > [https://en.wikipedia.org/wiki/New_Zealand_bank_account_number]
|
|
496
496
|
#
|
|
497
|
-
# Here, we
|
|
498
|
-
account_number = account_number[0..6] +
|
|
497
|
+
# Here, we restore omitted leading zeros in the suffix.
|
|
498
|
+
account_number = account_number[0..6] + account_number[7..].rjust(3, "0")
|
|
499
499
|
end
|
|
500
500
|
|
|
501
501
|
{
|
data/lib/ibandit/version.rb
CHANGED
data/spec/ibandit/iban_spec.rb
CHANGED
|
@@ -810,6 +810,19 @@ describe Ibandit::IBAN do
|
|
|
810
810
|
its(:to_s) { is_expected.to eq("") }
|
|
811
811
|
end
|
|
812
812
|
|
|
813
|
+
context "with a 1 digit account number suffix" do
|
|
814
|
+
let(:account_number) { "3333333-1" }
|
|
815
|
+
|
|
816
|
+
its(:country_code) { is_expected.to eq("NZ") }
|
|
817
|
+
its(:bank_code) { is_expected.to eq("11") }
|
|
818
|
+
its(:branch_code) { is_expected.to eq("2222") }
|
|
819
|
+
its(:account_number) { is_expected.to eq("3333333") }
|
|
820
|
+
its(:account_number_suffix) { is_expected.to eq("001") }
|
|
821
|
+
its(:swift_account_number) { is_expected.to eq("3333333001") }
|
|
822
|
+
its(:pseudo_iban) { is_expected.to eq("NZZZ1122223333333001") }
|
|
823
|
+
its(:valid?) { is_expected.to eq(true) }
|
|
824
|
+
end
|
|
825
|
+
|
|
813
826
|
context "with a nil account number" do
|
|
814
827
|
let(:account_number) { nil }
|
|
815
828
|
|
|
@@ -1076,6 +1076,14 @@ describe Ibandit::LocalDetailsCleaner do
|
|
|
1076
1076
|
its([:branch_code]) { is_expected.to eq("2222") }
|
|
1077
1077
|
its([:account_number]) { is_expected.to eq("3333333044") }
|
|
1078
1078
|
|
|
1079
|
+
context "with a 1-digit account number suffix" do
|
|
1080
|
+
let(:account_number) { "11-2222-3333333-1" }
|
|
1081
|
+
|
|
1082
|
+
its([:bank_code]) { is_expected.to eq("11") }
|
|
1083
|
+
its([:branch_code]) { is_expected.to eq("2222") }
|
|
1084
|
+
its([:account_number]) { is_expected.to eq("3333333001") }
|
|
1085
|
+
end
|
|
1086
|
+
|
|
1079
1087
|
context "with a 2-digit account number suffix" do
|
|
1080
1088
|
let(:account_number) { "11-2222-3333333-44" }
|
|
1081
1089
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ibandit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.36.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GoCardless
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: i18n
|
|
@@ -55,6 +55,7 @@ files:
|
|
|
55
55
|
- config/locales/nb.yml
|
|
56
56
|
- config/locales/nl.yml
|
|
57
57
|
- config/locales/pt.yml
|
|
58
|
+
- config/locales/sk.yml
|
|
58
59
|
- config/locales/sl.yml
|
|
59
60
|
- config/locales/sv.yml
|
|
60
61
|
- data/german_iban_rules.yml
|
|
@@ -114,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
114
115
|
- !ruby/object:Gem::Version
|
|
115
116
|
version: '0'
|
|
116
117
|
requirements: []
|
|
117
|
-
rubygems_version:
|
|
118
|
+
rubygems_version: 4.0.16
|
|
118
119
|
specification_version: 4
|
|
119
120
|
summary: Convert national banking details into IBANs, and vice-versa.
|
|
120
121
|
test_files: []
|