banking_data_validator 0.0.5 → 0.0.6
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
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjRiZDAxNGNjMGFkZTZjZGNlYmMyNDA4ZDRlMTc0ZjgzNjJkNmI5ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Y2U4NDA0ODQ3ZWI0YzMyYTI5NDc4YzAyODE0ZGQ4MjlkZjU1MTRjYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjNiN2Y4ZmRiMjRiMDE4MzAwNjNjYzFiZDVmNGFkNjRlMjBmZDljZjQwMTYw
|
10
|
+
OTBjOGVhYTRmYzEwNzQ2MGVkMDNlYjc2MDg3ZTM5NDdjOGNmYTE0NzkyMTVm
|
11
|
+
YjkwZDlkYjM4ZmExZGVlNzMwZmNlNDkzM2EzZDQ4ZTdlMWRhNDM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDAzODcxMTg5NWFlYTA1MmY2NGI2MjcwMGE3NDY1ZGIwZmRkMDc2N2ViZTMz
|
14
|
+
MjhlYjJhYTY5NGI4NjZhN2I4YjZlMmM4MDc2MzExOTcxZjVjYWIxMTI4ZTk4
|
15
|
+
N2JjMmJkZDUwOWYyYmVmMzA3ZjdjZWNhNDc5NTNiZDUyY2RhY2E=
|
@@ -3,18 +3,23 @@ require "banking_data_validator/bank/base"
|
|
3
3
|
module BankingDataValidator
|
4
4
|
module Bank
|
5
5
|
class Bradesco < Base
|
6
|
+
|
7
|
+
def initialize(branch, account_number, account_digit)
|
8
|
+
super
|
9
|
+
@account_digit = padding_with_zeros(account_digit.to_i)
|
10
|
+
end
|
11
|
+
|
6
12
|
private
|
7
13
|
|
8
14
|
def checksum
|
9
15
|
case raw_checksum
|
10
|
-
when
|
11
|
-
|
12
|
-
else "#{11 - raw_checksum}"
|
16
|
+
when 1..9 then "#{raw_checksum}"
|
17
|
+
else "0"
|
13
18
|
end
|
14
19
|
end
|
15
20
|
|
16
21
|
def raw_checksum
|
17
|
-
@raw_checksum ||= multiply_factors % 11
|
22
|
+
@raw_checksum ||= 11 - multiply_factors % 11
|
18
23
|
end
|
19
24
|
|
20
25
|
def factors
|
@@ -10,7 +10,9 @@ module BankingDataValidator
|
|
10
10
|
expect(Bradesco.valid_account?(nil, "87087", "0")).to eq(true)
|
11
11
|
expect(Bradesco.valid_account?(nil, "71000", "8")).to eq(true)
|
12
12
|
expect(Bradesco.valid_account?(nil, "3257", "3")).to eq(true)
|
13
|
+
expect(Bradesco.valid_account?(nil, 121, "0")).to eq(true)
|
13
14
|
expect(Bradesco.valid_account?(nil, 121, "p")).to eq(true)
|
15
|
+
expect(Bradesco.valid_account?(nil, "1818", "0")).to eq(true)
|
14
16
|
end
|
15
17
|
|
16
18
|
it "returns false when is given an account_number with an invalid digit" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: banking_data_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Americo Duarte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04
|
11
|
+
date: 2015-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|