ibandit 1.22.0 → 1.24.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/.gitignore +1 -0
- data/CHANGELOG.md +8 -0
- data/data/raw/swedish_bank_lookup.yml +4 -1
- data/lib/ibandit/sweden/validator.rb +1 -1
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/iban_spec.rb +152 -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: 6f8f92719cd4de9683bfd0c36a84550b67a0ab89f99ae760f6f2105f9b5ddd62
|
4
|
+
data.tar.gz: 0b1e3547051b10705bfbc75e924611875170b2324085f1db509060ec84c59890
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b368ac91d2fa12f4691a165b0de4150a23e8c5a0a14b04b9ac17d4cc496d594a9cbf0308fec594afccbfed262bb8557bceabfe1a453c11df5e24093fa970783a
|
7
|
+
data.tar.gz: 591482c2f7f33c37515214084c708a061cedce5d0575f20a1fd63bc642b53b7a3a223785640ae7b8736a40ee9de5a0ab30828b0b2d4c27e40f5187f2f38ecfb7
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 1.24.0 - February 18, 2025
|
2
|
+
|
3
|
+
- Fix validation for SE IBANs where the account number starts with a 0 and the clearing number is not included in the IBAN
|
4
|
+
|
5
|
+
## 1.23.0 - February 14, 2025
|
6
|
+
|
7
|
+
- Fix validation for SE IBANs for clearing code 3300 where the account number starts with a 0
|
8
|
+
|
1
9
|
## 1.22.0 - January 22, 2025
|
2
10
|
|
3
11
|
- Remove support for Ruby < 3.1, add support for Ruby >= 3.4
|
@@ -5,6 +5,8 @@
|
|
5
5
|
# - As of 30/10/2020: https://www.bankgirot.se/globalassets/dokument/anvandarmanualer/bankernaskontonummeruppbyggnad_anvandarmanual_sv.pdf
|
6
6
|
# - Swedish Bankers' Association clearing numbers: https://www.swedishbankers.se/media/4245/1906_clearingnummer-institut.pdf
|
7
7
|
# - https://transferwise.com/gb/iban/sweden
|
8
|
+
# - Bankgirot: https://www.bankgirot.se/globalassets/dokument/anvandarmanualer/bankernaskontonummeruppbyggnad_anvandarmanual_sv.pdf
|
9
|
+
# - Svensk betalinfrastruktur: https://www.bankinfrastruktur.se/framtidens-betalningsinfrastruktur/iban-och-svenskt-nationellt-kontonummer
|
8
10
|
#
|
9
11
|
# Fields:
|
10
12
|
# - Range: The range of clearing codes for this bank. Used to
|
@@ -79,6 +81,7 @@
|
|
79
81
|
:bank: Nordea Personkonto
|
80
82
|
# NOTE: We're routing Nordea Personkonto to the main Nordea bank code, but
|
81
83
|
# it may belong at one of the other Nordea codes we're not currently using.
|
84
|
+
# Account numbers for this clearing number are the same as personal ID numbers.
|
82
85
|
:bank_code: 300
|
83
86
|
:clearing_code_length: 4
|
84
87
|
:serial_number_length: 10
|
@@ -117,7 +120,7 @@
|
|
117
120
|
:clearing_code_length: 4
|
118
121
|
:serial_number_length: 10
|
119
122
|
:zerofill_serial_number: false
|
120
|
-
:include_clearing_code:
|
123
|
+
:include_clearing_code: false
|
121
124
|
:validation_scheme: '2.1'
|
122
125
|
- :range: [3783, 3999]
|
123
126
|
:bank: Nordea
|
@@ -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,74 @@ 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
|
+
|
187
|
+
context "and the clearing code is not part of the IBAN" do
|
188
|
+
context "and the branch code allows for zero-filling of short account numbers" do
|
189
|
+
let(:arg) do
|
190
|
+
{
|
191
|
+
country_code: "SE",
|
192
|
+
branch_code: "6000",
|
193
|
+
account_number: "1234567",
|
194
|
+
}
|
195
|
+
end
|
196
|
+
|
197
|
+
its(:country_code) { is_expected.to eq("SE") }
|
198
|
+
its(:bank_code) { is_expected.to be_nil }
|
199
|
+
its(:branch_code) { is_expected.to eq("6000") }
|
200
|
+
its(:account_number) { is_expected.to eq("001234567") }
|
201
|
+
its(:swift_bank_code) { is_expected.to eq("600") }
|
202
|
+
its(:swift_branch_code) { is_expected.to be_nil }
|
203
|
+
its(:swift_account_number) { is_expected.to eq("00000000001234567") }
|
204
|
+
its(:iban) { is_expected.to eq("SE2260000000000001234567") }
|
205
|
+
its(:pseudo_iban) { is_expected.to eq("SEZZX6000X001234567") }
|
206
|
+
its(:to_s) { is_expected.to eq("SE2260000000000001234567") }
|
207
|
+
its(:valid?) { is_expected.to eq(true) }
|
208
|
+
end
|
209
|
+
|
210
|
+
context "and the branch code does not allow for zero-filling of short account numbers" do
|
211
|
+
let(:arg) do
|
212
|
+
{
|
213
|
+
country_code: "SE",
|
214
|
+
branch_code: "3300",
|
215
|
+
account_number: "1234567",
|
216
|
+
}
|
217
|
+
end
|
218
|
+
|
219
|
+
its(:country_code) { is_expected.to eq("SE") }
|
220
|
+
its(:bank_code) { is_expected.to be_nil }
|
221
|
+
its(:branch_code) { is_expected.to eq("3300") }
|
222
|
+
its(:account_number) { is_expected.to eq("1234567") }
|
223
|
+
its(:swift_bank_code) { is_expected.to eq("300") }
|
224
|
+
its(:swift_branch_code) { is_expected.to be_nil }
|
225
|
+
its(:swift_account_number) { is_expected.to eq("00000000001234567") }
|
226
|
+
its(:iban) { is_expected.to eq("SE4130000000000001234567") }
|
227
|
+
its(:pseudo_iban) { is_expected.to eq("SEZZX3300XXX1234567") }
|
228
|
+
its(:to_s) { is_expected.to eq("SE4130000000000001234567") }
|
229
|
+
its(:valid?) { is_expected.to eq(false) }
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
context "and the clearing code is part of the IBAN" do
|
234
|
+
let(:arg) do
|
235
|
+
{
|
236
|
+
country_code: "SE",
|
237
|
+
branch_code: "3410",
|
238
|
+
account_number: "1234567",
|
239
|
+
}
|
240
|
+
end
|
241
|
+
|
242
|
+
its(:country_code) { is_expected.to eq("SE") }
|
243
|
+
its(:bank_code) { is_expected.to be_nil }
|
244
|
+
its(:branch_code) { is_expected.to eq("3410") }
|
245
|
+
its(:account_number) { is_expected.to eq("1234567") }
|
246
|
+
its(:swift_bank_code) { is_expected.to eq("300") }
|
247
|
+
its(:swift_branch_code) { is_expected.to be_nil }
|
248
|
+
its(:swift_account_number) { is_expected.to eq("00000034101234567") }
|
249
|
+
its(:iban) { is_expected.to eq("SE1030000000034101234567") }
|
250
|
+
its(:pseudo_iban) { is_expected.to eq("SEZZX3410XXX1234567") }
|
251
|
+
its(:to_s) { is_expected.to eq("SE1030000000034101234567") }
|
252
|
+
its(:valid?) { is_expected.to eq(true) }
|
253
|
+
end
|
186
254
|
end
|
187
255
|
|
188
256
|
context "when the IBAN was created from a pseudo-IBAN" do
|
@@ -200,6 +268,90 @@ describe Ibandit::IBAN do
|
|
200
268
|
its(:to_s) { is_expected.to eq("SE5412000000012810105723") }
|
201
269
|
end
|
202
270
|
|
271
|
+
context "when the IBAN was created from a Swedish IBAN" do
|
272
|
+
context "where the clearing code is part of the account number" do
|
273
|
+
let(:arg) { "SE4730000000031231234567" }
|
274
|
+
|
275
|
+
its(:country_code) { is_expected.to eq("SE") }
|
276
|
+
its(:bank_code) { is_expected.to be_nil }
|
277
|
+
its(:branch_code) { is_expected.to be_nil }
|
278
|
+
its(:account_number) { is_expected.to be_nil }
|
279
|
+
its(:swift_bank_code) { is_expected.to eq("300") }
|
280
|
+
its(:swift_branch_code) { is_expected.to be_nil }
|
281
|
+
its(:swift_account_number) { is_expected.to eq("00000031231234567") }
|
282
|
+
its(:iban) { is_expected.to eq("SE4730000000031231234567") }
|
283
|
+
its(:pseudo_iban) { is_expected.to be_nil }
|
284
|
+
its(:to_s) { is_expected.to eq("SE4730000000031231234567") }
|
285
|
+
its(:valid?) { is_expected.to eq(true) }
|
286
|
+
end
|
287
|
+
|
288
|
+
context "where the clearing code is not part of the account number" do
|
289
|
+
let(:arg) { "SE7160000000000123456789" }
|
290
|
+
|
291
|
+
its(:country_code) { is_expected.to eq("SE") }
|
292
|
+
its(:bank_code) { is_expected.to be_nil }
|
293
|
+
its(:branch_code) { is_expected.to be_nil }
|
294
|
+
its(:account_number) { is_expected.to be_nil }
|
295
|
+
its(:swift_bank_code) { is_expected.to eq("600") }
|
296
|
+
its(:swift_branch_code) { is_expected.to be_nil }
|
297
|
+
its(:swift_account_number) { is_expected.to eq("00000000123456789") }
|
298
|
+
its(:iban) { is_expected.to eq("SE7160000000000123456789") }
|
299
|
+
its(:pseudo_iban) { is_expected.to be_nil }
|
300
|
+
its(:to_s) { is_expected.to eq("SE7160000000000123456789") }
|
301
|
+
its(:valid?) { is_expected.to eq(true) }
|
302
|
+
end
|
303
|
+
|
304
|
+
context "where the clearing code is 3300, and therefore the account number is the national ID" do
|
305
|
+
context "where the person was born in the 1990s" do
|
306
|
+
let(:arg) { "SE2130000000009308127392" }
|
307
|
+
|
308
|
+
its(:country_code) { is_expected.to eq("SE") }
|
309
|
+
its(:bank_code) { is_expected.to be_nil }
|
310
|
+
its(:branch_code) { is_expected.to be_nil }
|
311
|
+
its(:account_number) { is_expected.to be_nil }
|
312
|
+
its(:swift_bank_code) { is_expected.to eq("300") }
|
313
|
+
its(:swift_branch_code) { is_expected.to be_nil }
|
314
|
+
its(:swift_account_number) { is_expected.to eq("00000009308127392") }
|
315
|
+
its(:iban) { is_expected.to eq("SE2130000000009308127392") }
|
316
|
+
its(:pseudo_iban) { is_expected.to be_nil }
|
317
|
+
its(:to_s) { is_expected.to eq("SE2130000000009308127392") }
|
318
|
+
its(:valid?) { is_expected.to eq(true) }
|
319
|
+
end
|
320
|
+
|
321
|
+
context "where the person was born in the 2000s" do
|
322
|
+
let(:arg) { "SE9430000000000607274287" }
|
323
|
+
|
324
|
+
its(:country_code) { is_expected.to eq("SE") }
|
325
|
+
its(:bank_code) { is_expected.to be_nil }
|
326
|
+
its(:branch_code) { is_expected.to be_nil }
|
327
|
+
its(:account_number) { is_expected.to be_nil }
|
328
|
+
its(:swift_bank_code) { is_expected.to eq("300") }
|
329
|
+
its(:swift_branch_code) { is_expected.to be_nil }
|
330
|
+
its(:swift_account_number) { is_expected.to eq("00000000607274287") }
|
331
|
+
its(:iban) { is_expected.to eq("SE9430000000000607274287") }
|
332
|
+
its(:pseudo_iban) { is_expected.to be_nil }
|
333
|
+
its(:to_s) { is_expected.to eq("SE9430000000000607274287") }
|
334
|
+
its(:valid?) { is_expected.to eq(true) }
|
335
|
+
end
|
336
|
+
|
337
|
+
context "where the person was born in the year 2000" do
|
338
|
+
let(:arg) { "SE3830000000000007134937" }
|
339
|
+
|
340
|
+
its(:country_code) { is_expected.to eq("SE") }
|
341
|
+
its(:bank_code) { is_expected.to be_nil }
|
342
|
+
its(:branch_code) { is_expected.to be_nil }
|
343
|
+
its(:account_number) { is_expected.to be_nil }
|
344
|
+
its(:swift_bank_code) { is_expected.to eq("300") }
|
345
|
+
its(:swift_branch_code) { is_expected.to be_nil }
|
346
|
+
its(:swift_account_number) { is_expected.to eq("00000000007134937") }
|
347
|
+
its(:iban) { is_expected.to eq("SE3830000000000007134937") }
|
348
|
+
its(:pseudo_iban) { is_expected.to be_nil }
|
349
|
+
its(:to_s) { is_expected.to eq("SE3830000000000007134937") }
|
350
|
+
its(:valid?) { is_expected.to eq(true) }
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
203
355
|
context "when the IBAN was created with local details for Australia" do
|
204
356
|
let(:arg) do
|
205
357
|
{
|
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.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoCardless
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-02-18 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: i18n
|