ibandit 1.20.0 → 1.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +1 -1
- data/.rubocop.yml +2 -48
- data/.rubocop_todo.yml +27 -35
- data/.ruby-version +1 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile +10 -0
- data/bin/build_german_iban_rules.rb +26 -24
- 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/german_iban_rules.yml +38 -92
- data/data/raw/BLZ2.xml +1 -0
- data/data/raw/IBANSTRUCTURE.xml +105 -9
- data/data/raw/IBAN_Registry.txt +52 -51
- data/data/raw/pseudo_ibans.yml +5 -2
- data/data/raw/structure_additions.yml +18 -11
- data/data/structures.yml +97 -11
- data/ibandit.gemspec +1 -8
- data/lib/ibandit/iban.rb +29 -25
- data/lib/ibandit/sweden/bank_lookup.rb +1 -1
- data/lib/ibandit/version.rb +1 -1
- data/lib/ibandit.rb +2 -4
- data/spec/ibandit/iban_assembler_spec.rb +26 -22
- data/spec/ibandit/iban_spec.rb +61 -21
- metadata +4 -105
- data/data/raw/BLZ2.txt +0 -14692
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faf16b69bbbfe2f9e23af48f06e9ef798078f052007d85cd8ab58830f4d89876
|
4
|
+
data.tar.gz: 2555633561836b3f6d4ed7872f8c3d7ea1f59515fa9b8c1ba203e102666f02e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2765fcfbd6a091459893507ba8735d2e56b6375b655a0078fd38f5fc1ab70be59b216359f2d2eb9670e753615ecbf5e701cac1d226de35f19312a34b972053d9
|
7
|
+
data.tar.gz: 417c2114fe7ce1734374bff18b83981cea03f4de9a4b6db1c9428f9b4455ab6a13cb724a8f6bb85bc06bf8e9d59df8f0e8e2eea49a448478fabc7f385a51bd30
|
data/.github/workflows/tests.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,54 +1,8 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
|
+
|
2
3
|
inherit_gem:
|
3
4
|
gc_ruboconfig: rubocop.yml
|
4
|
-
require: rubocop-rails
|
5
5
|
|
6
6
|
AllCops:
|
7
7
|
TargetRubyVersion: 3.2
|
8
|
-
|
9
|
-
# Limit lines to 90 characters.
|
10
|
-
Layout/LineLength:
|
11
|
-
Max: 90
|
12
|
-
|
13
|
-
Metrics/ClassLength:
|
14
|
-
Max: 400
|
15
|
-
|
16
|
-
# Avoid single-line methods.
|
17
|
-
Style/SingleLineMethods:
|
18
|
-
AllowIfMethodIsEmpty: true
|
19
|
-
|
20
|
-
# Wants underscores in all large numbers. Pain in the ass for things like
|
21
|
-
# unix timestamps.
|
22
|
-
Style/NumericLiterals:
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
# Wants you to use the same argument names for every reduce. This seems kinda
|
26
|
-
# naff compared to naming them semantically
|
27
|
-
Style/SingleLineBlockParams:
|
28
|
-
Enabled: false
|
29
|
-
|
30
|
-
Style/SignalException:
|
31
|
-
EnforcedStyle: 'only_raise'
|
32
|
-
|
33
|
-
# Wants to exclude accents from comments
|
34
|
-
Style/AsciiComments:
|
35
|
-
Enabled: false
|
36
|
-
|
37
|
-
# Configuration parameters: CountComments.
|
38
|
-
Metrics/MethodLength:
|
39
|
-
Max: 25
|
40
|
-
|
41
|
-
# Configuration parameters: CountComments.
|
42
|
-
Metrics/ModuleLength:
|
43
|
-
Max: 400
|
44
|
-
|
45
|
-
Layout/DotPosition:
|
46
|
-
EnforcedStyle: 'trailing'
|
47
|
-
|
48
|
-
# Wants to to lock to Ruby 2.4 as specified here but as this is a public gem
|
49
|
-
# this is quite aggressive.
|
50
|
-
Gemspec/RequiredRubyVersion:
|
51
|
-
Enabled: false
|
52
|
-
|
53
|
-
Rails/Blank:
|
54
|
-
Enabled: false
|
8
|
+
NewCops: enable
|
data/.rubocop_todo.yml
CHANGED
@@ -1,77 +1,69 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2025-01-23 15:25:02 UTC using RuboCop version 1.71.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
10
|
-
# Configuration parameters:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# Configuration parameters: IgnoredMethods.
|
16
|
-
Metrics/CyclomaticComplexity:
|
17
|
-
Max: 8
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: Severity, Include.
|
11
|
+
# Include: **/*.gemspec
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'ibandit.gemspec'
|
18
15
|
|
19
16
|
# Offense count: 1
|
20
|
-
# Configuration parameters:
|
21
|
-
|
22
|
-
Naming/MemoizedInstanceVariableName:
|
17
|
+
# Configuration parameters: LengthThreshold.
|
18
|
+
Metrics/CollectionLiteralLength:
|
23
19
|
Exclude:
|
24
|
-
- 'lib/ibandit/
|
20
|
+
- 'lib/ibandit/german_details_converter.rb'
|
25
21
|
|
26
22
|
# Offense count: 1
|
27
23
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
28
|
-
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
|
24
|
+
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
|
29
25
|
Naming/MethodParameterName:
|
30
26
|
Exclude:
|
31
27
|
- 'lib/ibandit/german_details_converter.rb'
|
32
28
|
|
33
29
|
# Offense count: 1
|
30
|
+
# Configuration parameters: IgnoredMetadata.
|
34
31
|
RSpec/DescribeClass:
|
35
32
|
Exclude:
|
33
|
+
- '**/spec/features/**/*'
|
34
|
+
- '**/spec/requests/**/*'
|
35
|
+
- '**/spec/routing/**/*'
|
36
|
+
- '**/spec/system/**/*'
|
37
|
+
- '**/spec/views/**/*'
|
36
38
|
- 'spec/ibandit/structure_spec.rb'
|
37
39
|
|
38
40
|
# Offense count: 1
|
39
|
-
# Configuration parameters:
|
41
|
+
# Configuration parameters: CountAsOne.
|
40
42
|
RSpec/ExampleLength:
|
41
|
-
|
42
|
-
- 'spec/ibandit/iban_spec.rb'
|
43
|
+
Max: 6
|
43
44
|
|
44
45
|
# Offense count: 1
|
45
46
|
RSpec/ExpectInHook:
|
46
47
|
Exclude:
|
47
48
|
- 'spec/ibandit/german_details_converter_spec.rb'
|
48
49
|
|
49
|
-
# Offense count:
|
50
|
+
# Offense count: 15
|
50
51
|
RSpec/MultipleExpectations:
|
51
52
|
Max: 2
|
52
53
|
|
53
|
-
# Offense count:
|
54
|
-
# Configuration parameters:
|
55
|
-
|
56
|
-
Max: 7
|
57
|
-
|
58
|
-
# Offense count: 20
|
59
|
-
# Configuration parameters: IgnoreSharedExamples.
|
54
|
+
# Offense count: 26
|
55
|
+
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
56
|
+
# SupportedStyles: always, named_only
|
60
57
|
RSpec/NamedSubject:
|
61
58
|
Exclude:
|
62
59
|
- 'spec/ibandit/iban_spec.rb'
|
63
60
|
|
64
|
-
# Offense count:
|
61
|
+
# Offense count: 177
|
62
|
+
# Configuration parameters: AllowedGroups.
|
65
63
|
RSpec/NestedGroups:
|
66
|
-
Max:
|
67
|
-
|
68
|
-
# Offense count: 18
|
69
|
-
RSpec/ScatteredSetup:
|
70
|
-
Exclude:
|
71
|
-
- 'spec/ibandit/iban_assembler_spec.rb'
|
72
|
-
- 'spec/ibandit/iban_spec.rb'
|
64
|
+
Max: 5
|
73
65
|
|
74
|
-
# Offense count:
|
66
|
+
# Offense count: 37
|
75
67
|
RSpec/SubjectStub:
|
76
68
|
Exclude:
|
77
69
|
- 'spec/ibandit/iban_spec.rb'
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.4.1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 1.22.0 - January 22, 2025
|
2
|
+
|
3
|
+
- Remove support for Ruby < 3.1, add support for Ruby >= 3.4
|
4
|
+
- Update BLZ2 data - BLZ_20241209
|
5
|
+
- Update IBAN structures for `BE`, `ES`, `XK`.
|
6
|
+
- Add partial support for `SO`, `NI`, `FK`, `OM`, `YE` IBANs.
|
7
|
+
|
8
|
+
## 1.21.0 - August 6, 2024
|
9
|
+
|
10
|
+
- Canada, Financial Institution number - allow 3 digits
|
11
|
+
- modulus_checker failures will now return validation method specific error message
|
12
|
+
|
1
13
|
## 1.20.0 - October 13, 2023
|
2
14
|
|
3
15
|
- Do not allow all 0 transit numbers in CA
|
data/Gemfile
CHANGED
@@ -3,3 +3,13 @@
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
gemspec
|
6
|
+
|
7
|
+
group :development, :test do
|
8
|
+
gem "gc_ruboconfig", "~> 5.0"
|
9
|
+
gem "nokogiri", "~> 1.6"
|
10
|
+
gem "pry", "~> 0.13"
|
11
|
+
gem "pry-byebug", "~> 3.10"
|
12
|
+
gem "rspec", "~> 3.12"
|
13
|
+
gem "rspec-its", "~> 1.2"
|
14
|
+
gem "sax-machine", "~> 1.3"
|
15
|
+
end
|
@@ -1,42 +1,44 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Script for parsing the Bankleitzahl file (BLZ2.xml) from the Deutsche Bundesbank.
|
5
|
+
require "yaml"
|
6
|
+
require "sax-machine"
|
7
|
+
|
8
|
+
class BLZRecord
|
9
|
+
include SAXMachine
|
10
|
+
element "BLZ", as: :bank_code
|
11
|
+
element "Merkmal", as: :primary_record
|
12
|
+
element "PruefZiffMeth", as: :check_digit_rule
|
13
|
+
element "IBANRegel", as: :iban_rule
|
14
|
+
end
|
2
15
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
BLZ_FIELDS = {
|
8
|
-
bank_code: { position: 0, length: 8 },
|
9
|
-
primary_record: { position: 8, length: 1 },
|
10
|
-
check_digit_rule: { position: 150, length: 2 },
|
11
|
-
iban_rule: { position: 168, length: 6 }
|
12
|
-
}.freeze
|
13
|
-
|
14
|
-
def parse_line(line)
|
15
|
-
BLZ_FIELDS.each_with_object({}) do |(field, details), hash|
|
16
|
-
hash[field] = line.slice(details[:position], details[:length])
|
17
|
-
end
|
16
|
+
class BLZFile
|
17
|
+
include SAXMachine
|
18
|
+
elements "BLZEintrag", as: :records, class: BLZRecord
|
18
19
|
end
|
19
20
|
|
20
21
|
def get_iban_rules(blz2_file)
|
21
|
-
blz2_file.each_with_object({}) do |
|
22
|
-
bank_details
|
23
|
-
|
24
|
-
next if bank_details.delete(:primary_record) == '2'
|
22
|
+
BLZFile.parse(blz2_file).records.each_with_object({}) do |bank_details, hash|
|
23
|
+
next if bank_details.primary_record == "2"
|
25
24
|
|
26
|
-
hash[bank_details.
|
25
|
+
hash[bank_details.bank_code] = {
|
26
|
+
check_digit_rule: bank_details.check_digit_rule,
|
27
|
+
iban_rule: bank_details.iban_rule,
|
28
|
+
}
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
32
|
# Only parse the files if this file is run as an executable (not required in,
|
31
33
|
# as it is in the specs)
|
32
34
|
if __FILE__ == $PROGRAM_NAME
|
33
|
-
blz2_file = File.
|
35
|
+
blz2_file = File.read(File.expand_path("../data/raw/BLZ2.xml", __dir__))
|
34
36
|
iban_rules = get_iban_rules(blz2_file)
|
35
37
|
|
36
38
|
output_file_path = File.expand_path(
|
37
|
-
|
38
|
-
|
39
|
+
"../data/german_iban_rules.yml",
|
40
|
+
__dir__,
|
39
41
|
)
|
40
42
|
|
41
|
-
File.open(output_file_path,
|
43
|
+
File.open(output_file_path, "w") { |f| f.write(iban_rules.to_yaml) }
|
42
44
|
end
|
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