ibandit 1.22.0 → 1.23.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: faf16b69bbbfe2f9e23af48f06e9ef798078f052007d85cd8ab58830f4d89876
4
- data.tar.gz: 2555633561836b3f6d4ed7872f8c3d7ea1f59515fa9b8c1ba203e102666f02e8
3
+ metadata.gz: f204241b08b7d0ea68f567e7a19732be27c58f5a0f7a275ee3c6fb053435e382
4
+ data.tar.gz: 1e38162054ba85caea8f21aec08545f7ea0906475911ff3e08d5300b6aa1f1d8
5
5
  SHA512:
6
- metadata.gz: 2765fcfbd6a091459893507ba8735d2e56b6375b655a0078fd38f5fc1ab70be59b216359f2d2eb9670e753615ecbf5e701cac1d226de35f19312a34b972053d9
7
- data.tar.gz: 417c2114fe7ce1734374bff18b83981cea03f4de9a4b6db1c9428f9b4455ab6a13cb724a8f6bb85bc06bf8e9d59df8f0e8e2eea49a448478fabc7f385a51bd30
6
+ metadata.gz: 813b2693616e4479ff87b66e9e6818fced084999f4082a2df05eb66d024e19693f3cecda440c138e706d0e2798950d957cf88d18a2b39565f13544263b9863b5
7
+ data.tar.gz: 277e44e26604e9ae6b4708c43e8d153e9ef2fdd73a38a0dec2babdf30c1d6ecab917786d13aacccfb6e70ad654097ac6976bada55aa23c4282c5d862efa21c00
data/.gitignore CHANGED
@@ -2,3 +2,4 @@ Gemfile.lock
2
2
  .bundle
3
3
  *.gem
4
4
  .DS_Store
5
+ .idea
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.23.0 - February 14, 2025
2
+
3
+ - Fix validation for SE IBANs for clearing code 3300 where the account number starts with a 0
4
+
1
5
  ## 1.22.0 - January 22, 2025
2
6
 
3
7
  - 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,10 +81,11 @@
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
85
- :zerofill_serial_number: false
88
+ :zerofill_serial_number: true
86
89
  :include_clearing_code: false
87
90
  :validation_scheme: '2.1'
88
91
  - :range: [3301, 3399]
@@ -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: fase
123
+ :include_clearing_code: false
121
124
  :validation_scheme: '2.1'
122
125
  - :range: [3783, 3999]
123
126
  :bank: Nordea
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ibandit
4
- VERSION = "1.22.0"
4
+ VERSION = "1.23.0"
5
5
  end
@@ -200,6 +200,90 @@ describe Ibandit::IBAN do
200
200
  its(:to_s) { is_expected.to eq("SE5412000000012810105723") }
201
201
  end
202
202
 
203
+ context "when the IBAN was created from a Swedish IBAN" do
204
+ context "where the clearing code is part of the account number" do
205
+ let(:arg) { "SE4730000000031231234567" }
206
+
207
+ its(:country_code) { is_expected.to eq("SE") }
208
+ its(:bank_code) { is_expected.to be_nil }
209
+ its(:branch_code) { is_expected.to be_nil }
210
+ its(:account_number) { is_expected.to be_nil }
211
+ its(:swift_bank_code) { is_expected.to eq("300") }
212
+ its(:swift_branch_code) { is_expected.to be_nil }
213
+ its(:swift_account_number) { is_expected.to eq("00000031231234567") }
214
+ its(:iban) { is_expected.to eq("SE4730000000031231234567") }
215
+ its(:pseudo_iban) { is_expected.to be_nil }
216
+ its(:to_s) { is_expected.to eq("SE4730000000031231234567") }
217
+ its(:valid?) { is_expected.to eq(true) }
218
+ end
219
+
220
+ context "where the clearing code is not part of the account number" do
221
+ let(:arg) { "SE7160000000000123456789" }
222
+
223
+ its(:country_code) { is_expected.to eq("SE") }
224
+ its(:bank_code) { is_expected.to be_nil }
225
+ its(:branch_code) { is_expected.to be_nil }
226
+ its(:account_number) { is_expected.to be_nil }
227
+ its(:swift_bank_code) { is_expected.to eq("600") }
228
+ its(:swift_branch_code) { is_expected.to be_nil }
229
+ its(:swift_account_number) { is_expected.to eq("00000000123456789") }
230
+ its(:iban) { is_expected.to eq("SE7160000000000123456789") }
231
+ its(:pseudo_iban) { is_expected.to be_nil }
232
+ its(:to_s) { is_expected.to eq("SE7160000000000123456789") }
233
+ its(:valid?) { is_expected.to eq(true) }
234
+ end
235
+
236
+ context "where the clearing code is 3300, and therefore the account number is the national ID" do
237
+ context "where the person was born in the 1990s" do
238
+ let(:arg) { "SE2130000000009308127392" }
239
+
240
+ its(:country_code) { is_expected.to eq("SE") }
241
+ its(:bank_code) { is_expected.to be_nil }
242
+ its(:branch_code) { is_expected.to be_nil }
243
+ its(:account_number) { is_expected.to be_nil }
244
+ its(:swift_bank_code) { is_expected.to eq("300") }
245
+ its(:swift_branch_code) { is_expected.to be_nil }
246
+ its(:swift_account_number) { is_expected.to eq("00000009308127392") }
247
+ its(:iban) { is_expected.to eq("SE2130000000009308127392") }
248
+ its(:pseudo_iban) { is_expected.to be_nil }
249
+ its(:to_s) { is_expected.to eq("SE2130000000009308127392") }
250
+ its(:valid?) { is_expected.to eq(true) }
251
+ end
252
+
253
+ context "where the person was born in the 2000s" do
254
+ let(:arg) { "SE9430000000000607274287" }
255
+
256
+ its(:country_code) { is_expected.to eq("SE") }
257
+ its(:bank_code) { is_expected.to be_nil }
258
+ its(:branch_code) { is_expected.to be_nil }
259
+ its(:account_number) { is_expected.to be_nil }
260
+ its(:swift_bank_code) { is_expected.to eq("300") }
261
+ its(:swift_branch_code) { is_expected.to be_nil }
262
+ its(:swift_account_number) { is_expected.to eq("00000000607274287") }
263
+ its(:iban) { is_expected.to eq("SE9430000000000607274287") }
264
+ its(:pseudo_iban) { is_expected.to be_nil }
265
+ its(:to_s) { is_expected.to eq("SE9430000000000607274287") }
266
+ its(:valid?) { is_expected.to eq(true) }
267
+ end
268
+
269
+ context "where the person was born in the year 2000" do
270
+ let(:arg) { "SE3830000000000007134937" }
271
+
272
+ its(:country_code) { is_expected.to eq("SE") }
273
+ its(:bank_code) { is_expected.to be_nil }
274
+ its(:branch_code) { is_expected.to be_nil }
275
+ its(:account_number) { is_expected.to be_nil }
276
+ its(:swift_bank_code) { is_expected.to eq("300") }
277
+ its(:swift_branch_code) { is_expected.to be_nil }
278
+ its(:swift_account_number) { is_expected.to eq("00000000007134937") }
279
+ its(:iban) { is_expected.to eq("SE3830000000000007134937") }
280
+ its(:pseudo_iban) { is_expected.to be_nil }
281
+ its(:to_s) { is_expected.to eq("SE3830000000000007134937") }
282
+ its(:valid?) { is_expected.to eq(true) }
283
+ end
284
+ end
285
+ end
286
+
203
287
  context "when the IBAN was created with local details for Australia" do
204
288
  let(:arg) do
205
289
  {
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.22.0
4
+ version: 1.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-23 00:00:00.000000000 Z
10
+ date: 2025-02-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: i18n