br_boleto 2.2.5 → 2.2.6

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
  SHA1:
3
- metadata.gz: 821f1c29e52c955ce6bd1b053f7d775a190e79e3
4
- data.tar.gz: 37fa7feec7becf3ff2dd10117c0c63f8cc62d814
3
+ metadata.gz: 03d1617d5b865a65c174430e09aeecdfc985dfa2
4
+ data.tar.gz: ae05427283fdb47caa434e1a2c46ebc3205a638b
5
5
  SHA512:
6
- metadata.gz: c5256bb0859e09c6bddca1482268eafc410f591e28a2be4902f893f3af62255556febefe844e1aad8ca3b9e7d5d6a2de912cab575e55bb1fb5c495abdfb787b9
7
- data.tar.gz: 30db9fe04f7603a67cd9ef7cb113eac391793fe75b10efdb7fe318b59307d3bd26e194c20b1b6613362d5323ad87916a72b1aaddf49f0a816d452bc7ccc9c7a4
6
+ metadata.gz: 7ecebaf7dc03b2d6b3a79299a18b485627a270c9652046d775035f4215eab35cab44371e4ffa881013bfa50ce4865d124c92f16ed083730dbcb54c4d5a9dd615
7
+ data.tar.gz: 32999797ef0fcf39f95ba7648082af1715694a0f06bc65f59b0cb17b971bcb623a9f1221c7071961a35590ffcadb507746353d149d1a81df03be4eba2dc16d16
@@ -210,7 +210,7 @@ module BrBoleto
210
210
  # @return [String] Precisa retornar 10 dígitos para o código de barras (incluindo os centavos).
211
211
  #
212
212
  def valor_formatado_para_codigo_de_barras
213
- valor_documento_formatado = (Integer(valor_documento.to_f * 100) / Float(100))
213
+ valor_documento_formatado = valor_documento.to_f.round(2)
214
214
  real, centavos = valor_documento_formatado.to_s.split(/\./)
215
215
  "#{real.rjust(8, '0')}#{centavos.ljust(2, '0')}"
216
216
  end
@@ -114,7 +114,12 @@ module BrBoleto
114
114
 
115
115
  # Identificação da Distribuição exclusiva da CAIXA
116
116
  def equivalent_distribuicao_boleto
117
- super.merge({'0' => '0' }) # 0 = Postagem pelo Beneficiário
117
+ {
118
+ '1' => '2', # Banco Distribui
119
+ '2' => '0', # Cliente Distribui
120
+ '3' => '3', # Banco envia e-mail
121
+ '4' => '4', # Banco envia SMS
122
+ }
118
123
  end
119
124
 
120
125
  # Código de Movimento Retorno
@@ -122,6 +122,13 @@ module BrBoleto
122
122
  "#{pagamento.numero_documento}".adjust_size_to(25, '0', :right)
123
123
  end
124
124
 
125
+ # Código para Baixa/Devolução
126
+ # 1 posição
127
+ #
128
+ def segmento_p_posicao_224_a_224
129
+ '1'
130
+ end
131
+
125
132
  # Segmento Q Cód. Bco. Corresp. na Compensação
126
133
  # Deve ser 3 espaços em branco
127
134
  # 3 posições
@@ -238,15 +238,6 @@ module BrBoleto
238
238
  def complemento_trailer_lote_posicao_124_a_240
239
239
  ''.rjust(117, ' ')
240
240
  end
241
-
242
- # Código para Protesto
243
- # Padrão do SICOOB '1' = Protestar Dias Corridos
244
- # 1 posição
245
- #
246
- def segmento_p_posicao_221_a_221(pagamento)
247
- '1'
248
- end
249
-
250
241
  end
251
242
  end
252
243
  end
@@ -2,7 +2,7 @@ module BrBoleto
2
2
  module Version
3
3
  MAJOR = 2 #inclui alterações de API e pode quebrar compatibilidade com versões anteriores
4
4
  MINOR = 2 #inclui novas funcionalidades, sem quebrar APIs existentes
5
- PATCH = 5 #corrige bugs ou traz melhorias em implementações já existentes
5
+ PATCH = 6 #corrige bugs ou traz melhorias em implementações já existentes
6
6
  CURRENT = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -135,7 +135,7 @@ describe BrBoleto::Boleto::Base do
135
135
  context "when have many decimal points" do
136
136
  before { subject.stubs(:valor_documento).returns(10.999999) }
137
137
 
138
- it {subject.valor_formatado_para_codigo_de_barras.must_equal '0000001099' }
138
+ it {subject.valor_formatado_para_codigo_de_barras.must_equal '0000001100' }
139
139
  end
140
140
 
141
141
  context "when integer" do
@@ -151,7 +151,7 @@ describe BrBoleto::Boleto::Base do
151
151
  end
152
152
 
153
153
  context "when period with string with many decimals" do
154
- before { subject.stubs(:valor_documento).returns('10.999999') }
154
+ before { subject.stubs(:valor_documento).returns('10.9895145') }
155
155
 
156
156
  it {subject.valor_formatado_para_codigo_de_barras.must_equal '0000001099' }
157
157
  end
@@ -310,4 +310,19 @@ describe BrBoleto::Conta::Caixa do
310
310
  it { subject.get_codigo_moeda('09', 400).must_equal '1' } # Real
311
311
  end
312
312
  end
313
+
314
+ describe '#get_distribuicao_boleto -> Para a caixa os códigos são diferentes da FEBRABAN' do
315
+ it "Quando o banco distribui deve converter o código para 2" do
316
+ subject.get_distribuicao_boleto('1').must_equal '2'
317
+ end
318
+ it "Quando o Cliente distribui deve converter o código para 0" do
319
+ subject.get_distribuicao_boleto('2').must_equal '0'
320
+ end
321
+ it "Quando envia e-mail deve manter o código 3" do
322
+ subject.get_distribuicao_boleto('3').must_equal '3'
323
+ end
324
+ it "Quando envia SMS deve manter o código 4" do
325
+ subject.get_distribuicao_boleto('4').must_equal '4'
326
+ end
327
+ end
313
328
  end
@@ -234,6 +234,12 @@ describe BrBoleto::Remessa::Cnab240::Caixa do
234
234
  end
235
235
  end
236
236
 
237
+ describe '#segmento_p_posicao_224_a_224 - Deve ter o valor fixo de 1 ao invés de zero que é o padrão da FEBRABAN' do
238
+ it "deve retornar 1" do
239
+ subject.segmento_p_posicao_224_a_224.must_equal '1'
240
+ end
241
+ end
242
+
237
243
  describe 'Geração do arquivo' do
238
244
  let(:conta) do
239
245
  {
@@ -1,6 +1,6 @@
1
1
  10400000 2334864510001300000000000000000000007506082819600000000EMPRESA EMITENTE CAIXA ECONOMICA FEDERAL 1141120160931470000010500000000000000000000000000000000000000000000000000
2
2
  10400011R0100030 20334864510001308281960000000000000007506082819600000000EMPRESA EMITENTE 000000011411201600000000
3
- 1040001300001P 0107506082819600000000000141400000000000001022200000000002 1411201600000000000100000000002N1411201631611201600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023000000090000000000
3
+ 1040001300001P 0107506082819600000000000141400000000000001022000000000002 1411201600000000000100000000002N1411201631611201600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023001000090000000000
4
4
  1040001300002Q 011000078793321112BENJAMIN FRANCISCO MARCOS VINICIUS FERNARUA PRINCIPAL S/N 881 CENTRO 79210972ANASTACIO MS0000000000000000
5
5
  1040001300003R 01000000000000000000000000000000000000000000000000315112016000000000000000 0000000000000000 000000000000 0
6
6
  1040001300004S 01100 00
@@ -1,6 +1,6 @@
1
1
  75600000 233486451000130 0304060000000548430 EMPRESA EMITENTE SICOOB 10609201609435200001108100000
2
2
  75600011R01 040 2033486451000130 0304060000000548430 EMPRESA EMITENTE 000000110609201600000000
3
- 7560001300001P 010304060000000548430 000015780401014 10 220000000001578040609201600000000001478900000 02N06092016107092016000000000000025000000000000000000000000000000000000000000000000000000 1000000090000000000
3
+ 7560001300001P 010304060000000548430 000015780401014 10 220000000001578040609201600000000001478900000 02N06092016107092016000000000000025000000000000000000000000000000000000000000000000000000 3000000090000000000
4
4
  7560001300002Q 011000078793321112BENJAMIN FRANCISCO MARCOS VINICIUS FERNARUA PRINCIPAL S/N 881 CENTRO 79210972ANASTACIO MS0000000000000000 000
5
5
  7560001300003R 01000000000000000000000000000000000000000000000000207092016000000000000200 0000000000000000 000000000000 0
6
6
  7560001300004S 01101 01
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: br_boleto
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno M. Mergen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-18 00:00:00.000000000 Z
11
+ date: 2017-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake