brcobranca 9.2.0 → 9.2.1

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc9f44a85a4c3279878a68b67bbb22652ebfbb4a08df88d6c417a3158b582acb
4
- data.tar.gz: 64b09c0d1113ae9d57609bd4c2d18b65684c1a38cdb8b482ec99328e0c7be9d3
3
+ metadata.gz: e7bea2cb66df79a28d915cfa0e01d8cee2a1aff60c88ebb65a3646af93ed285f
4
+ data.tar.gz: 9e7e117425ef6deea5c9c0f82dd43c96012e5ad42887d574ac3ad49f4ab12848
5
5
  SHA512:
6
- metadata.gz: 5f117aeb71b7a84d2fbb82f4843c0bbef03aa4c9cfd1d9ffbde21a7d01116d4d1f2a8daf79dd842438869dd5364c8b3bf968308deb6b6fd1a0b73f1dd6fc3cdd
7
- data.tar.gz: 1816e1e2a50ae279e32081149bb01ce600eef71bf0051fa0694362e808445cadf681bb341151e39db00f10270bb6e3703151332260c2062637d1dae9ef26defa
6
+ metadata.gz: '01768206899eec6d052cb73a1494398eea6966dff68c674fc0737604c6fddcbfd0fa03e5d088e096a3f3b6daa8c28a70a2dfd79c9e12049b625ebbda883c6902'
7
+ data.tar.gz: 6c43f3eb728f8442b5ce5403ee44cd7118dd7914247c0cc2a77b842b2af21b1b65139f70fc2dbf2096db6ccec114d28bede283e14d576c0b88600eacc20c323f
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## [v9.2.0](https://github.com/kivanio/brcobranca/tree/v9.2.0) (11-06-2018)
4
+ [Full Changelog](https://github.com/kivanio/brcobranca/compare/v9.1.2...v9.2.0)
5
+
6
+ **Closed issues:**
7
+
8
+ - Remessa para atualização de campos [\#186](https://github.com/kivanio/brcobranca/issues/186)
9
+
3
10
  ## [v9.1.2](https://github.com/kivanio/brcobranca/tree/v9.1.2) (18-12-2017)
4
11
  [Full Changelog](https://github.com/kivanio/brcobranca/compare/v9.1.1...v9.1.2)
5
12
 
@@ -4,9 +4,17 @@
4
4
  module Brcobranca
5
5
  module Boleto
6
6
  class Safra < Base # Banco Safra
7
- validates_length_of :agencia, maximum: 5, message: 'deve ser menor ou igual a 4 dígitos.'
7
+ # <b>REQUERIDO</b>: Dígito da Agência
8
+ attr_accessor :agencia_dv
9
+ # <b>REQUERIDO</b>: Dígito da conta
10
+ attr_accessor :conta_corrente_dv
11
+
12
+ validates_presence_of :agencia_dv, :conta_corrente_dv, message: 'não pode estar em branco.'
13
+ validates_length_of :agencia, maximum: 4, message: 'deve ser menor ou igual a 4 dígitos.'
8
14
  validates_length_of :nosso_numero, maximum: 8, message: 'deve ser menor ou igual a 8 dígitos.'
9
- validates_length_of :conta_corrente, maximum: 9, message: 'deve ser menor ou igual a 5 dígitos.'
15
+ validates_length_of :conta_corrente, maximum: 8, message: 'deve ser menor ou igual a 8 dígitos.'
16
+ validates_length_of :agencia_dv, is: 1, message: 'deve ser igual a 1 dígitos.'
17
+ validates_length_of :conta_corrente_dv, is: 1, message: 'deve ser igual a 1 dígitos.'
10
18
 
11
19
  # Codigo do banco emissor (3 dígitos sempre)
12
20
  #
@@ -17,15 +25,15 @@ module Brcobranca
17
25
 
18
26
  # Agência
19
27
  #
20
- # @return [String] 5 caracteres numéricos.
28
+ # @return [String] 4 caracteres numéricos.
21
29
  def agencia=(valor)
22
- @agencia = valor.to_s.rjust(5, '0') if valor
30
+ @agencia = valor.to_s.rjust(4, '0') if valor
23
31
  end
24
32
 
25
33
  # Conta corrente
26
- # @return [String] 9 caracteres numéricos.
34
+ # @return [String] 8 caracteres numéricos.
27
35
  def conta_corrente=(valor)
28
- @conta_corrente = valor.to_s.rjust(9, '0') if valor
36
+ @conta_corrente = valor.to_s.rjust(8, '0') if valor
29
37
  end
30
38
 
31
39
  # Número seqüencial utilizado para identificar o boleto.
@@ -55,9 +63,9 @@ module Brcobranca
55
63
  # Agência + conta corrente do cliente para exibir no boleto.
56
64
  # @return [String]
57
65
  # @example
58
- # boleto.agencia_conta_boleto #=> "0811 / 53678-8"
66
+ # boleto.agencia_conta_boleto #=> "0811-1 / 53678-8"
59
67
  def agencia_conta_boleto
60
- "#{agencia} / #{conta_corrente}"
68
+ "#{agencia}-#{agencia_dv} / #{conta_corrente}-#{conta_corrente_dv}"
61
69
  end
62
70
 
63
71
  # Segunda parte do código de barras.
@@ -137,7 +145,7 @@ module Brcobranca
137
145
  #
138
146
  # @return [String] 25 caracteres numéricos.
139
147
  def codigo_barras_segunda_parte
140
- "7#{agencia}#{conta_corrente}#{nosso_numero}#{nosso_numero_dv}2"
148
+ "7#{agencia}#{agencia_dv}#{conta_corrente}#{conta_corrente_dv}#{nosso_numero}#{nosso_numero_dv}2"
141
149
  end
142
150
  end
143
151
  end
@@ -2,5 +2,5 @@
2
2
  #
3
3
 
4
4
  module Brcobranca
5
- VERSION = '9.2.0'
5
+ VERSION = '9.2.1'
6
6
  end
@@ -13,7 +13,9 @@ RSpec.describe Brcobranca::Boleto::Safra do
13
13
  sacado: 'Claudio Pozzebom',
14
14
  sacado_documento: '12345678900',
15
15
  agencia: '4042',
16
+ agencia_dv: '8',
16
17
  conta_corrente: '61900',
18
+ conta_corrente_dv: '7',
17
19
  convenio: 12_387_989,
18
20
  nosso_numero: '77700168'
19
21
  }
@@ -28,7 +30,7 @@ RSpec.describe Brcobranca::Boleto::Safra do
28
30
  expect(boleto_novo.data_processamento).to eql(Date.current)
29
31
  expect(boleto_novo.data_vencimento).to eql(Date.current)
30
32
  expect(boleto_novo.aceite).to eql('S')
31
- expect(boleto_novo.quantidade).to be(1)
33
+ expect(boleto_novo.quantidade).to eq(1)
32
34
  expect(boleto_novo.valor).to eq(0.0)
33
35
  expect(boleto_novo.valor_documento).to eq(0.0)
34
36
  expect(boleto_novo.local_pagamento).to eql('QUALQUER BANCO ATÉ O VENCIMENTO')
@@ -43,7 +45,7 @@ RSpec.describe Brcobranca::Boleto::Safra do
43
45
  expect(boleto_novo.data_processamento).to eql(Date.current)
44
46
  expect(boleto_novo.data_vencimento).to eql(Date.current)
45
47
  expect(boleto_novo.aceite).to eql('S')
46
- expect(boleto_novo.quantidade).to be(1)
48
+ expect(boleto_novo.quantidade).to eq(1)
47
49
  expect(boleto_novo.valor).to eq(0.0)
48
50
  expect(boleto_novo.valor_documento).to eq(0.0)
49
51
  expect(boleto_novo.local_pagamento).to eql('Pagável preferencialmente na Rede Bradesco ou Bradesco Expresso')
@@ -51,9 +53,11 @@ RSpec.describe Brcobranca::Boleto::Safra do
51
53
  expect(boleto_novo.documento_cedente).to eql('12345678912')
52
54
  expect(boleto_novo.sacado).to eql('Claudio Pozzebom')
53
55
  expect(boleto_novo.sacado_documento).to eql('12345678900')
54
- expect(boleto_novo.conta_corrente).to eql('000061900')
55
- expect(boleto_novo.agencia).to eql('04042')
56
- expect(boleto_novo.convenio).to be(12_387_989)
56
+ expect(boleto_novo.conta_corrente).to eql('00061900')
57
+ expect(boleto_novo.conta_corrente_dv).to eql('7')
58
+ expect(boleto_novo.agencia).to eql('4042')
59
+ expect(boleto_novo.agencia_dv).to eql('8')
60
+ expect(boleto_novo.convenio).to eq(12_387_989)
57
61
  expect(boleto_novo.nosso_numero).to eql('77700168')
58
62
  end
59
63
 
@@ -62,19 +66,35 @@ RSpec.describe Brcobranca::Boleto::Safra do
62
66
  valid_attributes[:data_documento] = Date.parse('2025-02-23')
63
67
  valid_attributes[:data_vencimento] = Date.parse('2025-02-23')
64
68
  valid_attributes[:nosso_numero] = '26173001'
65
- valid_attributes[:conta_corrente] = '000278247'
66
- valid_attributes[:agencia] = '00400'
69
+ valid_attributes[:conta_corrente] = '00027824'
70
+ valid_attributes[:conta_corrente_dv] = '7'
71
+ valid_attributes[:agencia] = '0040'
72
+ valid_attributes[:agencia_dv] = '0'
67
73
  boleto_novo = described_class.new(valid_attributes)
68
74
 
69
75
  expect(boleto_novo.codigo_barras_segunda_parte).to eql('7004000002782472617300112')
70
76
  expect(boleto_novo.codigo_barras).to eql('42296100100000180847004000002782472617300112')
71
77
  expect(boleto_novo.codigo_barras.linha_digitavel).to eql('42297.00408 00002.782472 26173.001129 6 10010000018084')
78
+
79
+ valid_attributes[:valor] = 5543.05
80
+ valid_attributes[:data_documento] = Date.parse('2016-03-30')
81
+ valid_attributes[:data_vencimento] = Date.parse('2016-03-30')
82
+ valid_attributes[:nosso_numero] = '50153004'
83
+ valid_attributes[:conta_corrente] = '00627672'
84
+ valid_attributes[:conta_corrente_dv] = '9'
85
+ valid_attributes[:agencia] = '1150'
86
+ valid_attributes[:agencia_dv] = '0'
87
+ boleto_novo = described_class.new(valid_attributes)
88
+
89
+ expect(boleto_novo.codigo_barras_segunda_parte).to eql('7115000062767295015300452')
90
+ expect(boleto_novo.codigo_barras).to eql('42291674900005543057115000062767295015300452')
91
+ expect(boleto_novo.codigo_barras.linha_digitavel).to eql('42297.11504 00062.767298 50153.004523 1 67490000554305')
72
92
  end
73
93
 
74
94
  it 'Não permitir gerar boleto com atributos inválido' do
75
95
  boleto_novo = described_class.new
76
96
  expect { boleto_novo.codigo_barras }.to raise_error(Brcobranca::BoletoInvalido)
77
- expect(boleto_novo.errors.count).to be(5)
97
+ expect(boleto_novo.errors.count).to eq(9)
78
98
  end
79
99
 
80
100
  it 'Montar nosso_numero_boleto' do
@@ -82,26 +102,26 @@ RSpec.describe Brcobranca::Boleto::Safra do
82
102
 
83
103
  boleto_novo.nosso_numero = '94550200'
84
104
  expect(boleto_novo.nosso_numero_boleto).to eql('94550200-1')
85
- expect(boleto_novo.nosso_numero_dv).to be(1)
105
+ expect(boleto_novo.nosso_numero_dv).to eq(1)
86
106
 
87
107
  boleto_novo.nosso_numero = '93199999'
88
108
  expect(boleto_novo.nosso_numero_boleto).to eql('93199999-5')
89
- expect(boleto_novo.nosso_numero_dv).to be(5)
109
+ expect(boleto_novo.nosso_numero_dv).to eq(5)
90
110
 
91
111
  boleto_novo.nosso_numero = '26173001'
92
112
  expect(boleto_novo.nosso_numero_boleto).to eql('26173001-1')
93
- expect(boleto_novo.nosso_numero_dv).to be(1)
113
+ expect(boleto_novo.nosso_numero_dv).to eq(1)
94
114
  end
95
115
 
96
116
  it 'Montar agencia_conta_boleto' do
97
117
  boleto_novo = described_class.new(valid_attributes)
98
118
 
99
- expect(boleto_novo.agencia_conta_boleto).to eql('04042 / 000061900')
119
+ expect(boleto_novo.agencia_conta_boleto).to eql('4042-8 / 00061900-7')
100
120
  boleto_novo.agencia = '0719'
101
- expect(boleto_novo.agencia_conta_boleto).to eql('00719 / 000061900')
121
+ expect(boleto_novo.agencia_conta_boleto).to eql('0719-8 / 00061900-7')
102
122
  boleto_novo.agencia = '0548'
103
123
  boleto_novo.conta_corrente = '1448'
104
- expect(boleto_novo.agencia_conta_boleto).to eql('00548 / 000001448')
124
+ expect(boleto_novo.agencia_conta_boleto).to eql('0548-8 / 00001448-7')
105
125
  end
106
126
 
107
127
  describe 'Busca logotipo do banco' do
@@ -124,7 +144,7 @@ RSpec.describe Brcobranca::Boleto::Safra do
124
144
  tmp_file.close
125
145
  expect(File.exist?(tmp_file.path)).to be_truthy
126
146
  expect(File.stat(tmp_file.path).zero?).to be_falsey
127
- expect(File.delete(tmp_file.path)).to be(1)
147
+ expect(File.delete(tmp_file.path)).to eq(1)
128
148
  expect(File.exist?(tmp_file.path)).to be_falsey
129
149
  end
130
150
  end
@@ -145,7 +165,7 @@ RSpec.describe Brcobranca::Boleto::Safra do
145
165
  tmp_file.close
146
166
  expect(File.exist?(tmp_file.path)).to be_truthy
147
167
  expect(File.stat(tmp_file.path).zero?).to be_falsey
148
- expect(File.delete(tmp_file.path)).to be(1)
168
+ expect(File.delete(tmp_file.path)).to eq(1)
149
169
  expect(File.exist?(tmp_file.path)).to be_falsey
150
170
  end
151
171
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brcobranca
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.2.0
4
+ version: 9.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kivanio Barbosa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-11 00:00:00.000000000 Z
11
+ date: 2018-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rghost