ibandit 1.21.0 → 1.27.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/.github/workflows/tests.yml +1 -1
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -48
- data/.rubocop_todo.yml +35 -36
- data/.ruby-version +1 -1
- data/CHANGELOG.md +31 -0
- data/Gemfile +10 -0
- data/bin/build_german_iban_rules.rb +26 -24
- data/data/german_iban_rules.yml +56 -161
- 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/structure_additions.yml +18 -11
- data/data/raw/swedish_bank_lookup.yml +4 -1
- data/data/structures.yml +92 -9
- data/ibandit.gemspec +1 -8
- data/lib/ibandit/iban.rb +11 -12
- data/lib/ibandit/sweden/bank_lookup.rb +1 -1
- data/lib/ibandit/sweden/validator.rb +1 -1
- data/lib/ibandit/version.rb +1 -1
- data/lib/ibandit.rb +2 -4
- data/spec/ibandit/german_details_converter_spec.rb +2 -2
- data/spec/ibandit/iban_assembler_spec.rb +26 -22
- data/spec/ibandit/iban_spec.rb +235 -16
- 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: dbb7ed596d3a15df834ea35161a57c85cd14d1d361f11f8d003e58dcca623f49
|
4
|
+
data.tar.gz: 8e2c910c7accae21705f784d6ab312c81ab939a33e478c1b0e57eb6695f39acd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ad39f982ac65f870b4d2d70db1149d104a3092e82358b5d25ccb66274967f0e6ce142e58bbc8394a57d3f3e5107d2684e0b338e4516f4e31fd5948c14583d96
|
7
|
+
data.tar.gz: 64e740ee26986a1cc119c34901aa02ab42a0b389d9ad753149659b6396dca7aa91302f6ad6b7e8dc02ce6e0ef79a9723e7aa442c58070b9a455312ee8f94a707
|
data/.github/workflows/tests.yml
CHANGED
data/.gitignore
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,76 @@
|
|
1
1
|
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
2
|
+
# `rubocop --auto-gen-config --exclude-limit 99000`
|
3
|
+
# on 2025-07-01 13:51:07 UTC using RuboCop version 1.77.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
|
|
29
|
+
# Offense count: 2
|
30
|
+
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods.
|
31
|
+
# AllowedMethods: call
|
32
|
+
Naming/PredicateMethod:
|
33
|
+
Exclude:
|
34
|
+
- 'lib/ibandit/sweden/validator.rb'
|
35
|
+
|
33
36
|
# Offense count: 1
|
37
|
+
# Configuration parameters: IgnoredMetadata.
|
34
38
|
RSpec/DescribeClass:
|
35
39
|
Exclude:
|
40
|
+
- '**/spec/features/**/*'
|
41
|
+
- '**/spec/requests/**/*'
|
42
|
+
- '**/spec/routing/**/*'
|
43
|
+
- '**/spec/system/**/*'
|
44
|
+
- '**/spec/views/**/*'
|
36
45
|
- 'spec/ibandit/structure_spec.rb'
|
37
46
|
|
38
47
|
# Offense count: 1
|
39
|
-
# Configuration parameters:
|
48
|
+
# Configuration parameters: CountAsOne.
|
40
49
|
RSpec/ExampleLength:
|
41
|
-
|
42
|
-
- 'spec/ibandit/iban_spec.rb'
|
50
|
+
Max: 6
|
43
51
|
|
44
52
|
# Offense count: 1
|
45
53
|
RSpec/ExpectInHook:
|
46
54
|
Exclude:
|
47
55
|
- 'spec/ibandit/german_details_converter_spec.rb'
|
48
56
|
|
49
|
-
# Offense count:
|
57
|
+
# Offense count: 15
|
50
58
|
RSpec/MultipleExpectations:
|
51
59
|
Max: 2
|
52
60
|
|
53
|
-
# Offense count:
|
54
|
-
# Configuration parameters:
|
55
|
-
|
56
|
-
Max: 7
|
57
|
-
|
58
|
-
# Offense count: 20
|
59
|
-
# Configuration parameters: IgnoreSharedExamples.
|
61
|
+
# Offense count: 26
|
62
|
+
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
63
|
+
# SupportedStyles: always, named_only
|
60
64
|
RSpec/NamedSubject:
|
61
65
|
Exclude:
|
62
66
|
- 'spec/ibandit/iban_spec.rb'
|
63
67
|
|
64
|
-
# Offense count:
|
68
|
+
# Offense count: 188
|
69
|
+
# Configuration parameters: AllowedGroups.
|
65
70
|
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'
|
71
|
+
Max: 5
|
73
72
|
|
74
|
-
# Offense count:
|
73
|
+
# Offense count: 37
|
75
74
|
RSpec/SubjectStub:
|
76
75
|
Exclude:
|
77
76
|
- 'spec/ibandit/iban_spec.rb'
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.4.1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,34 @@
|
|
1
|
+
## 1.27.0 - September 8, 2025
|
2
|
+
|
3
|
+
- Update BLZ data - BLZ_20250908
|
4
|
+
|
5
|
+
## 1.26.1 - July 4, 2025
|
6
|
+
|
7
|
+
- Gracefully fail validation for NZ accounts if no account number is provided
|
8
|
+
|
9
|
+
## 1.26.0 - July 1, 2025
|
10
|
+
|
11
|
+
- Update BLZ data - BLZ_20250609
|
12
|
+
|
13
|
+
## 1.25.0 - February 18, 2025
|
14
|
+
|
15
|
+
- `SE` pseudo-ibans no longer fail validation due to the `ZZ` check digit.
|
16
|
+
|
17
|
+
## 1.24.0 - February 18, 2025
|
18
|
+
|
19
|
+
- Fix validation for SE IBANs where the account number starts with a 0 and the clearing number is not included in the IBAN
|
20
|
+
|
21
|
+
## 1.23.0 - February 14, 2025
|
22
|
+
|
23
|
+
- Fix validation for SE IBANs for clearing code 3300 where the account number starts with a 0
|
24
|
+
|
25
|
+
## 1.22.0 - January 22, 2025
|
26
|
+
|
27
|
+
- Remove support for Ruby < 3.1, add support for Ruby >= 3.4
|
28
|
+
- Update BLZ2 data - BLZ_20241209
|
29
|
+
- Update IBAN structures for `BE`, `ES`, `XK`.
|
30
|
+
- Add partial support for `SO`, `NI`, `FK`, `OM`, `YE` IBANs.
|
31
|
+
|
1
32
|
## 1.21.0 - August 6, 2024
|
2
33
|
|
3
34
|
- Canada, Financial Institution number - allow 3 digits
|
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
|