ibandit 0.11.6 → 0.11.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -6
- data/.rubocop_todo.yml +4 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +8 -0
- data/README.md +90 -30
- data/data/structures.yml +9 -0
- data/ibandit.gemspec +23 -19
- data/lib/ibandit.rb +18 -18
- data/lib/ibandit/check_digit.rb +8 -8
- data/lib/ibandit/constants.rb +14 -5
- data/lib/ibandit/german_details_converter.rb +598 -598
- data/lib/ibandit/iban.rb +90 -37
- data/lib/ibandit/iban_assembler.rb +15 -13
- data/lib/ibandit/iban_splitter.rb +4 -4
- data/lib/ibandit/local_details_cleaner.rb +94 -85
- data/lib/ibandit/pseudo_iban_assembler.rb +2 -2
- data/lib/ibandit/pseudo_iban_splitter.rb +15 -25
- data/lib/ibandit/sweden/bank_lookup.rb +1 -1
- data/lib/ibandit/sweden/local_details_converter.rb +7 -7
- data/lib/ibandit/sweden/validator.rb +5 -5
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/german_details_converter_spec.rb +23 -22
- data/spec/ibandit/iban_assembler_spec.rb +310 -310
- data/spec/ibandit/iban_spec.rb +1087 -712
- data/spec/ibandit/iban_splitter_spec.rb +14 -14
- data/spec/ibandit/local_details_cleaner_spec.rb +473 -452
- data/spec/ibandit/pseudo_iban_assembler_spec.rb +54 -18
- data/spec/ibandit/pseudo_iban_splitter_spec.rb +13 -22
- data/spec/ibandit/structure_spec.rb +3 -3
- data/spec/ibandit/sweden/local_details_converter_spec.rb +125 -125
- data/spec/ibandit/sweden/validator_spec.rb +88 -88
- data/spec/spec_helper.rb +10 -10
- metadata +48 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7911d5fb9900647ee7257b28020a16529a72693
|
4
|
+
data.tar.gz: 5ca3914bc9337d79b9c57f1272c6a4e4709f315f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 025c7ef0468f9092dcadb74a79dbd96141b463e8f410e546e8e98d3b914affae4840b5cb8e847980e872a3cd62e250c6326839a83545828cc4734fb84a1a951d
|
7
|
+
data.tar.gz: 8ec07e2d051f7eb65ff57b3f3cf86e34f252c1f6dff2fa9249fe7bf60fd0873e21c86e20ee69b48058a1ad187db53bda9966b6567ebd8ec52eb3e4a7a9e64868
|
data/.rubocop.yml
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
|
+
inherit_gem:
|
3
|
+
ruboconfig: rubocop.yml
|
2
4
|
|
3
5
|
AllCops:
|
4
|
-
|
5
|
-
- config.ru
|
6
|
-
- Rakefile
|
7
|
-
Exclude:
|
8
|
-
- .*/**/*
|
6
|
+
TargetRubyVersion: 2.1
|
9
7
|
|
10
8
|
# Limit lines to 80 characters.
|
11
9
|
LineLength:
|
@@ -23,6 +21,9 @@ SingleLineMethods:
|
|
23
21
|
NumericLiterals:
|
24
22
|
Enabled: false
|
25
23
|
|
24
|
+
Performance/RegexpMatch:
|
25
|
+
Enabled: false
|
26
|
+
|
26
27
|
# Wants you to use the same argument names for every reduce. This seems kinda
|
27
28
|
# naff compared to naming them semantically
|
28
29
|
SingleLineBlockParams:
|
@@ -43,5 +44,5 @@ Metrics/MethodLength:
|
|
43
44
|
Metrics/ModuleLength:
|
44
45
|
Max: 400
|
45
46
|
|
46
|
-
|
47
|
+
Layout/DotPosition:
|
47
48
|
EnforcedStyle: 'trailing'
|
data/.rubocop_todo.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,18 +2,59 @@ Ibandit [![Build Status](https://travis-ci.org/gocardless/ibandit.svg?branch=mas
|
|
2
2
|
=======
|
3
3
|
|
4
4
|
Ibandit is a Ruby library for manipulating and validating
|
5
|
-
[IBANs](http://en.wikipedia.org/wiki/International_Bank_Account_Number).
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
5
|
+
[IBANs](http://en.wikipedia.org/wiki/International_Bank_Account_Number).
|
6
|
+
|
7
|
+
The primary objective is to provide an interface that enables the storage and retrieval national banking details as a single value. This may be an IBAN, if a country fully and unambiguously supports it, or a combination of IBAN and/or pseudo-IBAN.
|
8
|
+
|
9
|
+
Therefore, there are three distinct modes:
|
10
|
+
|
11
|
+
1. For countries that support any form of IBAN: construct and validate IBAN from national banking details
|
12
|
+
2. For countries that have unambiguous IBANs: deconstruct an IBAN into national banking details
|
13
|
+
3. For countries where either of the above is not possible: a pseudo-IBAN as a substitute for the above.
|
14
|
+
|
15
|
+
For storage, you should always try to use the `pseudo_iban`, falling back to `iban` if it not available.
|
16
|
+
|
17
|
+
For example:
|
18
|
+
- Sweden does support IBANs (**1.**) but the format is ambiguous due to variable length account numbers so they cannot be deconstructed (**2.**). For persistence, we therefore recommend using pseudo-IBANs (**3.**) because the national banking details can be recovered from them.
|
19
|
+
- Australia does not support IBANs (**1.** & **2.**), therefore pseudo-IBANs (**3.**) can be created from national banking details for storage. To get back the national banking details, you can pass the pseudo-IBAN to Ibandit and it will parse out the national banking details again for use.
|
20
|
+
|
21
|
+
# Supported Countries
|
22
|
+
|
23
|
+
| Country | Construct and Validate IBANs | Deconstruct IBANs | Pseudo IBANs |
|
24
|
+
|-----------------|:----------------------------:|:------------------:|:------------------:|
|
25
|
+
| Australia | | | :white_check_mark: |
|
26
|
+
| Austria | :white_check_mark: | :white_check_mark: | |
|
27
|
+
| Belgium | :white_check_mark: | :white_check_mark: | |
|
28
|
+
| Bulgaria | :white_check_mark: | :white_check_mark: | |
|
29
|
+
| Croatia | :white_check_mark: | :white_check_mark: | |
|
30
|
+
| Cyprus | :white_check_mark: | :white_check_mark: | |
|
31
|
+
| Czech Republic | :white_check_mark: | :white_check_mark: | |
|
32
|
+
| Denmark | :white_check_mark: | :white_check_mark: | |
|
33
|
+
| Estonia | :white_check_mark: | :white_check_mark: | |
|
34
|
+
| Finland | :white_check_mark: | :white_check_mark: | |
|
35
|
+
| France | :white_check_mark: | :white_check_mark: | |
|
36
|
+
| Germany | :white_check_mark: | :white_check_mark: | |
|
37
|
+
| Greece | :white_check_mark: | :white_check_mark: | |
|
38
|
+
| Hungary | :white_check_mark: | :white_check_mark: | |
|
39
|
+
| Ireland | :white_check_mark: | :white_check_mark: | |
|
40
|
+
| Iceland | :white_check_mark: | :white_check_mark: | |
|
41
|
+
| Italy | :white_check_mark: | :white_check_mark: | |
|
42
|
+
| Latvia | :white_check_mark: | :white_check_mark: | |
|
43
|
+
| Lithuania | :white_check_mark: | :white_check_mark: | |
|
44
|
+
| Luxembourg | :white_check_mark: | :white_check_mark: | |
|
45
|
+
| Monaco | :white_check_mark: | :white_check_mark: | |
|
46
|
+
| Malta | :white_check_mark: | :white_check_mark: | |
|
47
|
+
| Netherlands | :white_check_mark: | :white_check_mark: | |
|
48
|
+
| Norway | :white_check_mark: | :white_check_mark: | |
|
49
|
+
| Poland | :white_check_mark: | :white_check_mark: | |
|
50
|
+
| Portugal | :white_check_mark: | :white_check_mark: | |
|
51
|
+
| Romania | :white_check_mark: | :white_check_mark: | |
|
52
|
+
| San Marino | :white_check_mark: | :white_check_mark: | |
|
53
|
+
| Slovakia | :white_check_mark: | :white_check_mark: | |
|
54
|
+
| Slovenia | :white_check_mark: | :white_check_mark: | |
|
55
|
+
| Spain | :white_check_mark: | :white_check_mark: | |
|
56
|
+
| Sweden | :white_check_mark: | | :white_check_mark: |
|
57
|
+
| United Kingdom | :white_check_mark: | :white_check_mark: | |
|
17
58
|
|
18
59
|
## Usage
|
19
60
|
|
@@ -37,7 +78,7 @@ iban.to_s # => "XQ75BADCODE666"
|
|
37
78
|
iban.to_s(:formatted) # => "XQ75 BADC ODE6 66"
|
38
79
|
```
|
39
80
|
|
40
|
-
Alternatively, you can [create an IBAN from national banking details](#creating-an-iban-from-national-banking-details)
|
81
|
+
Alternatively, you can [create an IBAN from national banking details](#creating-an-iban-from-national-banking-details).
|
41
82
|
|
42
83
|
### Validating an IBAN
|
43
84
|
|
@@ -69,22 +110,26 @@ Ibandit will also apply local modulus checks if you set a modulus checker:
|
|
69
110
|
|
70
111
|
```ruby
|
71
112
|
module ModulusChecker
|
72
|
-
def self.valid_bank_code?(
|
73
|
-
some_codes
|
113
|
+
def self.valid_bank_code?(iban)
|
114
|
+
# some_codes
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.valid_branch_code?(iban)
|
118
|
+
# some_codes
|
74
119
|
end
|
75
120
|
|
76
|
-
def self.valid_account_number?(
|
77
|
-
some_codes
|
121
|
+
def self.valid_account_number?(iban)
|
122
|
+
# some_codes
|
78
123
|
end
|
79
124
|
end
|
80
125
|
|
81
126
|
Ibandit.modulus_checker = ModulusChecker
|
82
127
|
```
|
83
128
|
|
84
|
-
|
85
|
-
`valid_bank_code?` should return true unless it is known that the bank/branch code in this IBAN
|
86
|
-
invalid in the country specified. `valid_account_number?` should return true unless it is known that
|
87
|
-
|
129
|
+
All three the `valid_bank_code?`, `valid_branch_code?` and `valid_account_number?` methods will receive an `IBAN` object.
|
130
|
+
`valid_bank_code?` and `valid_branch_code?` should return true unless it is known that the bank/branch code in this IBAN
|
131
|
+
are invalid in the country specified. `valid_account_number?` should return true unless it is known that the account number
|
132
|
+
in this IBAN cannot be valid due to local modulus checking rules.
|
88
133
|
|
89
134
|
### Deconstructing an IBAN into national banking details
|
90
135
|
|
@@ -119,7 +164,7 @@ iban.check_digits # => "82"
|
|
119
164
|
iban.swift_bank_code # => "WEST"
|
120
165
|
iban.swift_branch_code # => "123456"
|
121
166
|
iban.swift_account_number # => "98765432"
|
122
|
-
iban.swift_national_id
|
167
|
+
iban.swift_national_id # => "WEST123456"
|
123
168
|
```
|
124
169
|
|
125
170
|
In addition, it is often useful to extract any local check digits from the IBAN.
|
@@ -439,28 +484,39 @@ iban.iban # => "GB60BARC20000055779911"
|
|
439
484
|
|
440
485
|
### Pseudo-IBANs
|
441
486
|
|
442
|
-
|
443
|
-
IBAN. For this reason, Ibandit has a concept of a *pseudo-IBAN*. This is a
|
444
|
-
string with a similar structure to an IBAN that can be decomposed into local
|
445
|
-
banking details. Pseudo-IBANs can be recognized by the fact that they have `ZZ`
|
487
|
+
Pseudo-IBANs can be recognized by the fact that they have `ZZ`
|
446
488
|
as the third and fourth characters (these would be check digits for a regular
|
447
|
-
IBAN).
|
489
|
+
IBAN). Note: pseudo-IBANs can be used in conjunction with IBANs depending on the country. See [Supported Countries](#supported-countries).
|
448
490
|
|
449
|
-
```
|
491
|
+
```ruby
|
450
492
|
iban = Ibandit::IBAN.new(
|
451
493
|
country_code: 'SE',
|
452
494
|
branch_code: '7507',
|
453
495
|
account_number: '1211203'
|
454
496
|
)
|
455
497
|
iban.pseudo_iban # => "SEZZX7507XXX1211203"
|
498
|
+
iban.iban # => "SE2680000000075071211203"
|
456
499
|
|
457
500
|
iban = Ibandit::IBAN.new('SEZZX7507XXX1211203')
|
458
501
|
iban.country_code # => "SE"
|
459
502
|
iban.branch_code # => "7507"
|
460
503
|
iban.account_number # => "1211203"
|
461
|
-
|
504
|
+
iban.iban # => "SE2680000000075071211203"
|
505
|
+
|
506
|
+
iban = Ibandit::IBAN.new(
|
507
|
+
country_code: 'AU',
|
508
|
+
branch_code: '123-456', # 6 digit BSB number
|
509
|
+
account_number: '123456789' # 9 digit account number
|
510
|
+
)
|
511
|
+
iban.pseudo_iban # => "AUZZ123456123456789"
|
512
|
+
iban.iban # => nil
|
462
513
|
|
463
|
-
|
514
|
+
iban = Ibandit::IBAN.new('AUZZ123456123456789')
|
515
|
+
iban.country_code # => "AU"
|
516
|
+
iban.branch_code # => "123456"
|
517
|
+
iban.account_number # => "123456789"
|
518
|
+
iban.iban # => nil
|
519
|
+
```
|
464
520
|
|
465
521
|
## Other libraries
|
466
522
|
|
@@ -469,3 +525,7 @@ exists and is an excellent choice if you only require basic IBAN validation.
|
|
469
525
|
We built Ibandit because iban-tools doesn't provide a comprehensive, consistent
|
470
526
|
interface for the construction and deconstruction of IBANs into national
|
471
527
|
details.
|
528
|
+
|
529
|
+
---
|
530
|
+
|
531
|
+
GoCardless ♥ open source. If you do too, come [join us](https://gocardless.com/about/jobs/software-engineer).
|
data/data/structures.yml
CHANGED
@@ -49,6 +49,15 @@ AT:
|
|
49
49
|
:bban_format: "\\d{5}\\d{11}"
|
50
50
|
:bank_code_format: "\\d{5}"
|
51
51
|
:account_number_format: "\\d{11}"
|
52
|
+
AU:
|
53
|
+
:bank_code_length: 0
|
54
|
+
:branch_code_length: 6
|
55
|
+
:account_number_length: 9
|
56
|
+
:branch_code_format: "\\d{6}"
|
57
|
+
:account_number_format: "\\d{9}"
|
58
|
+
:pseudo_iban_bank_code_length: 0
|
59
|
+
:pseudo_iban_branch_code_length: 6
|
60
|
+
:pseudo_iban_account_number_length: 9
|
52
61
|
AZ:
|
53
62
|
:bank_code_position: 5
|
54
63
|
:bank_code_length: 4
|
data/ibandit.gemspec
CHANGED
@@ -1,26 +1,30 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path("../lib/ibandit/version", __FILE__)
|
2
4
|
|
3
5
|
Gem::Specification.new do |gem|
|
4
|
-
gem.add_development_dependency
|
5
|
-
gem.add_development_dependency
|
6
|
-
gem.add_development_dependency
|
7
|
-
gem.add_development_dependency
|
8
|
-
gem.add_development_dependency
|
6
|
+
gem.add_development_dependency "nokogiri", "~> 1.6"
|
7
|
+
gem.add_development_dependency "pry", "~> 0.10"
|
8
|
+
gem.add_development_dependency "pry-nav", "~> 0.2"
|
9
|
+
gem.add_development_dependency "rspec", "~> 3.3"
|
10
|
+
gem.add_development_dependency "rspec-its", "~> 1.2"
|
11
|
+
gem.add_development_dependency "rubocop", "~> 0.52.0"
|
12
|
+
gem.add_development_dependency "sax-machine", "~> 1.3"
|
9
13
|
|
10
|
-
gem.add_runtime_dependency
|
14
|
+
gem.add_runtime_dependency "i18n", "~> 0.7.0"
|
11
15
|
|
12
|
-
gem.authors = [
|
13
|
-
gem.description =
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
gem.email = [
|
16
|
+
gem.authors = %w[GoCardless]
|
17
|
+
gem.description = "Ibandit is a Ruby library for manipulating and " \
|
18
|
+
"validating IBANs. It allows you to construct an IBAN " \
|
19
|
+
"from national banking details; deconstruct an IBAN into " \
|
20
|
+
"national banking details; and validate an IBAN's check " \
|
21
|
+
"digits and format."
|
22
|
+
gem.email = %w[developers@gocardless.com]
|
19
23
|
gem.files = `git ls-files`.split("\n")
|
20
|
-
gem.homepage =
|
21
|
-
gem.licenses = [
|
22
|
-
gem.name =
|
23
|
-
gem.require_paths = [
|
24
|
-
gem.summary =
|
24
|
+
gem.homepage = "https://github.com/gocardless/ibandit"
|
25
|
+
gem.licenses = ["MIT"]
|
26
|
+
gem.name = "ibandit"
|
27
|
+
gem.require_paths = ["lib"]
|
28
|
+
gem.summary = "Convert national banking details into IBANs, and vice-versa."
|
25
29
|
gem.version = Ibandit::VERSION.dup
|
26
30
|
end
|
data/lib/ibandit.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
1
|
+
require "i18n"
|
2
|
+
require "ibandit/version"
|
3
|
+
require "ibandit/errors"
|
4
|
+
require "ibandit/constants"
|
5
|
+
require "ibandit/iban"
|
6
|
+
require "ibandit/german_details_converter"
|
7
|
+
require "ibandit/sweden/local_details_converter"
|
8
|
+
require "ibandit/sweden/validator"
|
9
|
+
require "ibandit/sweden/bank_lookup"
|
10
|
+
require "ibandit/iban_splitter"
|
11
|
+
require "ibandit/iban_assembler"
|
12
|
+
require "ibandit/pseudo_iban_assembler"
|
13
|
+
require "ibandit/pseudo_iban_splitter"
|
14
|
+
require "ibandit/local_details_cleaner"
|
15
|
+
require "ibandit/check_digit"
|
16
16
|
|
17
|
-
I18n.load_path += Dir[File.expand_path(
|
17
|
+
I18n.load_path += Dir[File.expand_path("../../config/locales/*.{rb,yml}",
|
18
18
|
__FILE__)]
|
19
19
|
|
20
20
|
module Ibandit
|
@@ -22,13 +22,13 @@ module Ibandit
|
|
22
22
|
attr_accessor :bic_finder, :modulus_checker
|
23
23
|
|
24
24
|
def find_bic(country_code, national_id)
|
25
|
-
raise NotImplementedError,
|
25
|
+
raise NotImplementedError, "BIC finder is not defined" unless @bic_finder
|
26
26
|
@bic_finder.call(country_code, national_id)
|
27
27
|
end
|
28
28
|
|
29
29
|
def structures
|
30
30
|
@structures ||= YAML.load_file(
|
31
|
-
File.expand_path(
|
31
|
+
File.expand_path("../../data/structures.yml", __FILE__),
|
32
32
|
)
|
33
33
|
end
|
34
34
|
|
data/lib/ibandit/check_digit.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module Ibandit
|
2
2
|
module CheckDigit
|
3
3
|
ITALIAN_ODD_MAPPING = {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
"A" => 1, "B" => 0, "C" => 5, "D" => 7, "E" => 9, "F" => 13,
|
5
|
+
"G" => 15, "H" => 17, "I" => 19, "J" => 21, "K" => 2, "L" => 4,
|
6
|
+
"M" => 18, "N" => 20, "O" => 11, "P" => 3, "Q" => 6, "R" => 8,
|
7
|
+
"S" => 12, "T" => 14, "U" => 16, "V" => 10, "W" => 22, "X" => 25,
|
8
|
+
"Y" => 24, "Z" => 23, "0" => 1, "1" => 0, "2" => 5, "3" => 7,
|
9
|
+
"4" => 9, "5" => 13, "6" => 15, "7" => 17, "8" => 19, "9" => 21
|
10
10
|
}.freeze
|
11
11
|
|
12
12
|
def self.iban(country_code, bban)
|
13
|
-
chars = bban + country_code +
|
13
|
+
chars = bban + country_code + "00"
|
14
14
|
digits = chars.bytes.map do |byte|
|
15
15
|
case byte
|
16
16
|
when 48..57 then byte.chr # 0..9
|
@@ -21,7 +21,7 @@ module Ibandit
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
remainder = digits.join.to_i % 97
|
24
|
-
|
24
|
+
sprintf("%02d", 98 - remainder)
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.italian(string)
|
data/lib/ibandit/constants.rb
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
module Ibandit
|
2
2
|
module Constants
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
CONSTRUCTABLE_IBAN_COUNTRY_CODES = %w[AT BE BG CY CZ DE DK EE ES FI FR GB GR
|
4
|
+
HR HU IE IS IT LT LU LV MC MT NL NO PL
|
5
|
+
PT RO SE SI SK SM].freeze
|
6
6
|
|
7
|
-
PSEUDO_IBAN_COUNTRY_CODES = %w
|
8
|
-
|
7
|
+
PSEUDO_IBAN_COUNTRY_CODES = %w[AU SE].freeze
|
8
|
+
DECONSTRUCTABLE_IBAN_COUNTRY_CODES =
|
9
|
+
CONSTRUCTABLE_IBAN_COUNTRY_CODES - PSEUDO_IBAN_COUNTRY_CODES
|
10
|
+
|
11
|
+
PSEUDO_IBAN_CHECK_DIGITS = "ZZ".freeze
|
12
|
+
|
13
|
+
SUPPORTED_COUNTRY_CODES = (
|
14
|
+
CONSTRUCTABLE_IBAN_COUNTRY_CODES +
|
15
|
+
DECONSTRUCTABLE_IBAN_COUNTRY_CODES +
|
16
|
+
PSEUDO_IBAN_COUNTRY_CODES
|
17
|
+
).uniq
|
9
18
|
end
|
10
19
|
end
|
@@ -1,24 +1,24 @@
|
|
1
1
|
# German bank details don't map directly to IBANs in the same way as in other
|
2
2
|
# countries - each bank has idiosyncracies for translating its cusomers' bank
|
3
3
|
# details. These idiosyncracies are described in a document from the Bundesbank:
|
4
|
-
#
|
4
|
+
# https://www.bundesbank.de/Redaktion/EN/Standardartikel/Tasks/Payment_systems/iban_rules.html?nn=26102
|
5
5
|
|
6
6
|
module Ibandit
|
7
7
|
module GermanDetailsConverter
|
8
8
|
def self.rules
|
9
9
|
@rules ||= YAML.load_file(
|
10
|
-
File.expand_path(
|
10
|
+
File.expand_path("../../../data/german_iban_rules.yml", __FILE__),
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.convert(opts)
|
15
15
|
# Fetch the relevant rule number. Default to '000000'
|
16
|
-
rule_num = rules.fetch(opts[:bank_code], {}).fetch(:iban_rule,
|
16
|
+
rule_num = rules.fetch(opts[:bank_code], {}).fetch(:iban_rule, "000000")
|
17
17
|
|
18
18
|
# Convert the bank details using the relevant rule
|
19
19
|
updated_bank_details = const_get("Rule#{rule_num}").new(
|
20
20
|
opts[:bank_code],
|
21
|
-
opts[:account_number]
|
21
|
+
opts[:account_number],
|
22
22
|
).converted_details
|
23
23
|
|
24
24
|
opts.merge(updated_bank_details)
|
@@ -35,8 +35,8 @@ module Ibandit
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def converted_details
|
38
|
-
raise NotImplementedError,
|
39
|
-
|
38
|
+
raise NotImplementedError, "Concrete RuleXXXXXX classes should " \
|
39
|
+
"define a converted_details function"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -52,8 +52,8 @@ module Ibandit
|
|
52
52
|
def converted_details
|
53
53
|
updated_account_number =
|
54
54
|
pseudo_account_number_mapping.fetch(
|
55
|
-
@account_number.rjust(10,
|
56
|
-
@account_number
|
55
|
+
@account_number.rjust(10, "0"),
|
56
|
+
@account_number,
|
57
57
|
)
|
58
58
|
|
59
59
|
{ bank_code: @bank_code, account_number: updated_account_number }
|
@@ -79,9 +79,9 @@ module Ibandit
|
|
79
79
|
|
80
80
|
class Rule000200 < BaseRule
|
81
81
|
def converted_details
|
82
|
-
if @account_number.rjust(10,
|
83
|
-
|
84
|
-
msg =
|
82
|
+
if @account_number.rjust(10, "0")[7] == "6" ||
|
83
|
+
@account_number.rjust(10, "0").slice(7, 2) == "86"
|
84
|
+
msg = "Account does not support payment transactions"
|
85
85
|
raise UnsupportedAccountDetails, msg
|
86
86
|
else
|
87
87
|
{ bank_code: @bank_code, account_number: @account_number }
|
@@ -91,8 +91,8 @@ module Ibandit
|
|
91
91
|
|
92
92
|
class Rule000300 < BaseRule
|
93
93
|
def converted_details
|
94
|
-
if @account_number ==
|
95
|
-
msg =
|
94
|
+
if @account_number == "6161604670"
|
95
|
+
msg = "Account does not support payment transactions"
|
96
96
|
raise UnsupportedAccountDetails, msg
|
97
97
|
else
|
98
98
|
{ bank_code: @bank_code, account_number: @account_number }
|
@@ -104,21 +104,21 @@ module Ibandit
|
|
104
104
|
include PseudoAccountNumberBehaviour
|
105
105
|
|
106
106
|
@pseudo_account_number_mapping = {
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
107
|
+
"0000000135" => "0990021440",
|
108
|
+
"0000001111" => "6600012020",
|
109
|
+
"0000001900" => "0920019005",
|
110
|
+
"0000007878" => "0780008006",
|
111
|
+
"0000008888" => "0250030942",
|
112
|
+
"0000009595" => "1653524703",
|
113
|
+
"0000097097" => "0013044150",
|
114
|
+
"0000112233" => "0630025819",
|
115
|
+
"0000336666" => "6604058903",
|
116
|
+
"0000484848" => "0920018963",
|
117
117
|
}
|
118
118
|
end
|
119
119
|
|
120
120
|
class Rule000503 < BaseRule
|
121
|
-
EXCEPTION_BANK_CODES = %w
|
121
|
+
EXCEPTION_BANK_CODES = %w[
|
122
122
|
10080900 25780022 42080082 54280023 65180005 79580099 12080000 25980027
|
123
123
|
42680081 54580020 65380003 80080000 13080000 26080024 43080083 54680022
|
124
124
|
66280053 81080000 14080000 26281420 44080055 55080065 66680013 82080000
|
@@ -133,105 +133,105 @@ module Ibandit
|
|
133
133
|
62280012 74380007 22280000 36280071 51380040 63080015 75080003 24080000
|
134
134
|
36580072 52080080 64080014 76080053 24180001 40080040 53080030 64380011
|
135
135
|
79080052 25480021 41280043 54080021 65080009 79380051
|
136
|
-
|
136
|
+
].freeze
|
137
137
|
|
138
138
|
PSEUDO_ACCOUNT_NUMBER_MAPPING = {
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
139
|
+
"30040000_0000000036" => "0261103600",
|
140
|
+
"47880031_0000000050" => "0519899900",
|
141
|
+
"47840065_0000000050" => "0150103000",
|
142
|
+
"47840065_0000000055" => "0150103000",
|
143
|
+
"70080000_0000000094" => "0928553201",
|
144
|
+
"70040041_0000000094" => "0212808000",
|
145
|
+
"47840065_0000000099" => "0150103000",
|
146
|
+
"37080040_0000000100" => "0269100000",
|
147
|
+
"38040007_0000000100" => "0119160000",
|
148
|
+
"37080040_0000000111" => "0215022000",
|
149
|
+
"51080060_0000000123" => "0012299300",
|
150
|
+
"36040039_0000000150" => "0161620000",
|
151
|
+
"68080030_0000000202" => "0416520200",
|
152
|
+
"30040000_0000000222" => "0348010002",
|
153
|
+
"38040007_0000000240" => "0109024000",
|
154
|
+
"69240075_0000000444" => "0445520000",
|
155
|
+
"60080000_0000000502" => "0901581400",
|
156
|
+
"60040071_0000000502" => "0525950200",
|
157
|
+
"55040022_0000000555" => "0211050000",
|
158
|
+
"39080005_0000000556" => "0204655600",
|
159
|
+
"39040013_0000000556" => "0106555600",
|
160
|
+
"57080070_0000000661" => "0604101200",
|
161
|
+
"26580070_0000000700" => "0710000000",
|
162
|
+
"50640015_0000000777" => "0222222200",
|
163
|
+
"30040000_0000000999" => "0123799900",
|
164
|
+
"86080000_0000001212" => "0480375900",
|
165
|
+
"37040044_0000001888" => "0212129101",
|
166
|
+
"25040066_0000001919" => "0141919100",
|
167
|
+
"10080000_0000001987" => "0928127700",
|
168
|
+
"50040000_0000002000" => "0728400300",
|
169
|
+
"20080000_0000002222" => "0903927200",
|
170
|
+
"38040007_0000003366" => "0385333000",
|
171
|
+
"37080040_0000004004" => "0233533500",
|
172
|
+
"37080040_0000004444" => "0233000300",
|
173
|
+
"43080083_0000004630" => "0825110100",
|
174
|
+
"50080000_0000006060" => "0096736100",
|
175
|
+
"10040000_0000007878" => "0267878700",
|
176
|
+
"10080000_0000008888" => "0928126501",
|
177
|
+
"50080000_0000009000" => "0026492100",
|
178
|
+
"79080052_0000009696" => "0300021700",
|
179
|
+
"79040047_0000009696" => "0680210200",
|
180
|
+
"39080005_0000009800" => "0208457000",
|
181
|
+
"50080000_0000042195" => "0900333200",
|
182
|
+
"32040024_0000047800" => "0155515000",
|
183
|
+
"37080040_0000055555" => "0263602501",
|
184
|
+
"38040007_0000055555" => "0305555500",
|
185
|
+
"50080000_0000101010" => "0090003500",
|
186
|
+
"50040000_0000101010" => "0311011100",
|
187
|
+
"37040044_0000102030" => "0222344400",
|
188
|
+
"86080000_0000121200" => "0480375900",
|
189
|
+
"66280053_0000121212" => "0625242400",
|
190
|
+
"16080000_0000123456" => "0012345600",
|
191
|
+
"29080010_0000124124" => "0107502000",
|
192
|
+
"37080040_0000182002" => "0216603302",
|
193
|
+
"12080000_0000212121" => "4050462200",
|
194
|
+
"37080040_0000300000" => "0983307900",
|
195
|
+
"37040044_0000300000" => "0300000700",
|
196
|
+
"37080040_0000333333" => "0270330000",
|
197
|
+
"38040007_0000336666" => "0105232300",
|
198
|
+
"55040022_0000343434" => "0217900000",
|
199
|
+
"85080000_0000400000" => "0459488501",
|
200
|
+
"37080040_0000414141" => "0041414100",
|
201
|
+
"38040007_0000414141" => "0108000100",
|
202
|
+
"20080000_0000505050" => "0500100600",
|
203
|
+
"37080040_0000555666" => "0055566600",
|
204
|
+
"20080000_0000666666" => "0900732500",
|
205
|
+
"30080000_0000700000" => "0800005000",
|
206
|
+
"70080000_0000700000" => "0750055500",
|
207
|
+
"70080000_0000900000" => "0319966601",
|
208
|
+
"37080040_0000909090" => "0269100000",
|
209
|
+
"38040007_0000909090" => "0119160000",
|
210
|
+
"70080000_0000949494" => "0575757500",
|
211
|
+
"70080000_0001111111" => "0448060000",
|
212
|
+
"70040041_0001111111" => "0152140000",
|
213
|
+
"10080000_0001234567" => "0920192001",
|
214
|
+
"38040007_0001555555" => "0258266600",
|
215
|
+
"76040061_0002500000" => "0482146800",
|
216
|
+
"16080000_0003030400" => "4205227110",
|
217
|
+
"37080040_0005555500" => "0263602501",
|
218
|
+
"75040062_0006008833" => "0600883300",
|
219
|
+
"12080000_0007654321" => "0144000700",
|
220
|
+
"70080000_0007777777" => "0443540000",
|
221
|
+
"70040041_0007777777" => "0213600000",
|
222
|
+
"64140036_0008907339" => "0890733900",
|
223
|
+
"70080000_0009000000" => "0319966601",
|
224
|
+
"61080006_0009999999" => "0202427500",
|
225
|
+
"12080000_0012121212" => "4101725100",
|
226
|
+
"29080010_0012412400" => "0107502000",
|
227
|
+
"34280032_0014111935" => "0645753800",
|
228
|
+
"38040007_0043434343" => "0118163500",
|
229
|
+
"30080000_0070000000" => "0800005000",
|
230
|
+
"70080000_0070000000" => "0750055500",
|
231
|
+
"44040037_0111111111" => "0320565500",
|
232
|
+
"70040041_0400500500" => "0400500500",
|
233
|
+
"60080000_0500500500" => "0901581400",
|
234
|
+
"60040071_0500500500" => "0512700600",
|
235
235
|
}.freeze
|
236
236
|
|
237
237
|
def converted_details
|
@@ -243,8 +243,8 @@ module Ibandit
|
|
243
243
|
end
|
244
244
|
|
245
245
|
if EXCEPTION_BANK_CODES.include?(@bank_code) &&
|
246
|
-
|
247
|
-
msg =
|
246
|
+
updated_account_number.to_i.between?(998000000, 999499999)
|
247
|
+
msg = "Account does not support payment transactions"
|
248
248
|
raise UnsupportedAccountDetails, msg
|
249
249
|
end
|
250
250
|
|
@@ -262,21 +262,21 @@ module Ibandit
|
|
262
262
|
end
|
263
263
|
|
264
264
|
def padded_account_number_for_validity
|
265
|
-
unpadded_account_number = @account_number.gsub(/\A0+/,
|
265
|
+
unpadded_account_number = @account_number.gsub(/\A0+/, "")
|
266
266
|
|
267
267
|
case GermanDetailsConverter.rules[@bank_code][:check_digit_rule]
|
268
|
-
when
|
268
|
+
when "13"
|
269
269
|
if unpadded_account_number.size.between?(6, 7)
|
270
|
-
unpadded_account_number +
|
270
|
+
unpadded_account_number + "00"
|
271
271
|
else @account_number
|
272
272
|
end
|
273
|
-
when
|
273
|
+
when "76"
|
274
274
|
case unpadded_account_number.size
|
275
275
|
when 7..8
|
276
276
|
if Check76.new(@account_number).valid? then @account_number
|
277
|
-
else unpadded_account_number +
|
277
|
+
else unpadded_account_number + "00"
|
278
278
|
end
|
279
|
-
when 5..6 then unpadded_account_number +
|
279
|
+
when 5..6 then unpadded_account_number + "00"
|
280
280
|
else @account_number
|
281
281
|
end
|
282
282
|
else @account_number
|
@@ -285,7 +285,7 @@ module Ibandit
|
|
285
285
|
|
286
286
|
class Check76
|
287
287
|
def initialize(account_number)
|
288
|
-
@account_number = account_number.rjust(10,
|
288
|
+
@account_number = account_number.rjust(10, "0")
|
289
289
|
end
|
290
290
|
|
291
291
|
def valid?
|
@@ -296,7 +296,7 @@ module Ibandit
|
|
296
296
|
private
|
297
297
|
|
298
298
|
def master_number
|
299
|
-
@account_number.slice(1, 7).gsub(/\A0+/,
|
299
|
+
@account_number.slice(1, 7).gsub(/\A0+/, "")
|
300
300
|
end
|
301
301
|
|
302
302
|
def remainder
|
@@ -329,10 +329,10 @@ module Ibandit
|
|
329
329
|
include PseudoAccountNumberBehaviour
|
330
330
|
|
331
331
|
@pseudo_account_number_mapping = {
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
332
|
+
"0001111111" => "0020228888",
|
333
|
+
"0007777777" => "0903286003",
|
334
|
+
"0034343434" => "1000506517",
|
335
|
+
"0000070000" => "0018180018",
|
336
336
|
}
|
337
337
|
end
|
338
338
|
|
@@ -340,75 +340,75 @@ module Ibandit
|
|
340
340
|
include PseudoAccountNumberBehaviour
|
341
341
|
|
342
342
|
@pseudo_account_number_mapping = {
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
343
|
+
"0000000111" => "0000001115",
|
344
|
+
"0000000221" => "0023002157",
|
345
|
+
"0000001888" => "0018882068",
|
346
|
+
"0000002006" => "1900668508",
|
347
|
+
"0000002626" => "1900730100",
|
348
|
+
"0000003004" => "1900637016",
|
349
|
+
"0000003636" => "0023002447",
|
350
|
+
"0000004000" => "0000004028",
|
351
|
+
"0000004444" => "0000017368",
|
352
|
+
"0000005050" => "0000073999",
|
353
|
+
"0000008888" => "1901335750",
|
354
|
+
"0000030000" => "0009992959",
|
355
|
+
"0000043430" => "1901693331",
|
356
|
+
"0000046664" => "1900399856",
|
357
|
+
"0000055555" => "0034407379",
|
358
|
+
"0000102030" => "1900480466",
|
359
|
+
"0000151515" => "0057762957",
|
360
|
+
"0000222222" => "0002222222",
|
361
|
+
"0000300000" => "0009992959",
|
362
|
+
"0000333333" => "0000033217",
|
363
|
+
"0000414141" => "0000092817",
|
364
|
+
"0000606060" => "0000091025",
|
365
|
+
"0000909090" => "0000090944",
|
366
|
+
"0002602024" => "0005602024",
|
367
|
+
"0003000000" => "0009992959",
|
368
|
+
"0007777777" => "0002222222",
|
369
|
+
"0008090100" => "0000038901",
|
370
|
+
"0014141414" => "0043597665",
|
371
|
+
"0015000023" => "0015002223",
|
372
|
+
"0015151515" => "0057762957",
|
373
|
+
"0022222222" => "0002222222",
|
374
|
+
"0200820082" => "1901783868",
|
375
|
+
"0222220022" => "0002222222",
|
376
376
|
}
|
377
377
|
end
|
378
378
|
|
379
379
|
class Rule000800 < BaseRule
|
380
380
|
def converted_details
|
381
|
-
{ bank_code:
|
381
|
+
{ bank_code: "50020200", account_number: @account_number }
|
382
382
|
end
|
383
383
|
end
|
384
384
|
|
385
385
|
class Rule000900 < BaseRule
|
386
386
|
def converted_details
|
387
387
|
updated_account_number =
|
388
|
-
if @account_number.rjust(10,
|
388
|
+
if @account_number.rjust(10, "0").slice(0, 4) == "1116"
|
389
389
|
"3047#{@account_number.rjust(10, '0').slice(4, 6)}"
|
390
390
|
else
|
391
391
|
@account_number
|
392
392
|
end
|
393
393
|
|
394
|
-
{ bank_code:
|
394
|
+
{ bank_code: "68351557", account_number: updated_account_number }
|
395
395
|
end
|
396
396
|
end
|
397
397
|
|
398
398
|
class Rule001001 < BaseRule
|
399
399
|
PSEUDO_ACCOUNT_NUMBER_MAPPING = {
|
400
|
-
|
401
|
-
|
400
|
+
"50050201_0000002000" => "0000222000",
|
401
|
+
"50050201_0000800000" => "0000180802",
|
402
402
|
}.freeze
|
403
403
|
|
404
404
|
BANK_CODE_MAPPING = {
|
405
|
-
|
405
|
+
"50050222" => "50050201",
|
406
406
|
}.freeze
|
407
407
|
|
408
408
|
def converted_details
|
409
409
|
updated_account_number = PSEUDO_ACCOUNT_NUMBER_MAPPING.fetch(
|
410
410
|
"#{@bank_code}_#{@account_number.rjust(10, '0')}",
|
411
|
-
@account_number
|
411
|
+
@account_number,
|
412
412
|
)
|
413
413
|
updated_bank_code = BANK_CODE_MAPPING.fetch(@bank_code, @bank_code)
|
414
414
|
|
@@ -420,26 +420,26 @@ module Ibandit
|
|
420
420
|
include PseudoAccountNumberBehaviour
|
421
421
|
|
422
422
|
@pseudo_account_number_mapping = {
|
423
|
-
|
424
|
-
|
423
|
+
"0000001000" => "0008010001",
|
424
|
+
"0000047800" => "0000047803",
|
425
425
|
}
|
426
426
|
end
|
427
427
|
|
428
428
|
class Rule001201 < BaseRule
|
429
429
|
def converted_details
|
430
|
-
{ bank_code:
|
430
|
+
{ bank_code: "50050000", account_number: @account_number }
|
431
431
|
end
|
432
432
|
end
|
433
433
|
|
434
434
|
class Rule001301 < BaseRule
|
435
435
|
def converted_details
|
436
|
-
{ bank_code:
|
436
|
+
{ bank_code: "30050000", account_number: @account_number }
|
437
437
|
end
|
438
438
|
end
|
439
439
|
|
440
440
|
class Rule001400 < BaseRule
|
441
441
|
def converted_details
|
442
|
-
{ bank_code:
|
442
|
+
{ bank_code: "30060601", account_number: @account_number }
|
443
443
|
end
|
444
444
|
end
|
445
445
|
|
@@ -447,41 +447,41 @@ module Ibandit
|
|
447
447
|
include PseudoAccountNumberBehaviour
|
448
448
|
|
449
449
|
@pseudo_account_number_mapping = {
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
450
|
+
"0000000094" => "3008888018",
|
451
|
+
"0000000556" => "0000101010",
|
452
|
+
"0000000888" => "0031870011",
|
453
|
+
"0000004040" => "4003600101",
|
454
|
+
"0000005826" => "1015826017",
|
455
|
+
"0000025000" => "0025000110",
|
456
|
+
"0000393393" => "0033013019",
|
457
|
+
"0000444555" => "0032230016",
|
458
|
+
"0000603060" => "6002919018",
|
459
|
+
"0002120041" => "0002130041",
|
460
|
+
"0080868086" => "4007375013",
|
461
|
+
"0400569017" => "4000569017",
|
462
462
|
}
|
463
463
|
end
|
464
464
|
|
465
465
|
class Rule001600 < BaseRule
|
466
466
|
include PseudoAccountNumberBehaviour
|
467
467
|
|
468
|
-
@pseudo_account_number_mapping = {
|
468
|
+
@pseudo_account_number_mapping = { "0000300000" => "0018128012" }
|
469
469
|
end
|
470
470
|
|
471
471
|
class Rule001700 < BaseRule
|
472
472
|
include PseudoAccountNumberBehaviour
|
473
473
|
|
474
474
|
@pseudo_account_number_mapping = {
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
475
|
+
"0000000100" => "2009090013",
|
476
|
+
"0000000111" => "2111111017",
|
477
|
+
"0000000240" => "2100240010",
|
478
|
+
"0000004004" => "2204004016",
|
479
|
+
"0000004444" => "2044444014",
|
480
|
+
"0000006060" => "2016060014",
|
481
|
+
"0000102030" => "1102030016",
|
482
|
+
"0000333333" => "2033333016",
|
483
|
+
"0000909090" => "2009090013",
|
484
|
+
"0050005000" => "5000500013",
|
485
485
|
}
|
486
486
|
end
|
487
487
|
|
@@ -489,40 +489,40 @@ module Ibandit
|
|
489
489
|
include PseudoAccountNumberBehaviour
|
490
490
|
|
491
491
|
@pseudo_account_number_mapping = {
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
492
|
+
"0000000556" => "0120440110",
|
493
|
+
"5435435430" => "0543543543",
|
494
|
+
"0000002157" => "0121787016",
|
495
|
+
"0000009800" => "0120800019",
|
496
|
+
"0000202050" => "1221864014",
|
497
497
|
}
|
498
498
|
end
|
499
499
|
|
500
500
|
class Rule001900 < BaseRule
|
501
501
|
def converted_details
|
502
|
-
{ bank_code:
|
502
|
+
{ bank_code: "50120383", account_number: @account_number }
|
503
503
|
end
|
504
504
|
end
|
505
505
|
|
506
506
|
class Rule002002 < BaseRule
|
507
507
|
def converted_details
|
508
|
-
unpadded_account_number = @account_number.gsub(/\A0+/,
|
508
|
+
unpadded_account_number = @account_number.gsub(/\A0+/, "")
|
509
509
|
|
510
|
-
if unpadded_account_number ==
|
511
|
-
return { bank_code:
|
510
|
+
if unpadded_account_number == "9999" && @bank_code == "50070010"
|
511
|
+
return { bank_code: "50070010", account_number: "92777202" }
|
512
512
|
end
|
513
513
|
|
514
514
|
updated_account_number =
|
515
515
|
case unpadded_account_number.size
|
516
|
-
when 5, 6 then unpadded_account_number +
|
516
|
+
when 5, 6 then unpadded_account_number + "00"
|
517
517
|
when 7 then
|
518
|
-
if Check63.new(unpadded_account_number +
|
519
|
-
unpadded_account_number +
|
518
|
+
if Check63.new(unpadded_account_number + "00").valid?
|
519
|
+
unpadded_account_number + "00"
|
520
520
|
else
|
521
521
|
unpadded_account_number
|
522
522
|
end
|
523
523
|
when 8, 9 then unpadded_account_number
|
524
524
|
else
|
525
|
-
msg =
|
525
|
+
msg = "Account does not support payment transactions"
|
526
526
|
raise UnsupportedAccountDetails, msg
|
527
527
|
end
|
528
528
|
|
@@ -532,7 +532,7 @@ module Ibandit
|
|
532
532
|
class Check63
|
533
533
|
# A Deutsche Bank specific variant of Check 63
|
534
534
|
def initialize(account_number)
|
535
|
-
@account_number = account_number.dup.rjust(10,
|
535
|
+
@account_number = account_number.dup.rjust(10, "0")
|
536
536
|
end
|
537
537
|
|
538
538
|
def valid?
|
@@ -566,36 +566,36 @@ module Ibandit
|
|
566
566
|
|
567
567
|
class Rule002101 < BaseRule
|
568
568
|
def converted_details
|
569
|
-
{ bank_code:
|
569
|
+
{ bank_code: "36020030", account_number: @account_number }
|
570
570
|
end
|
571
571
|
end
|
572
572
|
|
573
573
|
class Rule002200 < BaseRule
|
574
574
|
include PseudoAccountNumberBehaviour
|
575
575
|
|
576
|
-
@pseudo_account_number_mapping = {
|
576
|
+
@pseudo_account_number_mapping = { "0001111111" => "2222200000" }
|
577
577
|
end
|
578
578
|
|
579
579
|
class Rule002300 < BaseRule
|
580
580
|
include PseudoAccountNumberBehaviour
|
581
581
|
|
582
|
-
@pseudo_account_number_mapping = {
|
582
|
+
@pseudo_account_number_mapping = { "0000000700" => "1000700800" }
|
583
583
|
end
|
584
584
|
|
585
585
|
class Rule002400 < BaseRule
|
586
586
|
include PseudoAccountNumberBehaviour
|
587
587
|
|
588
588
|
@pseudo_account_number_mapping = {
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
589
|
+
"0000000094" => "0000001694",
|
590
|
+
"0000000248" => "0000017248",
|
591
|
+
"0000000345" => "0000017345",
|
592
|
+
"0000000400" => "0000014400",
|
593
593
|
}
|
594
594
|
end
|
595
595
|
|
596
596
|
class Rule002500 < BaseRule
|
597
597
|
def converted_details
|
598
|
-
{ bank_code:
|
598
|
+
{ bank_code: "60050101", account_number: @account_number }
|
599
599
|
end
|
600
600
|
end
|
601
601
|
|
@@ -609,14 +609,14 @@ module Ibandit
|
|
609
609
|
|
610
610
|
class Rule002800 < BaseRule
|
611
611
|
def converted_details
|
612
|
-
{ bank_code:
|
612
|
+
{ bank_code: "25050180", account_number: @account_number }
|
613
613
|
end
|
614
614
|
end
|
615
615
|
|
616
616
|
class Rule002900 < BaseRule
|
617
617
|
def converted_details
|
618
618
|
updated_account_number =
|
619
|
-
if @account_number.size == 10 && @account_number[3] ==
|
619
|
+
if @account_number.size == 10 && @account_number[3] == "0"
|
620
620
|
"0#{@account_number.slice(0, 3)}#{@account_number.slice(4, 6)}"
|
621
621
|
else
|
622
622
|
@account_number
|
@@ -636,172 +636,172 @@ module Ibandit
|
|
636
636
|
# other checks though.
|
637
637
|
#
|
638
638
|
BANK_CODE_MAPPING = {
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
639
|
+
"100" => "76020070", "101" => "10020890", "102" => "78320076",
|
640
|
+
"103" => "79320075", "104" => "76320072", "105" => "79020076",
|
641
|
+
"106" => "79320075", "107" => "79320075", "108" => "77320072",
|
642
|
+
"109" => "79320075", "110" => "76220073", "111" => "76020070",
|
643
|
+
"112" => "79320075", "113" => "76020070", "114" => "76020070",
|
644
|
+
"115" => "76520071", "117" => "77120073", "118" => "76020070",
|
645
|
+
"119" => "75320075", "120" => "72120078", "121" => "76220073",
|
646
|
+
"122" => "76320072", "123" => "76420080", "124" => "76320072",
|
647
|
+
"125" => "79520070", "126" => "77320072", "127" => "78020070",
|
648
|
+
"128" => "78020070", "129" => "77120073", "130" => "78020070",
|
649
|
+
"131" => "78020070", "132" => "60020290", "134" => "78020070",
|
650
|
+
"135" => "77020070", "136" => "79520070", "137" => "79320075",
|
651
|
+
"138" => "61120286", "139" => "66020286", "140" => "79020076",
|
652
|
+
"142" => "64020186", "143" => "60020290", "144" => "79020076",
|
653
|
+
"145" => "66020286", "146" => "72120078", "147" => "72223182",
|
654
|
+
"148" => "76520071", "149" => "79020076", "150" => "76020070",
|
655
|
+
"151" => "76320072", "152" => "78320076", "154" => "70020270",
|
656
|
+
"155" => "76520071", "156" => "76020070", "157" => "10020890",
|
657
|
+
"158" => "70020270", "159" => "54520194", "160" => "70020270",
|
658
|
+
"161" => "54520194", "162" => "70020270", "163" => "70020270",
|
659
|
+
"164" => "70020270", "166" => "71120078", "167" => "74320073",
|
660
|
+
"168" => "70320090", "169" => "79020076", "170" => "70020270",
|
661
|
+
"172" => "70020270", "174" => "70020270", "175" => "72120078",
|
662
|
+
"176" => "74020074", "177" => "74320073", "178" => "70020270",
|
663
|
+
"181" => "77320072", "182" => "79520070", "183" => "70020270",
|
664
|
+
"185" => "70020270", "186" => "79020076", "188" => "70020270",
|
665
|
+
"189" => "70020270", "190" => "76020070", "191" => "77020070",
|
666
|
+
"192" => "70025175", "193" => "85020086", "194" => "76020070",
|
667
|
+
"196" => "72020070", "198" => "76320072", "199" => "70020270",
|
668
|
+
"201" => "76020070", "202" => "76020070", "203" => "76020070",
|
669
|
+
"204" => "76020070", "205" => "79520070", "206" => "79520070",
|
670
|
+
"207" => "71120078", "208" => "73120075", "209" => "18020086",
|
671
|
+
"210" => "10020890", "211" => "60020290", "212" => "51020186",
|
672
|
+
"214" => "75020073", "215" => "63020086", "216" => "75020073",
|
673
|
+
"217" => "79020076", "218" => "59020090", "219" => "79520070",
|
674
|
+
"220" => "73322380", "221" => "73120075", "222" => "73421478",
|
675
|
+
"223" => "74320073", "224" => "73322380", "225" => "74020074",
|
676
|
+
"227" => "75020073", "228" => "71120078", "229" => "80020086",
|
677
|
+
"230" => "72120078", "231" => "72020070", "232" => "75021174",
|
678
|
+
"233" => "71020072", "234" => "71022182", "235" => "74320073",
|
679
|
+
"236" => "71022182", "237" => "76020070", "238" => "63020086",
|
680
|
+
"239" => "70020270", "240" => "75320075", "241" => "76220073",
|
681
|
+
"243" => "72020070", "245" => "72120078", "246" => "74320073",
|
682
|
+
"247" => "60020290", "248" => "85020086", "249" => "73321177",
|
683
|
+
"250" => "73420071", "251" => "70020270", "252" => "70020270",
|
684
|
+
"253" => "70020270", "254" => "10020890", "255" => "50820292",
|
685
|
+
"256" => "71022182", "257" => "83020086", "258" => "79320075",
|
686
|
+
"259" => "71120077", "260" => "10020890", "261" => "70025175",
|
687
|
+
"262" => "72020070", "264" => "74020074", "267" => "63020086",
|
688
|
+
"268" => "70320090", "269" => "71122183", "270" => "82020086",
|
689
|
+
"271" => "75020073", "272" => "73420071", "274" => "63020086",
|
690
|
+
"276" => "70020270", "277" => "74320073", "278" => "71120077",
|
691
|
+
"279" => "10020890", "281" => "71120078", "282" => "70020270",
|
692
|
+
"283" => "72020070", "284" => "79320075", "286" => "54520194",
|
693
|
+
"287" => "70020270", "288" => "75220070", "291" => "77320072",
|
694
|
+
"292" => "76020070", "293" => "72020070", "294" => "54520194",
|
695
|
+
"295" => "70020270", "296" => "70020270", "299" => "72020070",
|
696
|
+
"301" => "85020086", "302" => "54520194", "304" => "70020270",
|
697
|
+
"308" => "70020270", "309" => "54520194", "310" => "72020070",
|
698
|
+
"312" => "74120071", "313" => "76320072", "314" => "70020270",
|
699
|
+
"315" => "70020270", "316" => "70020270", "317" => "70020270",
|
700
|
+
"318" => "70020270", "320" => "71022182", "321" => "75220070",
|
701
|
+
"322" => "79520070", "324" => "70020270", "326" => "85020086",
|
702
|
+
"327" => "72020070", "328" => "72020070", "329" => "70020270",
|
703
|
+
"330" => "76020070", "331" => "70020270", "333" => "70020270",
|
704
|
+
"334" => "75020073", "335" => "70020270", "337" => "80020086",
|
705
|
+
"341" => "10020890", "342" => "10020890", "344" => "70020270",
|
706
|
+
"345" => "77020070", "346" => "76020070", "350" => "79320075",
|
707
|
+
"351" => "79320075", "352" => "70020270", "353" => "70020270",
|
708
|
+
"354" => "72223182", "355" => "72020070", "356" => "70020270",
|
709
|
+
"358" => "54220091", "359" => "76220073", "360" => "80020087",
|
710
|
+
"361" => "70020270", "362" => "70020270", "363" => "70020270",
|
711
|
+
"366" => "72220074", "367" => "70020270", "368" => "10020890",
|
712
|
+
"369" => "76520071", "370" => "85020086", "371" => "70020270",
|
713
|
+
"373" => "70020270", "374" => "73120075", "375" => "70020270",
|
714
|
+
"379" => "70020270", "380" => "70020270", "381" => "70020270",
|
715
|
+
"382" => "79520070", "383" => "72020070", "384" => "72020070",
|
716
|
+
"386" => "70020270", "387" => "70020270", "389" => "70020270",
|
717
|
+
"390" => "67020190", "391" => "70020270", "392" => "70020270",
|
718
|
+
"393" => "54520194", "394" => "70020270", "396" => "70020270",
|
719
|
+
"398" => "66020286", "399" => "87020088", "401" => "30220190",
|
720
|
+
"402" => "36020186", "403" => "38020090", "404" => "30220190",
|
721
|
+
"405" => "68020186", "406" => "48020086", "407" => "37020090",
|
722
|
+
"408" => "68020186", "409" => "10020890", "410" => "66020286",
|
723
|
+
"411" => "60420186", "412" => "57020086", "422" => "70020270",
|
724
|
+
"423" => "70020270", "424" => "76020070", "426" => "70025175",
|
725
|
+
"427" => "50320191", "428" => "70020270", "429" => "85020086",
|
726
|
+
"432" => "70020270", "434" => "60020290", "435" => "76020070",
|
727
|
+
"436" => "76020070", "437" => "70020270", "438" => "70020270",
|
728
|
+
"439" => "70020270", "440" => "70020270", "441" => "70020270",
|
729
|
+
"442" => "85020086", "443" => "55020486", "444" => "50520190",
|
730
|
+
"446" => "80020086", "447" => "70020270", "450" => "30220190",
|
731
|
+
"451" => "44020090", "452" => "70020270", "453" => "70020270",
|
732
|
+
"456" => "10020890", "457" => "87020086", "458" => "54520194",
|
733
|
+
"459" => "61120286", "460" => "70020270", "461" => "70020270",
|
734
|
+
"462" => "70020270", "463" => "70020270", "465" => "70020270",
|
735
|
+
"466" => "10020890", "467" => "10020890", "468" => "70020270",
|
736
|
+
"469" => "60320291", "470" => "65020186", "471" => "84020087",
|
737
|
+
"472" => "76020070", "473" => "74020074", "476" => "78320076",
|
738
|
+
"477" => "78320076", "478" => "87020088", "480" => "70020270",
|
739
|
+
"481" => "70020270", "482" => "84020087", "484" => "70020270",
|
740
|
+
"485" => "50320191", "486" => "70020270", "488" => "67220286",
|
741
|
+
"489" => "10020890", "490" => "10020890", "491" => "16020086",
|
742
|
+
"492" => "10020890", "494" => "79020076", "495" => "87020088",
|
743
|
+
"497" => "87020087", "499" => "79020076", "502" => "10020890",
|
744
|
+
"503" => "10020890", "505" => "70020270", "506" => "10020890",
|
745
|
+
"507" => "87020086", "508" => "86020086", "509" => "83020087",
|
746
|
+
"510" => "80020086", "511" => "83020086", "513" => "85020086",
|
747
|
+
"515" => "17020086", "518" => "82020086", "519" => "83020086",
|
748
|
+
"522" => "10020890", "523" => "70020270", "524" => "85020086",
|
749
|
+
"525" => "70020270", "527" => "82020088", "528" => "10020890",
|
750
|
+
"530" => "10020890", "531" => "10020890", "533" => "50320191",
|
751
|
+
"534" => "70020270", "536" => "85020086", "538" => "82020086",
|
752
|
+
"540" => "65020186", "541" => "80020087", "545" => "18020086",
|
753
|
+
"546" => "10020890", "547" => "10020890", "548" => "10020890",
|
754
|
+
"549" => "82020087", "555" => "79020076", "560" => "79320075",
|
755
|
+
"567" => "86020086", "572" => "10020890", "580" => "70020270",
|
756
|
+
"581" => "70020270", "601" => "74320073", "602" => "70020270",
|
757
|
+
"603" => "70020270", "604" => "70020270", "605" => "70020270",
|
758
|
+
"606" => "70020270", "607" => "74320073", "608" => "72020070",
|
759
|
+
"609" => "72020070", "610" => "72020070", "611" => "72020070",
|
760
|
+
"612" => "71120077", "613" => "70020270", "614" => "72020070",
|
761
|
+
"615" => "70025175", "616" => "73420071", "617" => "68020186",
|
762
|
+
"618" => "73120075", "619" => "60020290", "620" => "71120077",
|
763
|
+
"621" => "71120077", "622" => "74320073", "623" => "72020070",
|
764
|
+
"624" => "71020072", "625" => "71023173", "626" => "71020072",
|
765
|
+
"627" => "71021270", "628" => "71120077", "629" => "73120075",
|
766
|
+
"630" => "71121176", "631" => "71022182", "632" => "70020270",
|
767
|
+
"633" => "74320073", "634" => "70020270", "635" => "70320090",
|
768
|
+
"636" => "70320090", "637" => "72120078", "638" => "72120078",
|
769
|
+
"640" => "70020270", "641" => "70020270", "643" => "74320073",
|
770
|
+
"644" => "70020270", "645" => "70020270", "646" => "70020270",
|
771
|
+
"647" => "70020270", "648" => "72120078", "649" => "72122181",
|
772
|
+
"650" => "54520194", "652" => "71021270", "653" => "70020270",
|
773
|
+
"654" => "70020270", "655" => "72120078", "656" => "71120078",
|
774
|
+
"657" => "71020072", "658" => "68020186", "659" => "54520194",
|
775
|
+
"660" => "54620093", "661" => "74320073", "662" => "73120075",
|
776
|
+
"663" => "70322192", "664" => "72120078", "665" => "70321194",
|
777
|
+
"666" => "73322380", "667" => "60020290", "668" => "60020290",
|
778
|
+
"669" => "73320073", "670" => "75020073", "671" => "74220075",
|
779
|
+
"672" => "74020074", "673" => "74020074", "674" => "74120071",
|
780
|
+
"675" => "74020074", "676" => "74020074", "677" => "72020070",
|
781
|
+
"678" => "72020070", "679" => "54520194", "680" => "71120077",
|
782
|
+
"681" => "67020190", "682" => "78020070", "683" => "71020072",
|
783
|
+
"684" => "70020270", "685" => "70020270", "686" => "70020270",
|
784
|
+
"687" => "70020270", "688" => "70020270", "689" => "70020270",
|
785
|
+
"690" => "76520071", "692" => "70020270", "693" => "73420071",
|
786
|
+
"694" => "70021180", "695" => "70320090", "696" => "74320073",
|
787
|
+
"697" => "54020090", "698" => "73320073", "710" => "30220190",
|
788
|
+
"711" => "70020270", "712" => "10020890", "714" => "76020070",
|
789
|
+
"715" => "75020073", "717" => "74320073", "718" => "87020086",
|
790
|
+
"719" => "37020090", "720" => "30220190", "723" => "77320072",
|
791
|
+
"733" => "83020087", "798" => "70020270"
|
792
792
|
}.freeze
|
793
793
|
end
|
794
794
|
|
795
795
|
class Rule003200 < BaseRule
|
796
796
|
def converted_details
|
797
797
|
if @account_number.to_i.between?(800000000, 899999999)
|
798
|
-
msg =
|
798
|
+
msg = "Account does not support payment transactions"
|
799
799
|
raise UnsupportedAccountDetails, msg
|
800
800
|
end
|
801
801
|
|
802
802
|
updated_bank_code = Rule003101::BANK_CODE_MAPPING.fetch(
|
803
|
-
@account_number.rjust(10,
|
804
|
-
@bank_code
|
803
|
+
@account_number.rjust(10, "0").slice(0, 3),
|
804
|
+
@bank_code,
|
805
805
|
)
|
806
806
|
|
807
807
|
{ bank_code: updated_bank_code, account_number: @account_number }
|
@@ -810,22 +810,22 @@ module Ibandit
|
|
810
810
|
|
811
811
|
class Rule003301 < BaseRule
|
812
812
|
PSEUDO_ACCOUNT_NUMBER_MAPPING = {
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
813
|
+
"0000022222" => "5803435253",
|
814
|
+
"0001111111" => "0039908140",
|
815
|
+
"0000000094" => "0002711931",
|
816
|
+
"0007777777" => "5800522694",
|
817
|
+
"0000055555" => "5801800000",
|
818
818
|
}.freeze
|
819
819
|
|
820
820
|
def converted_details
|
821
821
|
updated_bank_code = Rule003101::BANK_CODE_MAPPING.fetch(
|
822
|
-
@account_number.rjust(10,
|
823
|
-
@bank_code
|
822
|
+
@account_number.rjust(10, "0").slice(0, 3),
|
823
|
+
@bank_code,
|
824
824
|
)
|
825
825
|
|
826
826
|
updated_account_number = PSEUDO_ACCOUNT_NUMBER_MAPPING.fetch(
|
827
|
-
@account_number.rjust(10,
|
828
|
-
@account_number
|
827
|
+
@account_number.rjust(10, "0"),
|
828
|
+
@account_number,
|
829
829
|
)
|
830
830
|
|
831
831
|
{ bank_code: updated_bank_code, account_number: updated_account_number }
|
@@ -834,24 +834,24 @@ module Ibandit
|
|
834
834
|
|
835
835
|
class Rule003400 < BaseRule
|
836
836
|
PSEUDO_ACCOUNT_NUMBER_MAPPING = {
|
837
|
-
|
838
|
-
|
837
|
+
"0500500500" => "4340111112",
|
838
|
+
"0000000502" => "4340118001",
|
839
839
|
}.freeze
|
840
840
|
|
841
841
|
def converted_details
|
842
842
|
if @account_number.to_i.between?(800000000, 899999999)
|
843
|
-
msg =
|
843
|
+
msg = "Account does not support payment transactions"
|
844
844
|
raise UnsupportedAccountDetails, msg
|
845
845
|
end
|
846
846
|
|
847
847
|
updated_bank_code = Rule003101::BANK_CODE_MAPPING.fetch(
|
848
|
-
@account_number.rjust(10,
|
849
|
-
@bank_code
|
848
|
+
@account_number.rjust(10, "0").slice(0, 3),
|
849
|
+
@bank_code,
|
850
850
|
)
|
851
851
|
|
852
852
|
updated_account_number = PSEUDO_ACCOUNT_NUMBER_MAPPING.fetch(
|
853
|
-
@account_number.rjust(10,
|
854
|
-
@account_number
|
853
|
+
@account_number.rjust(10, "0"),
|
854
|
+
@account_number,
|
855
855
|
)
|
856
856
|
|
857
857
|
{ bank_code: updated_bank_code, account_number: updated_account_number }
|
@@ -859,22 +859,22 @@ module Ibandit
|
|
859
859
|
end
|
860
860
|
|
861
861
|
class Rule003501 < BaseRule
|
862
|
-
PSEUDO_ACCOUNT_NUMBER_MAPPING = {
|
862
|
+
PSEUDO_ACCOUNT_NUMBER_MAPPING = { "0000009696" => "1490196966" }.freeze
|
863
863
|
|
864
864
|
def converted_details
|
865
865
|
if @account_number.to_i.between?(800000000, 899999999)
|
866
|
-
msg =
|
866
|
+
msg = "Account does not support payment transactions"
|
867
867
|
raise UnsupportedAccountDetails, msg
|
868
868
|
end
|
869
869
|
|
870
870
|
updated_bank_code = Rule003101::BANK_CODE_MAPPING.fetch(
|
871
|
-
@account_number.rjust(10,
|
872
|
-
@bank_code
|
871
|
+
@account_number.rjust(10, "0").slice(0, 3),
|
872
|
+
@bank_code,
|
873
873
|
)
|
874
874
|
|
875
875
|
updated_account_number = PSEUDO_ACCOUNT_NUMBER_MAPPING.fetch(
|
876
|
-
@account_number.rjust(10,
|
877
|
-
@account_number
|
876
|
+
@account_number.rjust(10, "0"),
|
877
|
+
@account_number,
|
878
878
|
)
|
879
879
|
|
880
880
|
{ bank_code: updated_bank_code, account_number: updated_account_number }
|
@@ -885,7 +885,7 @@ module Ibandit
|
|
885
885
|
def converted_details
|
886
886
|
updated_account_number =
|
887
887
|
case @account_number.to_i
|
888
|
-
when 100000..899999 then @account_number +
|
888
|
+
when 100000..899999 then @account_number + "000"
|
889
889
|
when 30000000..59999999 then @account_number
|
890
890
|
when 100000000..899999999 then @account_number
|
891
891
|
when 1000000000..1999999999 then @account_number
|
@@ -895,58 +895,58 @@ module Ibandit
|
|
895
895
|
else disallow
|
896
896
|
end
|
897
897
|
|
898
|
-
{ bank_code:
|
898
|
+
{ bank_code: "20050000", account_number: updated_account_number }
|
899
899
|
end
|
900
900
|
|
901
901
|
private
|
902
902
|
|
903
903
|
def disallow
|
904
|
-
msg =
|
904
|
+
msg = "Account does not support payment transactions"
|
905
905
|
raise UnsupportedAccountDetails, msg
|
906
906
|
end
|
907
907
|
end
|
908
908
|
|
909
909
|
class Rule003700 < BaseRule
|
910
910
|
def converted_details
|
911
|
-
{ bank_code:
|
911
|
+
{ bank_code: "30010700", account_number: @account_number }
|
912
912
|
end
|
913
913
|
end
|
914
914
|
|
915
915
|
class Rule003800 < BaseRule
|
916
916
|
def converted_details
|
917
|
-
{ bank_code:
|
917
|
+
{ bank_code: "28590075", account_number: @account_number }
|
918
918
|
end
|
919
919
|
end
|
920
920
|
|
921
921
|
class Rule003900 < BaseRule
|
922
922
|
def converted_details
|
923
|
-
{ bank_code:
|
923
|
+
{ bank_code: "28020050", account_number: @account_number }
|
924
924
|
end
|
925
925
|
end
|
926
926
|
|
927
927
|
class Rule004001 < BaseRule
|
928
928
|
def converted_details
|
929
|
-
{ bank_code:
|
929
|
+
{ bank_code: "68052328", account_number: @account_number }
|
930
930
|
end
|
931
931
|
end
|
932
932
|
|
933
933
|
class Rule004100 < BaseRule
|
934
934
|
def converted_details
|
935
|
-
{ bank_code:
|
935
|
+
{ bank_code: "50060400", account_number: "0000011404" }
|
936
936
|
end
|
937
937
|
end
|
938
938
|
|
939
939
|
class Rule004200 < BaseRule
|
940
940
|
def converted_details
|
941
|
-
unpadded_account_number = @account_number.gsub(/\A0+/,
|
941
|
+
unpadded_account_number = @account_number.gsub(/\A0+/, "")
|
942
942
|
|
943
943
|
if @account_number.to_i.between?(50462000, 50463999) ||
|
944
|
-
|
944
|
+
@account_number.to_i.between?(50469000, 50469999)
|
945
945
|
{ bank_code: @bank_code, account_number: @account_number }
|
946
946
|
elsif unpadded_account_number.size != 8 ||
|
947
|
-
|
948
|
-
|
949
|
-
msg =
|
947
|
+
unpadded_account_number[3] != "0" ||
|
948
|
+
%w[00000 00999].include?(unpadded_account_number.slice(3, 5))
|
949
|
+
msg = "Account does not support payment transactions"
|
950
950
|
raise UnsupportedAccountDetails, msg
|
951
951
|
else
|
952
952
|
{ bank_code: @bank_code, account_number: @account_number }
|
@@ -956,14 +956,14 @@ module Ibandit
|
|
956
956
|
|
957
957
|
class Rule004301 < BaseRule
|
958
958
|
def converted_details
|
959
|
-
{ bank_code:
|
959
|
+
{ bank_code: "66650085", account_number: @account_number }
|
960
960
|
end
|
961
961
|
end
|
962
962
|
|
963
963
|
class Rule004400 < BaseRule
|
964
964
|
include PseudoAccountNumberBehaviour
|
965
965
|
|
966
|
-
@pseudo_account_number_mapping = {
|
966
|
+
@pseudo_account_number_mapping = { "0000000202" => "0002282022" }
|
967
967
|
end
|
968
968
|
|
969
969
|
class Rule004501 < Rule000000
|
@@ -973,19 +973,19 @@ module Ibandit
|
|
973
973
|
|
974
974
|
class Rule004600 < BaseRule
|
975
975
|
def converted_details
|
976
|
-
{ bank_code:
|
976
|
+
{ bank_code: "31010833", account_number: @account_number }
|
977
977
|
end
|
978
978
|
end
|
979
979
|
|
980
980
|
class Rule004700 < BaseRule
|
981
981
|
def converted_details
|
982
|
-
unpadded_account_number = @account_number.gsub(/\A0+/,
|
982
|
+
unpadded_account_number = @account_number.gsub(/\A0+/, "")
|
983
983
|
|
984
984
|
updated_account_number =
|
985
985
|
if unpadded_account_number.size == 8
|
986
|
-
unpadded_account_number.ljust(10,
|
986
|
+
unpadded_account_number.ljust(10, "0")
|
987
987
|
else
|
988
|
-
unpadded_account_number.rjust(10,
|
988
|
+
unpadded_account_number.rjust(10, "0")
|
989
989
|
end
|
990
990
|
|
991
991
|
{ bank_code: @bank_code, account_number: updated_account_number }
|
@@ -994,31 +994,31 @@ module Ibandit
|
|
994
994
|
|
995
995
|
class Rule004800 < BaseRule
|
996
996
|
def converted_details
|
997
|
-
{ bank_code:
|
997
|
+
{ bank_code: "36010200", account_number: @account_number }
|
998
998
|
end
|
999
999
|
end
|
1000
1000
|
|
1001
1001
|
class Rule004900 < BaseRule
|
1002
1002
|
PSEUDO_ACCOUNT_NUMBER_MAPPING = {
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1003
|
+
"0000000036" => "0002310113",
|
1004
|
+
"0000000936" => "0002310113",
|
1005
|
+
"0000000999" => "0001310113",
|
1006
|
+
"0000006060" => "0000160602",
|
1007
1007
|
}.freeze
|
1008
1008
|
|
1009
1009
|
def converted_details
|
1010
|
-
padded_account_number = @account_number.rjust(10,
|
1010
|
+
padded_account_number = @account_number.rjust(10, "0")
|
1011
1011
|
|
1012
1012
|
updated_account_number =
|
1013
|
-
if padded_account_number[4] ==
|
1013
|
+
if padded_account_number[4] == "9"
|
1014
1014
|
"#{padded_account_number[4, 6]}#{padded_account_number[0, 4]}"
|
1015
1015
|
else
|
1016
1016
|
@account_number
|
1017
1017
|
end
|
1018
1018
|
|
1019
1019
|
updated_account_number = PSEUDO_ACCOUNT_NUMBER_MAPPING.fetch(
|
1020
|
-
updated_account_number.rjust(10,
|
1021
|
-
updated_account_number
|
1020
|
+
updated_account_number.rjust(10, "0"),
|
1021
|
+
updated_account_number,
|
1022
1022
|
)
|
1023
1023
|
|
1024
1024
|
{ bank_code: @bank_code, account_number: updated_account_number }
|
@@ -1027,7 +1027,7 @@ module Ibandit
|
|
1027
1027
|
|
1028
1028
|
class Rule005000 < BaseRule
|
1029
1029
|
def converted_details
|
1030
|
-
{ bank_code:
|
1030
|
+
{ bank_code: "28550000", account_number: @account_number }
|
1031
1031
|
end
|
1032
1032
|
end
|
1033
1033
|
|
@@ -1035,31 +1035,31 @@ module Ibandit
|
|
1035
1035
|
include PseudoAccountNumberBehaviour
|
1036
1036
|
|
1037
1037
|
@pseudo_account_number_mapping = {
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1038
|
+
"0000000333" => "7832500881",
|
1039
|
+
"0000000502" => "0001108884",
|
1040
|
+
"0500500500" => "0005005000",
|
1041
|
+
"0502502502" => "0001108884",
|
1042
1042
|
}
|
1043
1043
|
end
|
1044
1044
|
|
1045
1045
|
class Rule005200 < BaseRule
|
1046
1046
|
PSEUDO_ACCOUNT_NUMBER_MAPPING = {
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1047
|
+
"67220020_5308810004" => "0002662604",
|
1048
|
+
"67220020_5308810000" => "0002659600",
|
1049
|
+
"67020020_5203145700" => "7496510994",
|
1050
|
+
"69421020_6208908100" => "7481501341",
|
1051
|
+
"66620020_4840404000" => "7498502663",
|
1052
|
+
"64120030_1201200100" => "7477501214",
|
1053
|
+
"64020030_1408050100" => "7469534505",
|
1054
|
+
"63020130_1112156300" => "0004475655",
|
1055
|
+
"62030050_7002703200" => "7406501175",
|
1056
|
+
"69220020_6402145400" => "7485500252",
|
1057
1057
|
}.freeze
|
1058
1058
|
|
1059
1059
|
def converted_details
|
1060
1060
|
updated_account_number = PSEUDO_ACCOUNT_NUMBER_MAPPING.fetch(
|
1061
1061
|
"#{@bank_code}_#{@account_number.rjust(10, '0')}",
|
1062
|
-
nil
|
1062
|
+
nil,
|
1063
1063
|
)
|
1064
1064
|
|
1065
1065
|
if updated_account_number.nil?
|
@@ -1067,69 +1067,69 @@ module Ibandit
|
|
1067
1067
|
raise UnsupportedAccountDetails, msg
|
1068
1068
|
end
|
1069
1069
|
|
1070
|
-
{ bank_code:
|
1070
|
+
{ bank_code: "60050101", account_number: updated_account_number }
|
1071
1071
|
end
|
1072
1072
|
end
|
1073
1073
|
|
1074
1074
|
class Rule005300 < BaseRule
|
1075
1075
|
PSEUDO_ACCOUNT_NUMBER_MAPPING = {
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1076
|
+
"55050000_0000035000" => "7401555913",
|
1077
|
+
"55050000_0119345106" => "7401555906",
|
1078
|
+
"55050000_0000000908" => "7401507480",
|
1079
|
+
"55050000_0000000901" => "7401507497",
|
1080
|
+
"55050000_0000000910" => "7401507466",
|
1081
|
+
"55050000_0000035100" => "7401555913",
|
1082
|
+
"55050000_0000000902" => "7401507473",
|
1083
|
+
"55050000_0000044000" => "7401555872",
|
1084
|
+
"55050000_0110132511" => "7401550530",
|
1085
|
+
"55050000_0110024270" => "7401501266",
|
1086
|
+
"55050000_0000003500" => "7401555913",
|
1087
|
+
"55050000_0110050002" => "7401502234",
|
1088
|
+
"55050000_0055020100" => "7401555872",
|
1089
|
+
"55050000_0110149226" => "7401512248",
|
1090
|
+
"60020030_1047444300" => "7871538395",
|
1091
|
+
"60020030_1040748400" => "0001366705",
|
1092
|
+
"60020030_1000617900" => "0002009906",
|
1093
|
+
"60020030_1003340500" => "0002001155",
|
1094
|
+
"60020030_1002999900" => "0002588991",
|
1095
|
+
"60020030_1004184600" => "7871513509",
|
1096
|
+
"60020030_1000919900" => "7871531505",
|
1097
|
+
"60020030_1054290000" => "7871521216",
|
1098
|
+
"60050000_0000001523" => "0001364934",
|
1099
|
+
"60050000_0000002811" => "0001367450",
|
1100
|
+
"60050000_0000002502" => "0001366705",
|
1101
|
+
"60050000_0000250412" => "7402051588",
|
1102
|
+
"60050000_0000003009" => "0001367924",
|
1103
|
+
"60050000_0000004596" => "0001372809",
|
1104
|
+
"60050000_0000003080" => "0002009906",
|
1105
|
+
"60050000_0001029204" => "0002782254",
|
1106
|
+
"60050000_0000003002" => "0001367924",
|
1107
|
+
"60050000_0000123456" => "0001362826",
|
1108
|
+
"60050000_0000002535" => "0001119897",
|
1109
|
+
"60050000_0000005500" => "0001375703",
|
1110
|
+
"66020020_4002401000" => "7495500967",
|
1111
|
+
"66020020_4000604100" => "0002810030",
|
1112
|
+
"66020020_4002015800" => "7495530102",
|
1113
|
+
"66020020_4003746700" => "7495501485",
|
1114
|
+
"66050000_0000086567" => "0001364934",
|
1115
|
+
"66050000_0000086345" => "7402046641",
|
1116
|
+
"66050000_0000085304" => "7402045439",
|
1117
|
+
"66050000_0000085990" => "7402051588",
|
1118
|
+
"86050000_0000001016" => "7461500128",
|
1119
|
+
"86050000_0000003535" => "7461505611",
|
1120
|
+
"86050000_0000002020" => "7461500018",
|
1121
|
+
"86050000_0000004394" => "7461505714",
|
1122
1122
|
}.freeze
|
1123
1123
|
|
1124
1124
|
def converted_details
|
1125
1125
|
updated_account_number = PSEUDO_ACCOUNT_NUMBER_MAPPING.fetch(
|
1126
1126
|
"#{@bank_code}_#{@account_number.rjust(10, '0')}",
|
1127
|
-
nil
|
1127
|
+
nil,
|
1128
1128
|
)
|
1129
1129
|
|
1130
1130
|
{
|
1131
|
-
bank_code: updated_account_number.nil? ? @bank_code :
|
1132
|
-
account_number: updated_account_number || @account_number
|
1131
|
+
bank_code: updated_account_number.nil? ? @bank_code : "60050101",
|
1132
|
+
account_number: updated_account_number || @account_number,
|
1133
1133
|
}
|
1134
1134
|
end
|
1135
1135
|
end
|
@@ -1138,72 +1138,72 @@ module Ibandit
|
|
1138
1138
|
include PseudoAccountNumberBehaviour
|
1139
1139
|
|
1140
1140
|
@pseudo_account_number_mapping = {
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1141
|
+
"0000000500" => "0000500500",
|
1142
|
+
"0000000502" => "0000502502",
|
1143
|
+
"0000018067" => "0000180670",
|
1144
|
+
"0000484848" => "0000484849",
|
1145
|
+
"0000636306" => "0000063606",
|
1146
|
+
"0000760440" => "0000160440",
|
1147
|
+
"0001018413" => "0010108413",
|
1148
|
+
"0002601577" => "0026015776",
|
1149
|
+
"0005005000" => "0000500500",
|
1150
|
+
"0010796740" => "0010796743",
|
1151
|
+
"0011796740" => "0011796743",
|
1152
|
+
"0012796740" => "0012796743",
|
1153
|
+
"0013796740" => "0013796743",
|
1154
|
+
"0014796740" => "0014796743",
|
1155
|
+
"0015796740" => "0015796743",
|
1156
|
+
"0016307000" => "0163107000",
|
1157
|
+
"0016610700" => "0166107000",
|
1158
|
+
"0016796740" => "0016796743",
|
1159
|
+
"0017796740" => "0017796743",
|
1160
|
+
"0018796740" => "0018796743",
|
1161
|
+
"0019796740" => "0019796743",
|
1162
|
+
"0020796740" => "0020796743",
|
1163
|
+
"0021796740" => "0021796743",
|
1164
|
+
"0022796740" => "0022796743",
|
1165
|
+
"0023796740" => "0023796743",
|
1166
|
+
"0024796740" => "0024796743",
|
1167
|
+
"0025796740" => "0025796743",
|
1168
|
+
"0026610700" => "0266107000",
|
1169
|
+
"0026796740" => "0026796743",
|
1170
|
+
"0027796740" => "0027796743",
|
1171
|
+
"0028796740" => "0028796743",
|
1172
|
+
"0029796740" => "0029796743",
|
1173
|
+
"0045796740" => "0045796743",
|
1174
|
+
"0050796740" => "0050796743",
|
1175
|
+
"0051796740" => "0051796743",
|
1176
|
+
"0052796740" => "0052796743",
|
1177
|
+
"0053796740" => "0053796743",
|
1178
|
+
"0054796740" => "0054796743",
|
1179
|
+
"0055796740" => "0055796743",
|
1180
|
+
"0056796740" => "0056796743",
|
1181
|
+
"0057796740" => "0057796743",
|
1182
|
+
"0058796740" => "0058796743",
|
1183
|
+
"0059796740" => "0059796743",
|
1184
|
+
"0060796740" => "0060796743",
|
1185
|
+
"0061796740" => "0061796743",
|
1186
|
+
"0062796740" => "0062796743",
|
1187
|
+
"0063796740" => "0063796743",
|
1188
|
+
"0064796740" => "0064796743",
|
1189
|
+
"0065796740" => "0065796743",
|
1190
|
+
"0066796740" => "0066796743",
|
1191
|
+
"0067796740" => "0067796743",
|
1192
|
+
"0068796740" => "0068796743",
|
1193
|
+
"0069796740" => "0069796743",
|
1194
|
+
"1761070000" => "0176107000",
|
1195
|
+
"2210531180" => "0201053180",
|
1196
1196
|
}
|
1197
1197
|
end
|
1198
1198
|
|
1199
1199
|
class Rule005500 < BaseRule
|
1200
1200
|
def converted_details
|
1201
|
-
{ bank_code:
|
1201
|
+
{ bank_code: "25410200", account_number: @account_number }
|
1202
1202
|
end
|
1203
1203
|
end
|
1204
1204
|
|
1205
1205
|
class Rule005600 < BaseRule
|
1206
|
-
EXCEPTION_BANK_CODES = %w
|
1206
|
+
EXCEPTION_BANK_CODES = %w[
|
1207
1207
|
10010111 26510111 36210111 48010111 59010111 70010111 13010111 27010111
|
1208
1208
|
37010111 50010111 60010111 72010111 16010111 28010111 38010111 50510111
|
1209
1209
|
63010111 75010111 20010111 29010111 39010111 51010111 65310111 76010111
|
@@ -1212,55 +1212,55 @@ module Ibandit
|
|
1212
1212
|
67010111 81010111 25010111 33010111 42610112 54210111 67210111 82010111
|
1213
1213
|
25410111 35010111 43010111 55010111 68010111 86010111 25910111 35211012
|
1214
1214
|
44010111 57010111 68310111 26010111 36010111 46010111 58510111 69010111
|
1215
|
-
|
1215
|
+
].freeze
|
1216
1216
|
|
1217
1217
|
PSEUDO_ACCOUNT_NUMBER_MAPPING = {
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1218
|
+
"0000000036" => "1010240003",
|
1219
|
+
"0000000050" => "1328506100",
|
1220
|
+
"0000000099" => "1826063000",
|
1221
|
+
"0000000110" => "1015597802",
|
1222
|
+
"0000000240" => "1010240000",
|
1223
|
+
"0000000333" => "1011296100",
|
1224
|
+
"0000000555" => "1600220800",
|
1225
|
+
"0000000556" => "1000556100",
|
1226
|
+
"0000000606" => "1967153801",
|
1227
|
+
"0000000700" => "1070088000",
|
1228
|
+
"0000000777" => "1006015200",
|
1229
|
+
"0000000999" => "1010240001",
|
1230
|
+
"0000001234" => "1369152400",
|
1231
|
+
"0000001313" => "1017500000",
|
1232
|
+
"0000001888" => "1241113000",
|
1233
|
+
"0000001953" => "1026500901",
|
1234
|
+
"0000001998" => "1547620500",
|
1235
|
+
"0000002007" => "1026500907",
|
1236
|
+
"0000004004" => "1635100100",
|
1237
|
+
"0000004444" => "1304610900",
|
1238
|
+
"0000005000" => "1395676000",
|
1239
|
+
"0000005510" => "1611754300",
|
1240
|
+
"0000006060" => "1000400200",
|
1241
|
+
"0000006800" => "1296401301",
|
1242
|
+
"0000055555" => "1027758200",
|
1243
|
+
"0000060000" => "1005007001",
|
1244
|
+
"0000066666" => "1299807801",
|
1245
|
+
"0000102030" => "1837501600",
|
1246
|
+
"0000121212" => "1249461502",
|
1247
|
+
"0000130500" => "1413482100",
|
1248
|
+
"0000202020" => "1213431002",
|
1249
|
+
"0000414141" => "1010555101",
|
1250
|
+
"0000666666" => "1798758900",
|
1251
|
+
"0005000000" => "1403124100",
|
1252
|
+
"0500500500" => "1045720000",
|
1253
1253
|
}.freeze
|
1254
1254
|
|
1255
1255
|
def converted_details
|
1256
1256
|
updated_account_number = PSEUDO_ACCOUNT_NUMBER_MAPPING.fetch(
|
1257
|
-
@account_number.rjust(10,
|
1258
|
-
@account_number
|
1257
|
+
@account_number.rjust(10, "0"),
|
1258
|
+
@account_number,
|
1259
1259
|
)
|
1260
1260
|
|
1261
|
-
if updated_account_number.gsub(/\A0+/,
|
1262
|
-
|
1263
|
-
msg =
|
1261
|
+
if updated_account_number.gsub(/\A0+/, "").size < 10 &&
|
1262
|
+
EXCEPTION_BANK_CODES.include?(@bank_code)
|
1263
|
+
msg = "Account does not support payment transactions"
|
1264
1264
|
raise UnsupportedAccountDetails, msg
|
1265
1265
|
end
|
1266
1266
|
|
@@ -1270,7 +1270,7 @@ module Ibandit
|
|
1270
1270
|
|
1271
1271
|
class Rule005700 < BaseRule
|
1272
1272
|
def converted_details
|
1273
|
-
{ bank_code:
|
1273
|
+
{ bank_code: "66010200", account_number: @account_number }
|
1274
1274
|
end
|
1275
1275
|
end
|
1276
1276
|
end
|