ibandit 1.23.0 → 1.25.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/CHANGELOG.md +8 -0
- data/data/raw/swedish_bank_lookup.yml +1 -1
- data/lib/ibandit/iban.rb +1 -0
- data/lib/ibandit/sweden/validator.rb +1 -1
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/iban_spec.rb +77 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59b71293c8cd665cfb42ceee4f5216553d32246a17a30df647bd7f084c8d8cb1
|
4
|
+
data.tar.gz: b1e0709ad2457b23e89936ece46e70c8f7779b9bbaefb80a23cbad9dae57b3fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e5cd5a8c6be145321f15cbb55da328828df5f089b524e74c33eca4216202fed477e4d881a1d111a53287a22988f828e94fee1ce758c5197781590f5c003b878
|
7
|
+
data.tar.gz: dbe36b9e0396322e9b168647e74cbe86af65c5fb4fcc160385c842db6886ba8932278cd0f3808669734da5f45cfb8aea24484a038349ec3e147c23b59f67288e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 1.25.0 - February 18, 2025
|
2
|
+
|
3
|
+
- `SE` pseudo-ibans no longer fail validation due to the `ZZ` check digit.
|
4
|
+
|
5
|
+
## 1.24.0 - February 18, 2025
|
6
|
+
|
7
|
+
- Fix validation for SE IBANs where the account number starts with a 0 and the clearing number is not included in the IBAN
|
8
|
+
|
1
9
|
## 1.23.0 - February 14, 2025
|
2
10
|
|
3
11
|
- Fix validation for SE IBANs for clearing code 3300 where the account number starts with a 0
|
data/lib/ibandit/iban.rb
CHANGED
@@ -128,6 +128,7 @@ module Ibandit
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def valid_check_digits?
|
131
|
+
return true if source == :pseudo_iban && check_digits == Constants::PSEUDO_IBAN_CHECK_DIGITS
|
131
132
|
return unless decomposable? && valid_characters?
|
132
133
|
|
133
134
|
expected_check_digits = CheckDigit.iban(country_code, bban)
|
@@ -64,7 +64,7 @@ module Ibandit
|
|
64
64
|
length += bank[:clearing_code_length] if bank[:include_clearing_code]
|
65
65
|
|
66
66
|
cleaned_account_number = account_number.gsub(/\A0+/, "")
|
67
|
-
if
|
67
|
+
if !bank[:include_clearing_code]
|
68
68
|
cleaned_account_number =
|
69
69
|
cleaned_account_number.
|
70
70
|
rjust(bank.fetch(:serial_number_length), "0")
|
data/lib/ibandit/version.rb
CHANGED
data/spec/ibandit/iban_spec.rb
CHANGED
@@ -183,6 +183,75 @@ describe Ibandit::IBAN do
|
|
183
183
|
its(:iban) { is_expected.to eq("SE5412000000012810105723") }
|
184
184
|
its(:pseudo_iban) { is_expected.to eq("SEZZX1281XXX0105723") }
|
185
185
|
its(:to_s) { is_expected.to eq("SE5412000000012810105723") }
|
186
|
+
its(:valid?) { is_expected.to eq(true) }
|
187
|
+
|
188
|
+
context "and the clearing code is not part of the IBAN" do
|
189
|
+
context "and the branch code allows for zero-filling of short account numbers" do
|
190
|
+
let(:arg) do
|
191
|
+
{
|
192
|
+
country_code: "SE",
|
193
|
+
branch_code: "6000",
|
194
|
+
account_number: "1234567",
|
195
|
+
}
|
196
|
+
end
|
197
|
+
|
198
|
+
its(:country_code) { is_expected.to eq("SE") }
|
199
|
+
its(:bank_code) { is_expected.to be_nil }
|
200
|
+
its(:branch_code) { is_expected.to eq("6000") }
|
201
|
+
its(:account_number) { is_expected.to eq("001234567") }
|
202
|
+
its(:swift_bank_code) { is_expected.to eq("600") }
|
203
|
+
its(:swift_branch_code) { is_expected.to be_nil }
|
204
|
+
its(:swift_account_number) { is_expected.to eq("00000000001234567") }
|
205
|
+
its(:iban) { is_expected.to eq("SE2260000000000001234567") }
|
206
|
+
its(:pseudo_iban) { is_expected.to eq("SEZZX6000X001234567") }
|
207
|
+
its(:to_s) { is_expected.to eq("SE2260000000000001234567") }
|
208
|
+
its(:valid?) { is_expected.to eq(true) }
|
209
|
+
end
|
210
|
+
|
211
|
+
context "and the branch code does not allow for zero-filling of short account numbers" do
|
212
|
+
let(:arg) do
|
213
|
+
{
|
214
|
+
country_code: "SE",
|
215
|
+
branch_code: "3300",
|
216
|
+
account_number: "1234567",
|
217
|
+
}
|
218
|
+
end
|
219
|
+
|
220
|
+
its(:country_code) { is_expected.to eq("SE") }
|
221
|
+
its(:bank_code) { is_expected.to be_nil }
|
222
|
+
its(:branch_code) { is_expected.to eq("3300") }
|
223
|
+
its(:account_number) { is_expected.to eq("1234567") }
|
224
|
+
its(:swift_bank_code) { is_expected.to eq("300") }
|
225
|
+
its(:swift_branch_code) { is_expected.to be_nil }
|
226
|
+
its(:swift_account_number) { is_expected.to eq("00000000001234567") }
|
227
|
+
its(:iban) { is_expected.to eq("SE4130000000000001234567") }
|
228
|
+
its(:pseudo_iban) { is_expected.to eq("SEZZX3300XXX1234567") }
|
229
|
+
its(:to_s) { is_expected.to eq("SE4130000000000001234567") }
|
230
|
+
its(:valid?) { is_expected.to eq(false) }
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
context "and the clearing code is part of the IBAN" do
|
235
|
+
let(:arg) do
|
236
|
+
{
|
237
|
+
country_code: "SE",
|
238
|
+
branch_code: "3410",
|
239
|
+
account_number: "1234567",
|
240
|
+
}
|
241
|
+
end
|
242
|
+
|
243
|
+
its(:country_code) { is_expected.to eq("SE") }
|
244
|
+
its(:bank_code) { is_expected.to be_nil }
|
245
|
+
its(:branch_code) { is_expected.to eq("3410") }
|
246
|
+
its(:account_number) { is_expected.to eq("1234567") }
|
247
|
+
its(:swift_bank_code) { is_expected.to eq("300") }
|
248
|
+
its(:swift_branch_code) { is_expected.to be_nil }
|
249
|
+
its(:swift_account_number) { is_expected.to eq("00000034101234567") }
|
250
|
+
its(:iban) { is_expected.to eq("SE1030000000034101234567") }
|
251
|
+
its(:pseudo_iban) { is_expected.to eq("SEZZX3410XXX1234567") }
|
252
|
+
its(:to_s) { is_expected.to eq("SE1030000000034101234567") }
|
253
|
+
its(:valid?) { is_expected.to eq(true) }
|
254
|
+
end
|
186
255
|
end
|
187
256
|
|
188
257
|
context "when the IBAN was created from a pseudo-IBAN" do
|
@@ -198,9 +267,17 @@ describe Ibandit::IBAN do
|
|
198
267
|
its(:iban) { is_expected.to eq("SE5412000000012810105723") }
|
199
268
|
its(:pseudo_iban) { is_expected.to eq("SEZZX1281XXX0105723") }
|
200
269
|
its(:to_s) { is_expected.to eq("SE5412000000012810105723") }
|
270
|
+
its(:valid?) { is_expected.to eq(true) }
|
201
271
|
end
|
202
272
|
|
203
273
|
context "when the IBAN was created from a Swedish IBAN" do
|
274
|
+
context "with check digits that make it look like a pseudo-IBAN" do
|
275
|
+
let(:arg) { "SEZZ30000000031231234567" }
|
276
|
+
|
277
|
+
its(:country_code) { is_expected.to eq("SE") }
|
278
|
+
its(:valid?) { is_expected.to eq(false) }
|
279
|
+
end
|
280
|
+
|
204
281
|
context "where the clearing code is part of the account number" do
|
205
282
|
let(:arg) { "SE4730000000031231234567" }
|
206
283
|
|
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.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoCardless
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-02-
|
10
|
+
date: 2025-02-18 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: i18n
|