ibandit 1.20.0 → 1.21.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 +5 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +1 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +3 -2
- data/config/locales/fr.yml +1 -0
- data/config/locales/it.yml +2 -2
- data/config/locales/nb.yml +1 -0
- data/config/locales/nl.yml +1 -0
- data/config/locales/pt.yml +1 -0
- data/config/locales/sl.yml +1 -0
- data/config/locales/sv.yml +1 -0
- data/data/raw/pseudo_ibans.yml +5 -2
- data/data/structures.yml +5 -2
- data/ibandit.gemspec +1 -1
- data/lib/ibandit/iban.rb +21 -13
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/iban_spec.rb +5 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37a15fbc4242dda50e51d295ef5e37e6ee692d5f91d43d32842c2df570213e82
|
4
|
+
data.tar.gz: db530699e09d54603f27cbee4c4d6e9f254e89557ce1c41ac0cbfb8e82a58e90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a9b288596e9bddae7eab282e12f20a650bdbc74016240f56f4a7a34fa9628885070b276ac079d149a146a4cd0ac68ceb58923001edb40159bd368637b1534d2
|
7
|
+
data.tar.gz: '08f3f363786871a019ebe9122d1b9fe96893823811a9578d25a652757a01d8b4e9904ae4ecf32542a2ddb856894486816429a97f65ecd7bc450158c0924de475'
|
data/CHANGELOG.md
CHANGED
data/config/locales/da.yml
CHANGED
data/config/locales/de.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
es:
|
2
2
|
ibandit:
|
3
|
-
invalid_country_code: "
|
4
|
-
invalid_check_digits:
|
3
|
+
invalid_country_code: '"%{country_code}" no es un código de país IBAN ISO 3166-1 válido'
|
4
|
+
invalid_check_digits: 'Los dígitos de verificación han generado un error en la comprobación del módulo. Se esperaba "%{expected_check_digits}", pero se ha recibido "%{check_digits}".'
|
5
5
|
invalid_length: "La longitud no coincide con la especificación SWIFT (se esperaban %{expected_length} caracteres, pero se han recibido %{length})"
|
6
6
|
is_required: "es obligatorio"
|
7
7
|
wrong_length: "no tiene la longitud correcta (debe tener %{expected} caracteres)"
|
@@ -17,3 +17,4 @@ es:
|
|
17
17
|
bank_code_does_not_exist: "codigo bancario inexistente"
|
18
18
|
has_invalid_clearing_code_length: "codigo de oficina de oficina de compensación invalido"
|
19
19
|
has_invalid_serial_number: "número de serie invalido"
|
20
|
+
branch_code_does_not_exist: "código de sucursal no existe"
|
data/config/locales/fr.yml
CHANGED
@@ -17,3 +17,4 @@ fr:
|
|
17
17
|
bank_code_does_not_exist: "le code de la banque n'existe pas"
|
18
18
|
has_invalid_clearing_code_length: "la longueur du clearing code n'est pas valide"
|
19
19
|
has_invalid_serial_number: "le numéro de série n'est pas valide"
|
20
|
+
branch_code_does_not_exist: "le code de la succursale n'existe pas"
|
data/config/locales/it.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
it:
|
2
2
|
ibandit:
|
3
|
-
invalid_country_code: "
|
3
|
+
invalid_country_code: '"%{country_code}" non è un codice di paese IBAN 3166-1 valido'
|
4
4
|
invalid_check_digits: "Controllo del modulo non riuscito per i caratteri. %{expected_check_digits} caratteri previsti, %{check_digits} immessi."
|
5
5
|
invalid_length: "La lunghezza non corrisponde alla specifica SWIFT (%{expected_length} caratteri previsti, %{length} immessi)"
|
6
6
|
is_required: "è obbligatorio"
|
@@ -17,4 +17,4 @@ it:
|
|
17
17
|
bank_code_does_not_exist: "codice banca inesistente"
|
18
18
|
has_invalid_clearing_code_length: "lunghezza clearing code non valida"
|
19
19
|
has_invalid_serial_number: "numero di serie non valido"
|
20
|
-
|
20
|
+
branch_code_does_not_exist: "codice filiale non esiste"
|
data/config/locales/nb.yml
CHANGED
data/config/locales/nl.yml
CHANGED
data/config/locales/pt.yml
CHANGED
@@ -17,3 +17,4 @@ pt:
|
|
17
17
|
bank_code_does_not_exist: "o código do banco não existe"
|
18
18
|
has_invalid_clearing_code_length: "o comprimento do código de libertação é inválido"
|
19
19
|
has_invalid_serial_number: "o número de série é inválido"
|
20
|
+
branch_code_does_not_exist: "código da filial não existe"
|
data/config/locales/sl.yml
CHANGED
data/config/locales/sv.yml
CHANGED
data/data/raw/pseudo_ibans.yml
CHANGED
@@ -13,13 +13,16 @@ AU:
|
|
13
13
|
:pseudo_iban_account_number_length: 10
|
14
14
|
:national_id_length: 6
|
15
15
|
CA:
|
16
|
-
:bank_code_length:
|
16
|
+
:bank_code_length: !ruby/range
|
17
|
+
begin: 3
|
18
|
+
end: 4
|
19
|
+
excl: false
|
17
20
|
:branch_code_length: 5
|
18
21
|
:account_number_length: !ruby/range
|
19
22
|
begin: 7
|
20
23
|
end: 12
|
21
24
|
excl: false
|
22
|
-
:bank_code_format: "\\d{4}"
|
25
|
+
:bank_code_format: "\\d{3,4}"
|
23
26
|
:branch_code_format: "0{0,4}[1-9][0-9]{0,4}"
|
24
27
|
:account_number_format: "(?!0+\\z)\\d{7,12}"
|
25
28
|
:national_id_length: 9
|
data/data/structures.yml
CHANGED
@@ -1493,13 +1493,16 @@ AU:
|
|
1493
1493
|
:pseudo_iban_account_number_length: 10
|
1494
1494
|
:national_id_length: 6
|
1495
1495
|
CA:
|
1496
|
-
:bank_code_length:
|
1496
|
+
:bank_code_length: !ruby/range
|
1497
|
+
begin: 3
|
1498
|
+
end: 4
|
1499
|
+
excl: false
|
1497
1500
|
:branch_code_length: 5
|
1498
1501
|
:account_number_length: !ruby/range
|
1499
1502
|
begin: 7
|
1500
1503
|
end: 12
|
1501
1504
|
excl: false
|
1502
|
-
:bank_code_format: "\\d{4}"
|
1505
|
+
:bank_code_format: "\\d{3,4}"
|
1503
1506
|
:branch_code_format: 0{0,4}[1-9][0-9]{0,4}
|
1504
1507
|
:account_number_format: "(?!0+\\z)\\d{7,12}"
|
1505
1508
|
:national_id_length: 9
|
data/ibandit.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
29
|
spec.required_ruby_version = ">= 2.7.0"
|
30
|
-
spec.add_development_dependency "gc_ruboconfig", "~>
|
30
|
+
spec.add_development_dependency "gc_ruboconfig", "~> 5.0"
|
31
31
|
spec.add_development_dependency "nokogiri", "~> 1.6"
|
32
32
|
spec.add_development_dependency "pry", "~> 0.13"
|
33
33
|
spec.add_development_dependency "pry-byebug", "~> 3.10"
|
data/lib/ibandit/iban.rb
CHANGED
@@ -158,14 +158,17 @@ module Ibandit
|
|
158
158
|
|
159
159
|
def valid_bank_code_length?
|
160
160
|
return unless valid_country_code?
|
161
|
-
|
161
|
+
if structure[:bank_code_length].is_a?(Integer) && structure[:bank_code_length].zero?
|
162
|
+
return true
|
163
|
+
end
|
162
164
|
|
163
165
|
if swift_bank_code.nil? || swift_bank_code.empty?
|
164
166
|
@errors[:bank_code] = Ibandit.translate(:is_required)
|
165
167
|
return false
|
166
168
|
end
|
167
169
|
|
168
|
-
return true if
|
170
|
+
return true if valid_input_length?(structure[:bank_code_length],
|
171
|
+
swift_bank_code.length)
|
169
172
|
|
170
173
|
@errors[:bank_code] =
|
171
174
|
Ibandit.translate(:wrong_length, expected: structure[:bank_code_length])
|
@@ -197,14 +200,8 @@ module Ibandit
|
|
197
200
|
return false
|
198
201
|
end
|
199
202
|
|
200
|
-
|
201
|
-
|
202
|
-
if structure[:account_number_length].include?(swift_account_number.length)
|
203
|
-
return true
|
204
|
-
end
|
205
|
-
else
|
206
|
-
return true if swift_account_number.length == structure[:account_number_length]
|
207
|
-
end
|
203
|
+
return true if valid_input_length?(structure[:account_number_length],
|
204
|
+
swift_account_number.length)
|
208
205
|
|
209
206
|
@errors[:account_number] =
|
210
207
|
Ibandit.translate(:wrong_length,
|
@@ -240,7 +237,9 @@ module Ibandit
|
|
240
237
|
|
241
238
|
def valid_bank_code_format?
|
242
239
|
return unless valid_bank_code_length?
|
243
|
-
|
240
|
+
if structure[:bank_code_length].is_a?(Integer) && structure[:bank_code_length].zero?
|
241
|
+
return true
|
242
|
+
end
|
244
243
|
|
245
244
|
if swift_bank_code&.match?(
|
246
245
|
entire_string_regex(structure[:bank_code_format]),
|
@@ -509,17 +508,26 @@ module Ibandit
|
|
509
508
|
iban.to_s.gsub(/(.{4})/, '\1 ').strip
|
510
509
|
end
|
511
510
|
|
511
|
+
def valid_input_length?(allowed_length, input_length)
|
512
|
+
case allowed_length
|
513
|
+
when Range
|
514
|
+
allowed_length.include?(input_length)
|
515
|
+
else
|
516
|
+
allowed_length == input_length
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
512
520
|
def valid_modulus_check_bank_code?
|
513
521
|
return true if Ibandit.modulus_checker.valid_bank_code?(self)
|
514
522
|
|
515
|
-
@errors[:bank_code] = Ibandit.translate(:
|
523
|
+
@errors[:bank_code] = Ibandit.translate(:bank_code_does_not_exist)
|
516
524
|
false
|
517
525
|
end
|
518
526
|
|
519
527
|
def valid_modulus_check_branch_code?
|
520
528
|
return true if Ibandit.modulus_checker.valid_branch_code?(self)
|
521
529
|
|
522
|
-
@errors[:branch_code] = Ibandit.translate(:
|
530
|
+
@errors[:branch_code] = Ibandit.translate(:branch_code_does_not_exist)
|
523
531
|
false
|
524
532
|
end
|
525
533
|
|
data/lib/ibandit/version.rb
CHANGED
data/spec/ibandit/iban_spec.rb
CHANGED
@@ -1341,7 +1341,7 @@ describe Ibandit::IBAN do
|
|
1341
1341
|
it { is_expected.to be(false) }
|
1342
1342
|
|
1343
1343
|
it "sets the errors on the IBAN" do
|
1344
|
-
expect(iban.errors).to include(bank_code: "
|
1344
|
+
expect(iban.errors).to include(bank_code: "bank code does not exist")
|
1345
1345
|
end
|
1346
1346
|
end
|
1347
1347
|
|
@@ -1368,7 +1368,7 @@ describe Ibandit::IBAN do
|
|
1368
1368
|
it { is_expected.to be(false) }
|
1369
1369
|
|
1370
1370
|
it "sets the errors on the IBAN" do
|
1371
|
-
expect(iban.errors).to include(branch_code: "
|
1371
|
+
expect(iban.errors).to include(branch_code: "branch code does not exist")
|
1372
1372
|
end
|
1373
1373
|
end
|
1374
1374
|
|
@@ -1581,7 +1581,7 @@ describe Ibandit::IBAN do
|
|
1581
1581
|
it { is_expected.to be(false) }
|
1582
1582
|
|
1583
1583
|
it "sets the errors on the IBAN" do
|
1584
|
-
expect(iban.errors).to include(branch_code: "
|
1584
|
+
expect(iban.errors).to include(branch_code: "branch code does not exist")
|
1585
1585
|
end
|
1586
1586
|
end
|
1587
1587
|
end
|
@@ -1646,7 +1646,7 @@ describe Ibandit::IBAN do
|
|
1646
1646
|
it { is_expected.to be(false) }
|
1647
1647
|
|
1648
1648
|
it "sets the errors on the IBAN" do
|
1649
|
-
expect(iban.errors).to include(branch_code: "
|
1649
|
+
expect(iban.errors).to include(branch_code: "branch code does not exist")
|
1650
1650
|
end
|
1651
1651
|
end
|
1652
1652
|
end
|
@@ -1711,7 +1711,7 @@ describe Ibandit::IBAN do
|
|
1711
1711
|
it { is_expected.to be(false) }
|
1712
1712
|
|
1713
1713
|
it "sets the errors on the IBAN" do
|
1714
|
-
expect(iban.errors).to include(branch_code: "
|
1714
|
+
expect(iban.errors).to include(branch_code: "branch code does not exist")
|
1715
1715
|
end
|
1716
1716
|
end
|
1717
1717
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibandit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoCardless
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gc_ruboconfig
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|