banktools-global 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 78d4250b9292e9803a2901d65ea584860f1063c58dd22fe16d673809b7d67cf6
4
+ data.tar.gz: b382e03dbedcbc9e5442e0b686f5f816c3efac99c1e4b67679be7e4eccb574ec
5
+ SHA512:
6
+ metadata.gz: 34839382a704cd679397808ad56803c3f28ff5916720a536381bea62632c68929d22cb6e01687741fc79e624b1f9cd2579fa8f26dfe7b7471fbff6396a1222a5
7
+ data.tar.gz: f735990bc30ae8202df3daa454d50daf045963118de6a19e1bbe5590460d93b6b70ff9fa9d8892c713ff1e7af772da1a6c95785c25860885fd31f0e4ce3c57c4
@@ -0,0 +1,18 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.7.2
14
+ - name: Run the default task
15
+ run: |
16
+ gem install bundler -v 2.2.14
17
+ bundle install
18
+ bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ ## [Unreleased]
2
+
3
+ ## [1.0.0] - 2021-04-19
4
+
5
+ - Initial release.
6
+ - Intended to allow/disallow the same IBANs as the last version (0.0.7) of iban-tools, though this gem does not aim to provide an identical API or feature set as iban-tools.
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in banktools-global.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,34 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ banktools-global (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.4.4)
10
+ rake (13.0.3)
11
+ rspec (3.10.0)
12
+ rspec-core (~> 3.10.0)
13
+ rspec-expectations (~> 3.10.0)
14
+ rspec-mocks (~> 3.10.0)
15
+ rspec-core (3.10.1)
16
+ rspec-support (~> 3.10.0)
17
+ rspec-expectations (3.10.1)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.10.0)
20
+ rspec-mocks (3.10.2)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.10.0)
23
+ rspec-support (3.10.2)
24
+
25
+ PLATFORMS
26
+ x86_64-darwin-20
27
+
28
+ DEPENDENCIES
29
+ banktools-global!
30
+ rake (~> 13.0)
31
+ rspec (~> 3.0)
32
+
33
+ BUNDLED WITH
34
+ 2.2.14
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2009 Iulian Dogariu
4
+ and
5
+ Copyright (c) 2021 Auction Network Sweden AB (Auctionet.com)
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # Banktools::Global
2
+
3
+ Validate and normalize international bank account numbers like IBAN and BIC.
4
+
5
+ Based on [iban-tools](https://github.com/iulianu/iban-tools) which became unmaintained.
6
+
7
+ ## Usage
8
+
9
+ ### IBAN
10
+
11
+ ```ruby
12
+ account = BankTools::Global::IBAN.new(" GB82 WEST 1234 5698 765432 ")
13
+ account.valid? # => true
14
+ account.errors # => []
15
+ account.normalize # => "GB82 WEST 1234 5698 7654 32"
16
+
17
+ account = BankTools::Global::IBAN.new("GB82")
18
+ account.valid? # => false
19
+ account.errors # => [:wrong_length]
20
+
21
+ # Error codes
22
+
23
+ Banktools::Global::Errors::BAD_CHECKSUM # => :bad_checksum
24
+ Banktools::Global::Errors::BAD_FORMAT # => :bad_format
25
+ Banktools::Global::Errors::UNKNOWN_COUNTRY # => :unknown_country
26
+ Banktools::Global::Errors::WRONG_LENGTH # => :wrong_length
27
+ ```
28
+
29
+ ### BIC
30
+
31
+ ```ruby
32
+ account = BankTools::Global::BIC.new("ESS ESESS")
33
+ account.valid? # => true
34
+ account.errors # => []
35
+ account.normalize # => "ESSESESS"
36
+
37
+ account = BankTools::Global::BIC.new("ESSEXXSS")
38
+ account.valid? # => false
39
+ account.errors # => [:unknown_country]
40
+
41
+ # Error codes
42
+
43
+ Banktools::Global::Errors::BAD_FORMAT # => :bad_format
44
+ Banktools::Global::Errors::UNKNOWN_COUNTRY # => :unknown_country
45
+ ```
46
+
47
+ ## Also see
48
+
49
+ * [Our other banktools](https://github.com/barsoom?q=banktools)
50
+
51
+ ## Installation
52
+
53
+ Add this line to your application's Gemfile:
54
+
55
+ ```ruby
56
+ gem "banktools-global"
57
+ ```
58
+
59
+ And then execute:
60
+
61
+ $ bundle install
62
+
63
+ Or install it yourself as:
64
+
65
+ $ gem install banktools-global
66
+
67
+
68
+ ## Development
69
+
70
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
71
+
72
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
73
+
74
+ ## Contributing
75
+
76
+ Bug reports and pull requests are welcome on GitHub at https://github.com/barsoom/banktools-global.
77
+
78
+ ## License
79
+
80
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/banktools/global/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "banktools-global"
7
+ spec.version = BankTools::Global::VERSION
8
+ spec.authors = ["Henrik Nyh"]
9
+ spec.email = ["henrik@nyh.se"]
10
+
11
+ spec.summary = "Validate and normalize international bank account numbers like IBAN/BIC. Based on iban-tools."
12
+ spec.homepage = "https://github.com/barsoom/banktools-global"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = spec.homepage
18
+ spec.metadata["changelog_uri"] = "https://github.com/barsoom/banktools-global/blob/master/README.md"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ # Uncomment to register a new dependency of your gem
30
+ # spec.add_dependency "example-gem", "~> 1.0"
31
+
32
+ # For more information and examples about making a new gem, checkout our
33
+ # guide at: https://bundler.io/guides/creating_gem.html
34
+ end
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "banktools/global"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BankTools
4
+ module Global
5
+ end
6
+ end
7
+
8
+ require_relative "global/version"
9
+ require_relative "global/iban"
10
+ require_relative "global/bic"
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "errors"
4
+
5
+ class BankTools::Global::BIC
6
+ E = BankTools::Global::Errors
7
+
8
+ # http://sv.wikipedia.org/wiki/ISO_9362
9
+ RE = /\A
10
+ [A-Z]{4}
11
+ ([A-Z]{2})
12
+ [A-Z0-9]{2}
13
+ (?:[A-Z0-9]{3})?
14
+ \z/ix
15
+
16
+ COUNTRY_CODES = %w[ AD AE AF AG AI AL AM AN AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR FX GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR ST SV SY SZ TC TD TF TG TH TJ TK TM TN TO TP TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW ]
17
+
18
+ def initialize(raw)
19
+ @raw = raw
20
+ end
21
+
22
+ def valid?
23
+ errors.empty?
24
+ end
25
+
26
+ def errors
27
+ match = @raw.to_s.match(RE)
28
+ return [ E::BAD_FORMAT ] unless match
29
+
30
+ country_code = match.captures.first.upcase
31
+ return [ E::UNKNOWN_COUNTRY ] unless COUNTRY_CODES.include?(country_code)
32
+
33
+ []
34
+ end
35
+
36
+ def normalize
37
+ @raw.to_s.upcase.gsub(/\s/, "")
38
+ end
39
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class BankTools::Global::Errors
4
+ BAD_CHECKSUM = :bad_checksum
5
+ BAD_FORMAT = :bad_format
6
+ UNKNOWN_COUNTRY = :unknown_country
7
+ WRONG_LENGTH = :wrong_length
8
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yaml"
4
+ require_relative "errors"
5
+
6
+ class BankTools::Global::IBAN
7
+ E = BankTools::Global::Errors
8
+
9
+ def initialize(raw)
10
+ @raw = raw
11
+ @pre_normalized = raw.to_s.strip.upcase
12
+ end
13
+
14
+ def valid?
15
+ errors.empty?
16
+ end
17
+
18
+ def errors
19
+ rule = rules[country_code]
20
+ return [ E::UNKNOWN_COUNTRY ] unless rule
21
+
22
+ length = rule.fetch("length")
23
+ return [ E::WRONG_LENGTH ] unless @pre_normalized.length == length
24
+
25
+ re = rule.fetch("bban_pattern")
26
+ return [ E::BAD_FORMAT ] unless bban.match?(re)
27
+
28
+ return [ E::BAD_CHECKSUM ] unless good_checksum?
29
+
30
+ []
31
+ end
32
+
33
+ def normalize
34
+ @pre_normalized.gsub(/.{4}/, '\0 ').strip
35
+ end
36
+
37
+ private
38
+
39
+ def good_checksum?
40
+ number_string =
41
+ (bban + country_code + check_digits).chars.map { |char|
42
+ case char
43
+ when "0".."9" then char
44
+ when "A".."Z" then (char.ord - 55).to_s
45
+ else raise "Unexpected byte '#{byte}' in IBAN '#{normalize}'!"
46
+ end
47
+ }.join
48
+
49
+ number_string.to_i % 97 == 1
50
+ end
51
+
52
+ def country_code
53
+ @pre_normalized[0..1]
54
+ end
55
+
56
+ def check_digits
57
+ @pre_normalized[2..3]
58
+ end
59
+
60
+ def bban
61
+ @pre_normalized[4..-1]
62
+ end
63
+
64
+ def rules
65
+ @@rules ||=
66
+ YAML.load(File.read(File.join(File.dirname(__FILE__), "iban_rules.yml")))
67
+ .transform_values { |h| h.merge("bban_pattern" => /\A#{h.fetch("bban_pattern")}\z/) }
68
+ end
69
+ end
@@ -0,0 +1,281 @@
1
+ # Data originally from http://www.tbg5-finance.org/?ibandocs.shtml/
2
+
3
+ 'AD':
4
+ # Andorra
5
+ length: 24
6
+ bban_pattern: '\d{8}[A-Z0-9]{12}'
7
+
8
+ 'AE':
9
+ # United Arab Emirates
10
+ length: 23
11
+ bban_pattern: '\d{19}'
12
+
13
+ 'AL':
14
+ # Albania
15
+ length: 28
16
+ bban_pattern: '\d{8}[A-Z0-9]{16}'
17
+
18
+ 'AT':
19
+ # Austria
20
+ length: 20
21
+ bban_pattern: '\d{16}'
22
+
23
+ 'BA':
24
+ # Bosnia
25
+ length: 20
26
+ bban_pattern: '\d{16}'
27
+
28
+ 'BE':
29
+ # Belgium
30
+ length: 16
31
+ bban_pattern: '\d{12}'
32
+
33
+ 'BG':
34
+ # Bulgaria
35
+ length: 22
36
+ bban_pattern: '[A-Z]{4}\d{6}[A-Z0-9]{8}'
37
+
38
+ 'BH':
39
+ # Bahrain
40
+ length: 22
41
+ bban_pattern: '[A-Z]{4}[A-Z0-9]{14}'
42
+
43
+ 'CH':
44
+ # Switzerland
45
+ length: 21
46
+ bban_pattern: '\d{5}[A-Z0-9]{12}'
47
+
48
+ 'CY':
49
+ # Cyprus
50
+ length: 28
51
+ bban_pattern: '\d{8}[A-Z0-9]{16}'
52
+
53
+ 'CZ':
54
+ # Czech Republic
55
+ length: 24
56
+ bban_pattern: '\d{20}'
57
+
58
+ 'DE':
59
+ # Germany
60
+ length: 22
61
+ bban_pattern: '\d{18}'
62
+
63
+ 'DK':
64
+ # Denmark
65
+ length: 18
66
+ bban_pattern: '\d{14}'
67
+
68
+ 'DO':
69
+ # Dominican Republic
70
+ length: 28
71
+ bban_pattern: '[A-Z]{4}\d{20}'
72
+
73
+ 'EE':
74
+ # Estonia
75
+ length: 20
76
+ bban_pattern: '\d{16}'
77
+
78
+ 'ES':
79
+ # Spain
80
+ length: 24
81
+ bban_pattern: '\d{20}'
82
+
83
+ 'FI':
84
+ # Finland
85
+ length: 18
86
+ bban_pattern: '\d{14}'
87
+
88
+ 'FO':
89
+ # Faroe Islands
90
+ length: 18
91
+ bban_pattern: '\d{14}'
92
+
93
+ 'FR':
94
+ # France
95
+ length: 27
96
+ bban_pattern: '\d{10}[A-Z0-9]{11}\d{2}'
97
+
98
+ 'GB':
99
+ # United Kingdom
100
+ length: 22
101
+ bban_pattern: '[A-Z]{4}\d{14}'
102
+
103
+ 'GE':
104
+ # Georgia
105
+ length: 22
106
+ bban_pattern: '[A-Z]{2}\d{16}'
107
+
108
+ 'GI':
109
+ # Gibraltar
110
+ length: 23
111
+ bban_pattern: '[A-Z]{4}[A-Z0-9]{15}'
112
+
113
+ 'GL':
114
+ # Greenland
115
+ length: 18
116
+ bban_pattern: '\d{14}'
117
+
118
+ 'GR':
119
+ # Greece
120
+ length: 27
121
+ bban_pattern: '\d{7}[A-Z0-9]{16}'
122
+
123
+ 'HR':
124
+ # Croatia
125
+ length: 21
126
+ bban_pattern: '\d{17}'
127
+
128
+ 'HU':
129
+ # Hungary
130
+ length: 28
131
+ bban_pattern: '\d{24}'
132
+
133
+ 'IE':
134
+ # Ireland
135
+ length: 22
136
+ bban_pattern: '[A-Z]{4}\d{14}'
137
+
138
+ 'IL':
139
+ # Israel
140
+ length: 23
141
+ bban_pattern: '\d{19}'
142
+
143
+ 'IS':
144
+ # Iceland
145
+ length: 26
146
+ bban_pattern: '\d{22}'
147
+
148
+ 'IT':
149
+ # Italy
150
+ length: 27
151
+ bban_pattern: '[A-Z]\d{10}[A-Z0-9]{12}'
152
+
153
+ 'KW':
154
+ # Kuwait
155
+ length: 30
156
+ bban_pattern: '[A-Z]{4}\d{22}'
157
+
158
+ 'KZ':
159
+ # Kazakhstan
160
+ length: 20
161
+ bban_pattern: '\d{3}[A-Z]{3}\d{10}'
162
+
163
+ 'LB':
164
+ # Lebanon
165
+ length: 28
166
+ bban_pattern: '\d{4}[A-Z0-9]{20}'
167
+
168
+ 'LI':
169
+ # Liechtenstein
170
+ length: 21
171
+ bban_pattern: '\d{5}[A-Z0-9]{12}'
172
+
173
+ 'LT':
174
+ # Lithuania
175
+ length: 20
176
+ bban_pattern: '\d{16}'
177
+
178
+ 'LU':
179
+ # Luxembourg
180
+ length: 20
181
+ bban_pattern: '\d{3}[A-Z0-9]{13}'
182
+
183
+ 'LV':
184
+ # Latvia
185
+ length: 21
186
+ bban_pattern: '[A-Z]{4}[A-Z0-9]{13}'
187
+
188
+ 'MC':
189
+ # Monaco
190
+ length: 27
191
+ bban_pattern: '\d{10}[A-Z0-9]{11}\d{2}'
192
+
193
+ 'ME':
194
+ # Montenegro
195
+ length: 22
196
+ bban_pattern: '\d{18}'
197
+
198
+ 'MK':
199
+ # Macedonia
200
+ length: 19
201
+ bban_pattern: '\d{3}[A-Z0-9]{10}\d{2}'
202
+
203
+ 'MR':
204
+ # Mauritania
205
+ length: 27
206
+ bban_pattern: '\d{23}'
207
+
208
+ 'MT':
209
+ # Malta
210
+ length: 31
211
+ bban_pattern: '[A-Z]{4}\d{5}[A-Z0-9]{18}'
212
+
213
+ 'MU':
214
+ # Mauritius
215
+ length: 30
216
+ bban_pattern: '[A-Z]{4}\d{19}[A-Z]{3}'
217
+
218
+ 'NL':
219
+ # Netherlands
220
+ length: 18
221
+ bban_pattern: '[A-Z]{4}\d{10}'
222
+
223
+ 'NO':
224
+ # Norway
225
+ length: 15
226
+ bban_pattern: '\d{11}'
227
+
228
+ 'PL':
229
+ # Poland
230
+ length: 28
231
+ bban_pattern: '\d{8}[A-Z0-9]{16}'
232
+
233
+ 'PT':
234
+ # Portugal
235
+ length: 25
236
+ bban_pattern: '\d{21}'
237
+
238
+ 'RO':
239
+ # Romania
240
+ length: 24
241
+ bban_pattern: '[A-Z]{4}[A-Z0-9]{16}'
242
+
243
+ 'RS':
244
+ # Serbia
245
+ length: 22
246
+ bban_pattern: '\d{18}'
247
+
248
+ 'SA':
249
+ # Saudi Arabia
250
+ length: 24
251
+ bban_pattern: '\d{2}[A-Z0-9]{18}'
252
+
253
+ 'SE':
254
+ # Sweden
255
+ length: 24
256
+ bban_pattern: '\d{20}'
257
+
258
+ 'SI':
259
+ # Slovenia
260
+ length: 19
261
+ bban_pattern: '\d{15}'
262
+
263
+ 'SK':
264
+ # Slovakia
265
+ length: 24
266
+ bban_pattern: '\d{20}'
267
+
268
+ 'SM':
269
+ # San Marino
270
+ length: 27
271
+ bban_pattern: '[A-Z]\d{10}[A-Z0-9]{12}'
272
+
273
+ 'TN':
274
+ # Tunisia
275
+ length: 24
276
+ bban_pattern: '\d{20}'
277
+
278
+ 'TR':
279
+ # Turkey
280
+ length: 26
281
+ bban_pattern: '\d{5}[A-Z0-9]{17}'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BankTools
4
+ module Global
5
+ VERSION = "1.0.0"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: banktools-global
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Henrik Nyh
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-04-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - henrik@nyh.se
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".github/workflows/main.yml"
21
+ - ".gitignore"
22
+ - ".rspec"
23
+ - CHANGELOG.md
24
+ - Gemfile
25
+ - Gemfile.lock
26
+ - LICENSE.txt
27
+ - README.md
28
+ - Rakefile
29
+ - banktools-global.gemspec
30
+ - bin/console
31
+ - bin/setup
32
+ - lib/banktools/global.rb
33
+ - lib/banktools/global/bic.rb
34
+ - lib/banktools/global/errors.rb
35
+ - lib/banktools/global/iban.rb
36
+ - lib/banktools/global/iban_rules.yml
37
+ - lib/banktools/global/version.rb
38
+ homepage: https://github.com/barsoom/banktools-global
39
+ licenses:
40
+ - MIT
41
+ metadata:
42
+ homepage_uri: https://github.com/barsoom/banktools-global
43
+ source_code_uri: https://github.com/barsoom/banktools-global
44
+ changelog_uri: https://github.com/barsoom/banktools-global/blob/master/README.md
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 2.4.0
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubygems_version: 3.1.4
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: Validate and normalize international bank account numbers like IBAN/BIC.
64
+ Based on iban-tools.
65
+ test_files: []