ibandit 1.23.0 → 1.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/data/raw/swedish_bank_lookup.yml +1 -1
- data/lib/ibandit/sweden/validator.rb +1 -1
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/iban_spec.rb +68 -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/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
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
|
+
|
1
5
|
## 1.23.0 - February 14, 2025
|
2
6
|
|
3
7
|
- Fix validation for SE IBANs for clearing code 3300 where the account number starts with a 0
|
@@ -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
|
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-02-
|
10
|
+
date: 2025-02-18 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: i18n
|