ibandit 1.7.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/.rubocop.yml +4 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +17 -0
- data/bin/build_structure_file.rb +3 -2
- data/data/german_iban_rules.yml +13 -13
- data/data/raw/BLZ2.txt +511 -725
- data/ibandit.gemspec +3 -2
- data/lib/ibandit/check_digit.rb +1 -1
- data/lib/ibandit/german_details_converter.rb +4 -2
- data/lib/ibandit/iban.rb +3 -3
- data/lib/ibandit/local_details_cleaner.rb +2 -1
- data/lib/ibandit/version.rb +1 -1
- data/lib/ibandit.rb +3 -2
- data/spec/ibandit/german_details_converter_spec.rb +2 -2
- data/spec/ibandit/iban_spec.rb +2 -2
- data/spec/ibandit/structure_spec.rb +2 -2
- metadata +9 -8
data/ibandit.gemspec
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
require File.expand_path("lib/ibandit/version", __dir__)
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
|
-
gem.add_development_dependency "gc_ruboconfig", "~>
|
6
|
+
gem.add_development_dependency "gc_ruboconfig", "~> 3.0.0"
|
7
7
|
gem.add_development_dependency "nokogiri", "~> 1.6"
|
8
8
|
gem.add_development_dependency "pry", "~> 0.13"
|
9
9
|
gem.add_development_dependency "pry-byebug", "~> 3.9"
|
10
10
|
gem.add_development_dependency "rspec", "~> 3.3"
|
11
11
|
gem.add_development_dependency "rspec-its", "~> 1.2"
|
12
|
-
gem.add_development_dependency "rspec_junit_formatter", "~> 0.
|
12
|
+
gem.add_development_dependency "rspec_junit_formatter", "~> 0.5.0"
|
13
13
|
gem.add_development_dependency "sax-machine", "~> 1.3"
|
14
14
|
|
15
15
|
gem.add_runtime_dependency "i18n"
|
@@ -28,4 +28,5 @@ Gem::Specification.new do |gem|
|
|
28
28
|
gem.require_paths = ["lib"]
|
29
29
|
gem.summary = "Convert national banking details into IBANs, and vice-versa."
|
30
30
|
gem.version = Ibandit::VERSION.dup
|
31
|
+
gem.metadata["rubygems_mfa_required"] = "true"
|
31
32
|
end
|
data/lib/ibandit/check_digit.rb
CHANGED
@@ -270,13 +270,15 @@ module Ibandit
|
|
270
270
|
when "13"
|
271
271
|
if unpadded_account_number.size.between?(6, 7)
|
272
272
|
unpadded_account_number + "00"
|
273
|
-
else
|
273
|
+
else
|
274
|
+
@account_number
|
274
275
|
end
|
275
276
|
when "76"
|
276
277
|
case unpadded_account_number.size
|
277
278
|
when 7..8
|
278
279
|
if Check76.new(@account_number).valid? then @account_number
|
279
|
-
else
|
280
|
+
else
|
281
|
+
unpadded_account_number + "00"
|
280
282
|
end
|
281
283
|
when 5..6 then unpadded_account_number + "00"
|
282
284
|
else @account_number
|
data/lib/ibandit/iban.rb
CHANGED
@@ -405,9 +405,9 @@ module Ibandit
|
|
405
405
|
code_digits = swift_bank_code.chars.map(&:to_i)
|
406
406
|
mod =
|
407
407
|
(
|
408
|
-
3 * (code_digits[0] + code_digits[3] + code_digits[6]) +
|
409
|
-
7 * (code_digits[1] + code_digits[4] + code_digits[7]) +
|
410
|
-
1 * (code_digits[2] + code_digits[5] + code_digits[8])
|
408
|
+
(3 * (code_digits[0] + code_digits[3] + code_digits[6])) +
|
409
|
+
(7 * (code_digits[1] + code_digits[4] + code_digits[7])) +
|
410
|
+
(1 * (code_digits[2] + code_digits[5] + code_digits[8]))
|
411
411
|
) % 10
|
412
412
|
|
413
413
|
@errors[:bank_code] = Ibandit.translate(:is_invalid) unless mod.zero?
|
@@ -42,7 +42,8 @@ module Ibandit
|
|
42
42
|
%i[account_number]
|
43
43
|
when "GB", "IE", "MT"
|
44
44
|
if Ibandit.bic_finder.nil? then %i[bank_code branch_code account_number]
|
45
|
-
else
|
45
|
+
else
|
46
|
+
%i[branch_code account_number]
|
46
47
|
end
|
47
48
|
when "AU"
|
48
49
|
%i[branch_code account_number]
|
data/lib/ibandit/version.rb
CHANGED
data/lib/ibandit.rb
CHANGED
@@ -30,8 +30,9 @@ module Ibandit
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def structures
|
33
|
-
@structures ||= YAML.
|
34
|
-
File.expand_path("../data/structures.yml", __dir__),
|
33
|
+
@structures ||= YAML.safe_load(
|
34
|
+
File.read(File.expand_path("../data/structures.yml", __dir__)),
|
35
|
+
permitted_classes: [Range, Symbol],
|
35
36
|
)
|
36
37
|
end
|
37
38
|
|
@@ -19,7 +19,7 @@ describe Ibandit::GermanDetailsConverter do
|
|
19
19
|
|
20
20
|
convertor.fetch("valid", []).each do |tuple|
|
21
21
|
context "bank code: #{tuple['bank_code']} account number " \
|
22
|
-
|
22
|
+
"#{tuple['account_number']}" do
|
23
23
|
let(:bank_code) do
|
24
24
|
tuple["bank_code"]
|
25
25
|
end
|
@@ -44,7 +44,7 @@ describe Ibandit::GermanDetailsConverter do
|
|
44
44
|
|
45
45
|
convertor.fetch("invalid", []).each do |tuple|
|
46
46
|
context "bank code: #{tuple['bank_code']} account number " \
|
47
|
-
|
47
|
+
"#{tuple['account_number']}" do
|
48
48
|
let(:bank_code) { tuple["bank_code"] || "00000000" }
|
49
49
|
let(:account_number) { tuple["account_number"] }
|
50
50
|
|
data/spec/ibandit/iban_spec.rb
CHANGED
@@ -1061,7 +1061,7 @@ describe Ibandit::IBAN do
|
|
1061
1061
|
iban.valid_length?
|
1062
1062
|
expect(iban.errors).
|
1063
1063
|
to include(length: "Length doesn't match SWIFT specification " \
|
1064
|
-
|
1064
|
+
"(expected 22 characters, received 20)")
|
1065
1065
|
end
|
1066
1066
|
end
|
1067
1067
|
|
@@ -1313,7 +1313,7 @@ describe Ibandit::IBAN do
|
|
1313
1313
|
iban.valid_branch_code_length?
|
1314
1314
|
expect(iban.errors).
|
1315
1315
|
to include(branch_code: "is the wrong length (should be 6 " \
|
1316
|
-
|
1316
|
+
"characters)")
|
1317
1317
|
end
|
1318
1318
|
end
|
1319
1319
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
5
|
describe "structures.yml" do
|
6
|
-
structure_file = File.expand_path("../../data/structures.yml", __dir__)
|
7
|
-
structures = YAML.
|
6
|
+
structure_file = File.read(File.expand_path("../../data/structures.yml", __dir__))
|
7
|
+
structures = YAML.safe_load(structure_file, permitted_classes: [Range, Symbol])
|
8
8
|
|
9
9
|
structures.each do |country, rules|
|
10
10
|
context country do
|
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.9.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: 2022-02-16 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: 3.0.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: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.5.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.5.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: sax-machine
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,7 +210,8 @@ files:
|
|
210
210
|
homepage: https://github.com/gocardless/ibandit
|
211
211
|
licenses:
|
212
212
|
- MIT
|
213
|
-
metadata:
|
213
|
+
metadata:
|
214
|
+
rubygems_mfa_required: 'true'
|
214
215
|
post_install_message:
|
215
216
|
rdoc_options: []
|
216
217
|
require_paths:
|
@@ -226,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
227
|
- !ruby/object:Gem::Version
|
227
228
|
version: '0'
|
228
229
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
230
|
+
rubygems_version: 3.3.3
|
230
231
|
signing_key:
|
231
232
|
specification_version: 4
|
232
233
|
summary: Convert national banking details into IBANs, and vice-versa.
|