ibandit 1.33.0 → 1.34.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e64b343d0208a90e559080e123c93ed871ae29c0752109a64d7b585a7745bff
4
- data.tar.gz: bb5b4f8a497a9929d2100bbbd59e8eb6e38b7498e6ae49679f9b74053a72fd69
3
+ metadata.gz: 94889979e0c49c255ce74acc38b1c9462b36bc4e4d9a80c214ae8905047dba4d
4
+ data.tar.gz: 4aa46bac681573a174c62ee4879fedefcbe56d11c18e8d6743c67c72e77849c7
5
5
  SHA512:
6
- metadata.gz: 033a7aa87139f5d02b407e21f94ae69e410a0ce7b8d489e5a271802074aff1a0e9f5baa8dfa0d49d32e259dff0d229b04c79d6803e6b85945831d0cd81261f14
7
- data.tar.gz: 5e8ead943cab4950c02ce3854d60197294366096a25547d85703f9a1896943b0da3778765ae57070b5ef1547be3e2192f84d23674a2369cca4ff12b96c5a473f
6
+ metadata.gz: 8606eb4bf0b1524196175ddce5e4b0f153d5cbbcda1767ef8985a8bc2df1a3abcbba63847243b15a461b1892f14c89e6c75fbe72815274940275b73afa929e01
7
+ data.tar.gz: fe4757e398d63e1d9a9552e7a8f4d5e02b2074fa04617b6d4a402d7c615513ded4e09e9cc820483659a649a984c05a67f7356c1453ec49e4e57f7276c8ef8269
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.34.0 - September 11, 2026
2
+
3
+ - [Breaking] Reject NZ account numbers whose 3 digit suffix does not start with a zero
4
+
1
5
  ## 1.33.0 - September 2, 2026
2
6
 
3
7
  - Update BLZ data - BLZ_20260907
data/README.md CHANGED
@@ -548,20 +548,25 @@ 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 a leading zero. A suffix given as 3 digits
552
+ # must already start with that zero: `SS` becomes `0SS`, never `SS0`.
553
+
551
554
  iban = Ibandit::IBAN.new(
552
555
  country_code: 'NZ',
553
556
  account_number: '01-0004-3333333-44'
554
557
  )
555
- iban.pseudo_iban # => "NZZZ0100043333333044"
556
- iban.bank_code # => "01"
557
- iban.branch_code # => "0004"
558
- iban.account_number # => "3333333044"
558
+ iban.pseudo_iban # => "NZZZ0100043333333044"
559
+ iban.bank_code # => "01"
560
+ iban.branch_code # => "0004"
561
+ iban.account_number # => "3333333"
562
+ iban.account_number_suffix # => "044"
559
563
 
560
564
  iban = Ibandit::IBAN.new('NZZZ0100043333333044')
561
- iban.country_code # => "NZ"
562
- iban.bank_code # => "01"
563
- iban.branch_code # => "0004"
564
- iban.account_number # => "3333333044"
565
+ iban.country_code # => "NZ"
566
+ iban.bank_code # => "01"
567
+ iban.branch_code # => "0004"
568
+ iban.account_number # => "3333333"
569
+ iban.account_number_suffix # => "044"
565
570
 
566
571
  # USA
567
572
  iban = Ibandit::IBAN.new(
@@ -35,7 +35,7 @@ NZ:
35
35
  :account_number_length: 10
36
36
  :bank_code_format: "\\d{2}"
37
37
  :branch_code_format: "\\d{4}"
38
- :account_number_format: "\\d{7}\\d{3}"
38
+ :account_number_format: "\\d{7}0\\d{2}"
39
39
  :pseudo_iban_bank_code_length: 2
40
40
  :pseudo_iban_branch_code_length: 4
41
41
  :pseudo_iban_account_number_length: 10
data/data/structures.yml CHANGED
@@ -1598,7 +1598,7 @@ NZ:
1598
1598
  :account_number_length: 10
1599
1599
  :bank_code_format: "\\d{2}"
1600
1600
  :branch_code_format: "\\d{4}"
1601
- :account_number_format: "\\d{7}\\d{3}"
1601
+ :account_number_format: "\\d{7}0\\d{2}"
1602
1602
  :pseudo_iban_bank_code_length: 2
1603
1603
  :pseudo_iban_branch_code_length: 4
1604
1604
  :pseudo_iban_account_number_length: 10
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ibandit
4
- VERSION = "1.33.0"
4
+ VERSION = "1.34.0"
5
5
  end
@@ -12,15 +12,6 @@
12
12
  { "bank_code": "10060198", "account_number" : "1" }
13
13
  ]
14
14
  },
15
- // {
16
- // "convertor": "000300",
17
- // "valid": [
18
- // { "bank_code": "51010800", "account_number" : "1" }
19
- // ],
20
- // "invalid": [
21
- // { "bank_code": "51010800", "account_number" : "6161604670" }
22
- // ]
23
- // },
24
15
  {
25
16
  "convertor": "000400",
26
17
  "valid": [
@@ -91,12 +82,6 @@
91
82
  {"bank_code":"51020000","account_number":"30009963","converted_bank_code":"50020200","converted_account_number":"30009963"}
92
83
  ]
93
84
  },
94
- // {
95
- // "convertor": "000900",
96
- // "valid": [
97
- // {"bank_code":"68351976","account_number":"1116232594","converted_bank_code":"68351557","converted_account_number":"3047232594"}
98
- // ]
99
- // },
100
85
  {
101
86
  "convertor": "001001",
102
87
  "valid": [
@@ -157,10 +142,4 @@
157
142
  { "bank_code": "30060010", "account_number": "12345678", "converted_account_number": "12345678" }
158
143
  ]
159
144
  }
160
- // {
161
- // "convertor": "001900",
162
- // "valid": [
163
- // { "bank_code": "50130100", "account_number": "556", "converted_bank_code": "50120383" }
164
- // ]
165
- // }
166
145
  ]
@@ -136,12 +136,6 @@
136
136
  { "bank_code": "10010010", "account_number" : "556", "converted_account_number": "0120440110" }
137
137
  ]
138
138
  },
139
- // {
140
- // "convertor": "001900",
141
- // "valid": [
142
- // { "bank_code": "10010010", "account_number" : "1234567890", "converted_bank_code": "50120383" }
143
- // ]
144
- // },
145
139
  {
146
140
  "convertor": "002002",
147
141
  "valid": [
@@ -764,23 +764,34 @@ describe Ibandit::IBAN do
764
764
  end
765
765
 
766
766
  context "with a 3 digit account number suffix" do
767
- let(:account_number) { "3333333-944" }
767
+ let(:account_number) { "3333333-044" }
768
768
 
769
769
  its(:country_code) { is_expected.to eq("NZ") }
770
770
  its(:bank_code) { is_expected.to eq("11") }
771
771
  its(:branch_code) { is_expected.to eq("2222") }
772
772
  its(:account_number) { is_expected.to eq("3333333") }
773
- its(:account_number_suffix) { is_expected.to eq("944") }
773
+ its(:account_number_suffix) { is_expected.to eq("044") }
774
774
  its(:swift_bank_code) { is_expected.to eq("11") }
775
775
  its(:swift_branch_code) { is_expected.to eq("2222") }
776
- its(:swift_account_number) { is_expected.to eq("3333333944") }
776
+ its(:swift_account_number) { is_expected.to eq("3333333044") }
777
777
  its(:swift_national_id) { is_expected.to eq("112222") }
778
778
  its(:iban) { is_expected.to be_nil }
779
- its(:pseudo_iban) { is_expected.to eq("NZZZ1122223333333944") }
779
+ its(:pseudo_iban) { is_expected.to eq("NZZZ1122223333333044") }
780
780
  its(:valid?) { is_expected.to eq(true) }
781
781
  its(:to_s) { is_expected.to eq("") }
782
782
  end
783
783
 
784
+ context "with a 3 digit account number suffix not starting with a zero" do
785
+ let(:account_number) { "3333333-500" }
786
+
787
+ its(:account_number_suffix) { is_expected.to eq("500") }
788
+
789
+ it "is invalid and has the correct errors" do
790
+ expect(subject.valid?).to eq(false)
791
+ expect(subject.errors).to eq(account_number: "format is invalid")
792
+ end
793
+ end
794
+
784
795
  context "with a 2 digit account number suffix" do
785
796
  let(:account_number) { "3333333-44" }
786
797
 
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.33.0
4
+ version: 1.34.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2026-09-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: i18n
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  requirements: []
117
- rubygems_version: 3.6.9
117
+ rubygems_version: 3.6.2
118
118
  specification_version: 4
119
119
  summary: Convert national banking details into IBANs, and vice-versa.
120
120
  test_files: []