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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c3c4654f26735c5412bd2cf3f02c1c5802d1fb2c6c9f775f1472ea0660cc0c3
4
- data.tar.gz: d67a80fea5521e0eac1f1486aefaf584b886ebf846a5d05e3bce8ec6fee21182
3
+ metadata.gz: faf16b69bbbfe2f9e23af48f06e9ef798078f052007d85cd8ab58830f4d89876
4
+ data.tar.gz: 2555633561836b3f6d4ed7872f8c3d7ea1f59515fa9b8c1ba203e102666f02e8
5
5
  SHA512:
6
- metadata.gz: 8c092c285a2923177c42b7deb1e305e9a2b4b1625d642da44a1bca3adac3667276216f187e947fe3f90009ec4f1b190898cf12236dac52e202ba8df61e99fe45
7
- data.tar.gz: f1fcb038c96b3ba56fe53fe92688b2c19e25a9dfcbdc423d387fbceca835afa4e78337bf87ec3f9dee71d5bd5880837ac4f0728a4f67a45a7a2de0135aa230a7
6
+ metadata.gz: 2765fcfbd6a091459893507ba8735d2e56b6375b655a0078fd38f5fc1ab70be59b216359f2d2eb9670e753615ecbf5e701cac1d226de35f19312a34b972053d9
7
+ data.tar.gz: 417c2114fe7ce1734374bff18b83981cea03f4de9a4b6db1c9428f9b4455ab6a13cb724a8f6bb85bc06bf8e9d59df8f0e8e2eea49a448478fabc7f385a51bd30
@@ -7,7 +7,7 @@ jobs:
7
7
  validate:
8
8
  strategy:
9
9
  matrix:
10
- ruby-version: ["2.7", "3.0", "3.1", "3.2"]
10
+ ruby-version: ["3.1", "3.2", "3.3", "3.4"]
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
13
  - uses: actions/checkout@v3
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 2020-08-25 10:15:35 UTC using RuboCop version 0.89.1.
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: 8
10
- # Configuration parameters: IgnoredMethods.
11
- Metrics/AbcSize:
12
- Max: 25
13
-
14
- # Offense count: 2
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: EnforcedStyleForLeadingUnderscores.
21
- # SupportedStylesForLeadingUnderscores: disallowed, required, optional
22
- Naming/MemoizedInstanceVariableName:
17
+ # Configuration parameters: LengthThreshold.
18
+ Metrics/CollectionLiteralLength:
23
19
  Exclude:
24
- - 'lib/ibandit/sweden/bank_lookup.rb'
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: Max.
41
+ # Configuration parameters: CountAsOne.
40
42
  RSpec/ExampleLength:
41
- Exclude:
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: 12
50
+ # Offense count: 15
50
51
  RSpec/MultipleExpectations:
51
52
  Max: 2
52
53
 
53
- # Offense count: 182
54
- # Configuration parameters: AllowSubject.
55
- RSpec/MultipleMemoizedHelpers:
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: 368
61
+ # Offense count: 177
62
+ # Configuration parameters: AllowedGroups.
65
63
  RSpec/NestedGroups:
66
- Max: 6
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: 13
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.2.2
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
- # Script for parsing the Bankleitzahl file (BLZ2.txt) from the Deutsche
4
- # Bundesbank.
5
- require 'yaml'
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 |line, hash|
22
- bank_details = parse_line(line)
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.delete(:bank_code)] = 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.open(File.expand_path('../../data/raw/BLZ2.txt', __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
- '../../data/german_iban_rules.yml',
38
- __FILE__
39
+ "../data/german_iban_rules.yml",
40
+ __dir__,
39
41
  )
40
42
 
41
- File.open(output_file_path, 'w') { |f| f.write(iban_rules.to_yaml) }
43
+ File.open(output_file_path, "w") { |f| f.write(iban_rules.to_yaml) }
42
44
  end
@@ -17,3 +17,4 @@ da:
17
17
  bank_code_does_not_exist: "bankkoden findes ikke"
18
18
  has_invalid_clearing_code_length: "længden på clearingskoden er ugyldig"
19
19
  has_invalid_serial_number: "ugyldigt serienummer"
20
+ branch_code_does_not_exist: "filialkode findes ikke"
@@ -17,3 +17,4 @@ de:
17
17
  bank_code_does_not_exist: "Bankleitzahl existiert nicht"
18
18
  has_invalid_clearing_code_length: "Länge des Verrechnungscodes ist ungültig"
19
19
  has_invalid_serial_number: "Seriennummer ist ungültig"
20
+ branch_code_does_not_exist: "Filialcode existiert nicht"
@@ -17,3 +17,4 @@ en:
17
17
  bank_code_does_not_exist: "bank code does not exist"
18
18
  has_invalid_clearing_code_length: "clearing code length is invalid"
19
19
  has_invalid_serial_number: "serial number is invalid"
20
+ branch_code_does_not_exist: "branch code does not exist"
@@ -1,7 +1,7 @@
1
1
  es:
2
2
  ibandit:
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}\"."
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"
@@ -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"
@@ -1,6 +1,6 @@
1
1
  it:
2
2
  ibandit:
3
- invalid_country_code: "\"%{country_code}\" non è un codice di paese IBAN 3166-1 valido"
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"
@@ -17,3 +17,4 @@ nb:
17
17
  bank_code_does_not_exist: "bankkoden eksisterer ikke"
18
18
  has_invalid_clearing_code_length: "registreringsnummerets lengde er ugyldig"
19
19
  has_invalid_serial_number: "ugyldig serienummer"
20
+ branch_code_does_not_exist: "filialkode eksisterer ikke"
@@ -17,3 +17,4 @@ nl:
17
17
  bank_code_does_not_exist: "bankcode bestaat niet"
18
18
  has_invalid_clearing_code_length: "lengte clearingcode is ongeldig"
19
19
  has_invalid_serial_number: "serienummer is ongeldig"
20
+ branch_code_does_not_exist: "takcode bestaat niet"
@@ -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"
@@ -17,3 +17,4 @@ sl:
17
17
  bank_code_does_not_exist: "koda banke ne obstaja"
18
18
  has_invalid_clearing_code_length: "dolžina klirinške kode ni veljavna"
19
19
  has_invalid_serial_number: "serijska številka ni veljavna"
20
+ branch_code_does_not_exist: "koda podružnice ne obstaja"
@@ -17,3 +17,4 @@ sv:
17
17
  bank_code_does_not_exist: "bankkoden existerar inte"
18
18
  has_invalid_clearing_code_length: "clearingnumrets längd är ogiltigt"
19
19
  has_invalid_serial_number: "ogiltigt serienummer"
20
+ branch_code_does_not_exist: "filialkod finns inte"