validate_nz_bank_acc 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +4 -0
- data/LICENSE +2 -1
- data/README.md +11 -2
- data/lib/validate_nz_bank_acc/version.rb +1 -1
- data/lib/validate_nz_bank_acc.rb +2 -2
- data/spec/validate_nz_bank_acc_spec.rb +13 -14
- data/validate_nz_bank_acc.gemspec +3 -3
- metadata +23 -22
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6107d07189a0b6889fe1e5094b09507eebff5561156c571db256dddec98438d4
|
4
|
+
data.tar.gz: d5ee53b454cc8cc9bbd87efa0ea701bde771af1174731fa89ec97e69a45adb6c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '0338facbb85efeadc8cee3dd0f9c7bd7f9d127e695130fb7e3c199b6f04238f514e27f0b71fe1609caeffe191a41e6c3e27b1022a73edc5c68c5f06468d45b30'
|
7
|
+
data.tar.gz: e8bc759f4229e4984263ae7e554031e35a110841b584f8607bda1d9d206ddf8977f8b226694fd41fa03308efc5cc4e6d832ba0a39c23bfd22957fe8797a0957f
|
data/CHANGELOG
ADDED
data/LICENSE
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
Copyright (c) 2012 Localist Ltd.
|
2
|
+
Copyright (c) 2015 Eaden McKee
|
2
3
|
|
3
4
|
MIT License
|
4
5
|
|
@@ -19,4 +20,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
20
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
21
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
22
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ValidateNzBankAcc
|
2
2
|
|
3
|
-
An
|
3
|
+
An implementation of the process described on page 15 of
|
4
4
|
http://www.ird.govt.nz/resources/a/c/ac60890040b57d0e9bd4df41f9f3ce1d/rwt-nrwt-spec-2010-v3.pdf
|
5
5
|
|
6
6
|
## Installation
|
@@ -11,7 +11,7 @@ Add this line to your application's Gemfile:
|
|
11
11
|
|
12
12
|
And then execute:
|
13
13
|
|
14
|
-
$ bundle
|
14
|
+
$ bundle install
|
15
15
|
|
16
16
|
Or install it yourself as:
|
17
17
|
|
@@ -28,3 +28,12 @@ Or install it yourself as:
|
|
28
28
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
29
29
|
4. Push to the branch (`git push origin my-new-feature`)
|
30
30
|
5. Create new Pull Request
|
31
|
+
|
32
|
+
|
33
|
+
## History
|
34
|
+
|
35
|
+
This was originaly developed my myself + others at Localist and released under the MIT licence.
|
36
|
+
|
37
|
+
## TODO
|
38
|
+
|
39
|
+
Update specs from 2012 era syntax
|
data/lib/validate_nz_bank_acc.rb
CHANGED
@@ -2,8 +2,8 @@ require "validate_nz_bank_acc/version"
|
|
2
2
|
|
3
3
|
class ValidateNzBankAcc
|
4
4
|
|
5
|
-
BANKS = { 1 => {:ranges => [1..999, 1100
|
6
|
-
2 => {:ranges => [1..999, 1200
|
5
|
+
BANKS = { 1 => {:ranges => [1..999, 1100..1199, 1800..1899]},
|
6
|
+
2 => {:ranges => [1..999, 1200..1299]},
|
7
7
|
3 => {:ranges => [1..999, 1300..1399, 1500..1599, 1700..1799, 1900..1999]},
|
8
8
|
6 => {:ranges => [1..999, 1400..1499]},
|
9
9
|
8 => {:ranges => [6500..6599], :algo => :d},
|
@@ -5,27 +5,26 @@ describe ValidateNzBankAcc do
|
|
5
5
|
let(:ex2) { ValidateNzBankAcc.new("08","6523","1954512","001") }
|
6
6
|
let(:ex3) { ValidateNzBankAcc.new("26","2600","0320871","032") }
|
7
7
|
|
8
|
-
|
9
8
|
describe "valid_bank_code?" do
|
10
9
|
it "should check against BANKS for the bank code" do
|
11
|
-
ValidateNzBankAcc.new("03","0123","0034141","03").valid_bank_code?.should
|
12
|
-
ValidateNzBankAcc.new("01","1113","0034141","03").valid_bank_code?.should
|
13
|
-
ValidateNzBankAcc.new("20","0123","1111111","11").valid_bank_code?.should
|
14
|
-
ValidateNzBankAcc.new("05","0123","0034141","03").valid_bank_code?.should
|
10
|
+
ValidateNzBankAcc.new("03","0123","0034141","03").valid_bank_code?.should be_truthy
|
11
|
+
ValidateNzBankAcc.new("01","1113","0034141","03").valid_bank_code?.should be_truthy
|
12
|
+
ValidateNzBankAcc.new("20","0123","1111111","11").valid_bank_code?.should be_truthy
|
13
|
+
ValidateNzBankAcc.new("05","0123","0034141","03").valid_bank_code?.should be_falsy # no back 05
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
17
|
describe "valid_bank_branch?" do
|
19
18
|
it "should validate the branch code against the range of valid branches" do
|
20
19
|
# VALIDS
|
21
|
-
ValidateNzBankAcc.new("03","0123","0034141","03").valid_branch_code?.should
|
22
|
-
ValidateNzBankAcc.new("26","2600","0034141","03").valid_branch_code?.should
|
23
|
-
ValidateNzBankAcc.new("26","2699","0034141","0003").valid_branch_code?.should
|
24
|
-
ValidateNzBankAcc.new("11","6666","0034141","0003").valid_branch_code?.should
|
20
|
+
ValidateNzBankAcc.new("03","0123","0034141","03").valid_branch_code?.should be_truthy
|
21
|
+
ValidateNzBankAcc.new("26","2600","0034141","03").valid_branch_code?.should be_truthy
|
22
|
+
ValidateNzBankAcc.new("26","2699","0034141","0003").valid_branch_code?.should be_truthy
|
23
|
+
ValidateNzBankAcc.new("11","6666","0034141","0003").valid_branch_code?.should be_truthy
|
25
24
|
|
26
25
|
# INVALIDS
|
27
|
-
ValidateNzBankAcc.new("11","1111","0034141","0003").valid_branch_code?.should
|
28
|
-
ValidateNzBankAcc.new("01","2012","0034141","0003").valid_branch_code?.should
|
26
|
+
ValidateNzBankAcc.new("11","1111","0034141","0003").valid_branch_code?.should be_falsy
|
27
|
+
ValidateNzBankAcc.new("01","2012","0034141","0003").valid_branch_code?.should be_falsy
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
@@ -64,9 +63,9 @@ describe ValidateNzBankAcc do
|
|
64
63
|
|
65
64
|
describe "valid_modulo?" do
|
66
65
|
it "should valid modulo for the example in the pdf" do
|
67
|
-
ex1.valid_modulo?.should
|
68
|
-
ex1.valid_modulo?.should
|
69
|
-
ex1.valid_modulo?.should
|
66
|
+
ex1.valid_modulo?.should be_truthy
|
67
|
+
ex1.valid_modulo?.should be_truthy
|
68
|
+
ex1.valid_modulo?.should be_truthy
|
70
69
|
end
|
71
70
|
end
|
72
71
|
end
|
@@ -3,11 +3,11 @@ require File.expand_path('../lib/validate_nz_bank_acc/version', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Eaden McKee"]
|
6
|
-
gem.email = ["
|
6
|
+
gem.email = ["mail@eaden.net"]
|
7
7
|
gem.description = %q{Validates a NZ bank account against checksum rules}
|
8
8
|
gem.summary = %q{Validates a NZ bank account against checksum rules}
|
9
|
-
gem.homepage = "https://github.com/
|
10
|
-
|
9
|
+
gem.homepage = "https://github.com/eadz/ValidateNzBankAcc"
|
10
|
+
gem.license = "MIT"
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
metadata
CHANGED
@@ -1,35 +1,38 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validate_nz_bank_acc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Eaden McKee
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2023-03-24 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
25
27
|
description: Validates a NZ bank account against checksum rules
|
26
28
|
email:
|
27
|
-
-
|
29
|
+
- mail@eaden.net
|
28
30
|
executables: []
|
29
31
|
extensions: []
|
30
32
|
extra_rdoc_files: []
|
31
33
|
files:
|
32
|
-
- .gitignore
|
34
|
+
- ".gitignore"
|
35
|
+
- CHANGELOG
|
33
36
|
- Gemfile
|
34
37
|
- LICENSE
|
35
38
|
- README.md
|
@@ -39,31 +42,29 @@ files:
|
|
39
42
|
- spec/spec_helper.rb
|
40
43
|
- spec/validate_nz_bank_acc_spec.rb
|
41
44
|
- validate_nz_bank_acc.gemspec
|
42
|
-
homepage: https://github.com/
|
43
|
-
licenses:
|
44
|
-
|
45
|
+
homepage: https://github.com/eadz/ValidateNzBankAcc
|
46
|
+
licenses:
|
47
|
+
- MIT
|
48
|
+
metadata: {}
|
49
|
+
post_install_message:
|
45
50
|
rdoc_options: []
|
46
51
|
require_paths:
|
47
52
|
- lib
|
48
53
|
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
54
|
requirements:
|
51
|
-
- -
|
55
|
+
- - ">="
|
52
56
|
- !ruby/object:Gem::Version
|
53
57
|
version: '0'
|
54
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
59
|
requirements:
|
57
|
-
- -
|
60
|
+
- - ">="
|
58
61
|
- !ruby/object:Gem::Version
|
59
62
|
version: '0'
|
60
63
|
requirements: []
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
specification_version: 3
|
64
|
+
rubygems_version: 3.4.5
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
65
67
|
summary: Validates a NZ bank account against checksum rules
|
66
68
|
test_files:
|
67
69
|
- spec/spec_helper.rb
|
68
70
|
- spec/validate_nz_bank_acc_spec.rb
|
69
|
-
has_rdoc:
|