bra_documents 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9660c16de3e4c0e3af2ec9e235efb07afde5143c35bbf282c24c78675f91878e
4
- data.tar.gz: e9b7de683720c392be7db09dff0e094e4e8c95699d3f31123143ad02c03a9575
3
+ metadata.gz: a0dd0427b2b2196ffdda4f751c6857e36b0bfd0d86c426c4de8d85611bf67517
4
+ data.tar.gz: f9330ff3775aaa84a1ec91e4df81fd5489e29760df6a087e0cdb38729f092a1b
5
5
  SHA512:
6
- metadata.gz: 1b9fcfaf3bb6f3a398e5ea8ebfd9739cc4060bda3fbd7a3645122390a28890e2c2136eeeee6c579d9c2c9fc777e8625a62f535811de4e8994fdf379574124a96
7
- data.tar.gz: 045fc875fdf40b830b93bc58c40afffab6c6b0185e421ebc39c005cd3daa6c2b4561885575f3c74247b7a1ab330996aaf8b8b3edb00af28524684cc4a35c767c
6
+ metadata.gz: 8924fcf456e4ec22225b0911117d155cb97f5ea7e6b1a8cdcac21cf9f30653da76cb89166636a161f6f2e0750424c2c6afaf29504a7cef5d51e0b70246c2232f
7
+ data.tar.gz: b9e333137523524838fedec86e55c96f9f2f1d198ae6527518e5214d129351c15287d3d60d6ca51af85f030c04bc594d8fcba12a4afa032c3a8d8fed53a9bb55
data/CHANGELOG.md CHANGED
@@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [1.0.2] - 2020-22-10
12
+
13
+ ### Fixed
14
+
15
+ - CPFGenerator.valid_verification_digit? returning false if document does not have CPF format;
16
+ - CNPJGenerator.valid_verification_digit? returning false if document does not have CNPJ format;
17
+
11
18
  ## [1.0.1] - 2020-22-10
12
19
 
13
20
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bra_documents (1.0.1)
4
+ bra_documents (1.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -55,7 +55,7 @@ module BraDocuments
55
55
  # # => true
56
56
  def valid_verification_digit?(document:)
57
57
  raw_document = Formatter.raw(document)
58
- return false if raw_document.chars.uniq.size == 1
58
+ return false if black_listed?(raw_document) || !Matcher.match?(raw_document, kind: :cnpj, mode: :raw)
59
59
 
60
60
  company_number = raw_document.slice(0..(COMPANY_NUMBER_SIZE - 1))
61
61
  matrix_subsidiary_number = raw_document
@@ -41,7 +41,7 @@ module BraDocuments
41
41
  # # => true
42
42
  def valid_verification_digit?(document:)
43
43
  raw_document = Formatter.raw(document)
44
- return false if raw_document.chars.uniq.size == 1
44
+ return false if black_listed?(raw_document) || !Matcher.match?(raw_document, kind: :cpf, mode: :raw)
45
45
 
46
46
  person_number = raw_document.slice(0..(PERSON_NUMBER_SIZE - 1))
47
47
  verified_digit = raw_document.slice(PERSON_NUMBER_SIZE..(raw_document.size - 1))
@@ -46,6 +46,10 @@ module BraDocuments
46
46
  .with_index { |multiplicator, position| numbers[position] * multiplicator }
47
47
  .sum
48
48
  end
49
+
50
+ def black_listed?(numbers)
51
+ numbers.chars.uniq.size == 1
52
+ end
49
53
  end
50
54
  end
51
55
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BraDocuments
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bra_documents
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Vicenzo