br_boleto 1.0.1 → 1.1.0
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 +4 -4
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +13 -0
- data/LICENSE +1 -1
- data/README.markdown +22 -7
- data/br_boleto.gemspec +9 -7
- data/lib/br_boleto/active_model_base.rb +28 -0
- data/lib/br_boleto/boleto/base.rb +666 -633
- data/lib/br_boleto/boleto/caixa.rb +257 -0
- data/lib/br_boleto/boleto/sicoob.rb +6 -18
- data/lib/br_boleto/helper/format_value.rb +18 -0
- data/lib/br_boleto/remessa/base.rb +1 -22
- data/lib/br_boleto/remessa/cnab240/base.rb +12 -9
- data/lib/br_boleto/remessa/cnab240/caixa.rb +201 -0
- data/lib/br_boleto/remessa/cnab240/helper/header_arquivo.rb +2 -2
- data/lib/br_boleto/remessa/cnab240/helper/header_lote.rb +10 -1
- data/lib/br_boleto/remessa/cnab240/helper/segmento_p.rb +2 -2
- data/lib/br_boleto/remessa/cnab240/helper/segmento_q.rb +2 -2
- data/lib/br_boleto/remessa/cnab240/helper/trailer_arquivo.rb +7 -0
- data/lib/br_boleto/remessa/cnab240/sicoob.rb +6 -6
- data/lib/br_boleto/remessa/lote.rb +1 -21
- data/lib/br_boleto/remessa/pagamento.rb +22 -36
- data/lib/br_boleto/retorno/base.rb +31 -0
- data/lib/br_boleto/retorno/cnab240/base.rb +101 -0
- data/lib/br_boleto/retorno/cnab240/caixa.rb +30 -0
- data/lib/br_boleto/retorno/cnab240/sicoob.rb +35 -0
- data/lib/br_boleto/retorno/pagamento.rb +242 -0
- data/lib/br_boleto/version.rb +2 -2
- data/lib/br_boleto.rb +23 -11
- data/test/br_boleto/boleto/base_test.rb +6 -6
- data/test/br_boleto/boleto/caixa_test.rb +191 -0
- data/test/br_boleto/boleto/sicoob_test.rb +18 -11
- data/test/br_boleto/remessa/cnab240/base_test.rb +5 -5
- data/test/br_boleto/remessa/cnab240/caixa_test.rb +271 -0
- data/test/br_boleto/remessa/cnab240/helper/header_arquivo_test.rb +2 -2
- data/test/br_boleto/remessa/cnab240/helper/segmento_p_test.rb +1 -1
- data/test/br_boleto/remessa/cnab240/sicoob_test.rb +27 -27
- data/test/br_boleto/remessa/pagamento_test.rb +12 -2
- data/test/br_boleto/retorno/cnab240/base_test.rb +217 -0
- data/test/br_boleto/retorno/cnab240/caixa_test.rb +217 -0
- data/test/br_boleto/retorno/cnab240/sicoob_test.rb +217 -0
- data/test/br_boleto/retorno/pagamento_test.rb +179 -0
- data/test/factories/boleto/boleto_caixa.rb +25 -0
- data/test/factories/remessa/cnab240/caixa.rb +14 -0
- data/test/factories/remessa/pagamento.rb +1 -0
- data/test/factories/retorno/pagamento.rb +6 -0
- data/test/files/retorno/cnab240/caixa.ret +14 -0
- data/test/files/retorno/cnab240/padrao240.ret +14 -0
- metadata +51 -6
@@ -0,0 +1,217 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe BrBoleto::Retorno::Cnab240::Sicoob do
|
4
|
+
subject { BrBoleto::Retorno::Cnab240::Sicoob.new(file) }
|
5
|
+
let(:file) { File.join(BrBoleto.root, "test", "files", "retorno", "cnab240", "padrao240.ret") }
|
6
|
+
|
7
|
+
it "Deve ler o código do banco" do
|
8
|
+
subject.codigo_banco.must_equal '756'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "Deve carregar 5 pagamentos" do
|
12
|
+
subject.pagamentos.size.must_equal 5
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "deve setar as informações corretas para os pagamentos" do
|
16
|
+
it "valores para o pagamento 1" do
|
17
|
+
pagamento = subject.pagamentos[0]
|
18
|
+
pagamento.modalidade.must_equal '01'
|
19
|
+
pagamento.agencia_com_dv.must_equal "030690"
|
20
|
+
pagamento.agencia_sem_dv.must_equal "03069"
|
21
|
+
pagamento.numero_conta_com_dv.must_equal "0000000777778"
|
22
|
+
pagamento.numero_conta_sem_dv.must_equal "000000077777"
|
23
|
+
pagamento.dv_conta_e_agencia.must_equal "0"
|
24
|
+
pagamento.nosso_numero.must_equal "0000000330"
|
25
|
+
pagamento.carteira.must_equal "1"
|
26
|
+
pagamento.numero_codumento.must_equal "000000000000330"
|
27
|
+
pagamento.data_vencimento.must_equal Date.parse('03/05/2016')
|
28
|
+
pagamento.valor_titulo.must_equal 129.39
|
29
|
+
pagamento.banco_recebedor.must_equal "756"
|
30
|
+
pagamento.agencia_recebedora_com_dv.must_equal "030690"
|
31
|
+
pagamento.identificacao_titulo_empresa.must_equal ""
|
32
|
+
pagamento.codigo_moeda.must_equal "09"
|
33
|
+
pagamento.sacado_tipo_documento.must_equal "2"
|
34
|
+
pagamento.sacado_documento.must_equal "111111111111111"
|
35
|
+
pagamento.sacado_nome.must_equal "NOME DO CLIENTE 1"
|
36
|
+
pagamento.numero_contrato.must_equal "0000000000"
|
37
|
+
pagamento.valor_tarifa.must_equal 2.69
|
38
|
+
pagamento.motivo_ocorrencia.must_equal "0000000004"
|
39
|
+
pagamento.valor_juros_multa.must_equal 0.0
|
40
|
+
pagamento.valor_desconto.must_equal 0.0
|
41
|
+
pagamento.valor_abatimento.must_equal 0.0
|
42
|
+
pagamento.valor_iof.must_equal 0.0
|
43
|
+
pagamento.valor_pago.must_equal 129.39
|
44
|
+
pagamento.valor_liquido.must_equal 129.39
|
45
|
+
pagamento.valor_coutras_despesas.must_equal 0.0
|
46
|
+
pagamento.valor_coutros_creditos.must_equal 0.0
|
47
|
+
pagamento.data_ocorrencia.must_equal Date.parse('02/05/2016')
|
48
|
+
pagamento.data_credito.must_equal Date.parse('03/05/2016')
|
49
|
+
pagamento.codigo_ocorrencia_sacado.must_equal ""
|
50
|
+
pagamento.data_ocorrencia_sacado.must_equal nil
|
51
|
+
pagamento.valor_ocorrencia_sacado.must_equal 0.0
|
52
|
+
pagamento.complemento_ocorrencia_sacado.must_equal ""
|
53
|
+
pagamento.codigo_ocorrencia_banco_correspondente.must_equal "756"
|
54
|
+
pagamento.nosso_numero_banco_correspondente.must_equal ""
|
55
|
+
end
|
56
|
+
it "valores para o pagamento 2" do
|
57
|
+
pagamento = subject.pagamentos[1]
|
58
|
+
pagamento.modalidade.must_equal '02'
|
59
|
+
pagamento.agencia_com_dv.must_equal "030690"
|
60
|
+
pagamento.agencia_sem_dv.must_equal "03069"
|
61
|
+
pagamento.numero_conta_com_dv.must_equal "0000000777778"
|
62
|
+
pagamento.numero_conta_sem_dv.must_equal "000000077777"
|
63
|
+
pagamento.dv_conta_e_agencia.must_equal "0"
|
64
|
+
pagamento.nosso_numero.must_equal "0000000348"
|
65
|
+
pagamento.carteira.must_equal "1"
|
66
|
+
pagamento.numero_codumento.must_equal "000000000000348"
|
67
|
+
pagamento.data_vencimento.must_equal Date.parse('06/05/2016')
|
68
|
+
pagamento.valor_titulo.must_equal 29.0
|
69
|
+
pagamento.banco_recebedor.must_equal "756"
|
70
|
+
pagamento.agencia_recebedora_com_dv.must_equal "030690"
|
71
|
+
pagamento.identificacao_titulo_empresa.must_equal ""
|
72
|
+
pagamento.codigo_moeda.must_equal "09"
|
73
|
+
pagamento.sacado_tipo_documento.must_equal "2"
|
74
|
+
pagamento.sacado_documento.must_equal "222222222222222"
|
75
|
+
pagamento.sacado_nome.must_equal "NOME DO CLIENTE 2"
|
76
|
+
pagamento.numero_contrato.must_equal "0000000000"
|
77
|
+
pagamento.valor_tarifa.must_equal 2.69
|
78
|
+
pagamento.motivo_ocorrencia.must_equal "0000000004"
|
79
|
+
pagamento.valor_juros_multa.must_equal 0.0
|
80
|
+
pagamento.valor_desconto.must_equal 0.0
|
81
|
+
pagamento.valor_abatimento.must_equal 0.0
|
82
|
+
pagamento.valor_iof.must_equal 0.0
|
83
|
+
pagamento.valor_pago.must_equal 29.0
|
84
|
+
pagamento.valor_liquido.must_equal 29.0
|
85
|
+
pagamento.valor_coutras_despesas.must_equal 0.0
|
86
|
+
pagamento.valor_coutros_creditos.must_equal 0.0
|
87
|
+
pagamento.data_ocorrencia.must_equal Date.parse('05/05/2016')
|
88
|
+
pagamento.data_credito.must_equal Date.parse('06/05/2016')
|
89
|
+
pagamento.codigo_ocorrencia_sacado.must_equal ""
|
90
|
+
pagamento.data_ocorrencia_sacado.must_equal nil
|
91
|
+
pagamento.valor_ocorrencia_sacado.must_equal 0.0
|
92
|
+
pagamento.complemento_ocorrencia_sacado.must_equal ""
|
93
|
+
pagamento.codigo_ocorrencia_banco_correspondente.must_equal "304"
|
94
|
+
pagamento.nosso_numero_banco_correspondente.must_equal ""
|
95
|
+
end
|
96
|
+
it "valores para o pagamento 3" do
|
97
|
+
pagamento = subject.pagamentos[2]
|
98
|
+
pagamento.modalidade.must_equal '01'
|
99
|
+
pagamento.agencia_com_dv.must_equal "030690"
|
100
|
+
pagamento.agencia_sem_dv.must_equal "03069"
|
101
|
+
pagamento.numero_conta_com_dv.must_equal "0000000777778"
|
102
|
+
pagamento.numero_conta_sem_dv.must_equal "000000077777"
|
103
|
+
pagamento.dv_conta_e_agencia.must_equal "0"
|
104
|
+
pagamento.nosso_numero.must_equal "0000000355"
|
105
|
+
pagamento.carteira.must_equal "1"
|
106
|
+
pagamento.numero_codumento.must_equal "000000000000355"
|
107
|
+
pagamento.data_vencimento.must_equal Date.parse('06/05/2016')
|
108
|
+
pagamento.valor_titulo.must_equal 89.1
|
109
|
+
pagamento.banco_recebedor.must_equal "756"
|
110
|
+
pagamento.agencia_recebedora_com_dv.must_equal "030690"
|
111
|
+
pagamento.identificacao_titulo_empresa.must_equal ""
|
112
|
+
pagamento.codigo_moeda.must_equal "09"
|
113
|
+
pagamento.sacado_tipo_documento.must_equal "2"
|
114
|
+
pagamento.sacado_documento.must_equal "333333333333333"
|
115
|
+
pagamento.sacado_nome.must_equal "NOME DO CLIENTE 3"
|
116
|
+
pagamento.numero_contrato.must_equal "0000000000"
|
117
|
+
pagamento.valor_tarifa.must_equal 2.69
|
118
|
+
pagamento.motivo_ocorrencia.must_equal "0000000004"
|
119
|
+
pagamento.valor_juros_multa.must_equal 0.0
|
120
|
+
pagamento.valor_desconto.must_equal 0.0
|
121
|
+
pagamento.valor_abatimento.must_equal 0.0
|
122
|
+
pagamento.valor_iof.must_equal 0.0
|
123
|
+
pagamento.valor_pago.must_equal 89.1
|
124
|
+
pagamento.valor_liquido.must_equal 89.1
|
125
|
+
pagamento.valor_coutras_despesas.must_equal 0.0
|
126
|
+
pagamento.valor_coutros_creditos.must_equal 0.0
|
127
|
+
pagamento.data_ocorrencia.must_equal Date.parse('05/05/2016')
|
128
|
+
pagamento.data_credito.must_equal Date.parse('06/05/2016')
|
129
|
+
pagamento.codigo_ocorrencia_sacado.must_equal ""
|
130
|
+
pagamento.data_ocorrencia_sacado.must_equal nil
|
131
|
+
pagamento.valor_ocorrencia_sacado.must_equal 0.0
|
132
|
+
pagamento.complemento_ocorrencia_sacado.must_equal ""
|
133
|
+
pagamento.codigo_ocorrencia_banco_correspondente.must_equal "100"
|
134
|
+
pagamento.nosso_numero_banco_correspondente.must_equal ""
|
135
|
+
end
|
136
|
+
it "valores para o pagamento 4" do
|
137
|
+
pagamento = subject.pagamentos[3]
|
138
|
+
pagamento.modalidade.must_equal '01'
|
139
|
+
pagamento.agencia_com_dv.must_equal "030690"
|
140
|
+
pagamento.agencia_sem_dv.must_equal "03069"
|
141
|
+
pagamento.numero_conta_com_dv.must_equal "0000000777778"
|
142
|
+
pagamento.numero_conta_sem_dv.must_equal "000000077777"
|
143
|
+
pagamento.dv_conta_e_agencia.must_equal "0"
|
144
|
+
pagamento.nosso_numero.must_equal "0000000362"
|
145
|
+
pagamento.carteira.must_equal "1"
|
146
|
+
pagamento.numero_codumento.must_equal "000000000000362"
|
147
|
+
pagamento.data_vencimento.must_equal Date.parse('06/05/2016')
|
148
|
+
pagamento.valor_titulo.must_equal 29.0
|
149
|
+
pagamento.banco_recebedor.must_equal "104"
|
150
|
+
pagamento.agencia_recebedora_com_dv.must_equal "004140"
|
151
|
+
pagamento.identificacao_titulo_empresa.must_equal ""
|
152
|
+
pagamento.codigo_moeda.must_equal "09"
|
153
|
+
pagamento.sacado_tipo_documento.must_equal "1"
|
154
|
+
pagamento.sacado_documento.must_equal "444444444444444"
|
155
|
+
pagamento.sacado_nome.must_equal "NOME DO CLIENTE 4"
|
156
|
+
pagamento.numero_contrato.must_equal "0000000000"
|
157
|
+
pagamento.valor_tarifa.must_equal 2.69
|
158
|
+
pagamento.motivo_ocorrencia.must_equal "0000000004"
|
159
|
+
pagamento.valor_juros_multa.must_equal 0.0
|
160
|
+
pagamento.valor_desconto.must_equal 0.0
|
161
|
+
pagamento.valor_abatimento.must_equal 0.0
|
162
|
+
pagamento.valor_iof.must_equal 0.0
|
163
|
+
pagamento.valor_pago.must_equal 29.0
|
164
|
+
pagamento.valor_liquido.must_equal 29.0
|
165
|
+
pagamento.valor_coutras_despesas.must_equal 0.0
|
166
|
+
pagamento.valor_coutros_creditos.must_equal 0.0
|
167
|
+
pagamento.data_ocorrencia.must_equal Date.parse('06/05/2016')
|
168
|
+
pagamento.data_credito.must_equal nil
|
169
|
+
pagamento.codigo_ocorrencia_sacado.must_equal ""
|
170
|
+
pagamento.data_ocorrencia_sacado.must_equal nil
|
171
|
+
pagamento.valor_ocorrencia_sacado.must_equal 0.0
|
172
|
+
pagamento.complemento_ocorrencia_sacado.must_equal ""
|
173
|
+
pagamento.codigo_ocorrencia_banco_correspondente.must_equal "756"
|
174
|
+
pagamento.nosso_numero_banco_correspondente.must_equal ""
|
175
|
+
end
|
176
|
+
it "valores para o pagamento 5" do
|
177
|
+
pagamento = subject.pagamentos[4]
|
178
|
+
pagamento.modalidade.must_equal '01'
|
179
|
+
pagamento.agencia_com_dv.must_equal "030690"
|
180
|
+
pagamento.agencia_sem_dv.must_equal "03069"
|
181
|
+
pagamento.numero_conta_com_dv.must_equal "0000000777778"
|
182
|
+
pagamento.numero_conta_sem_dv.must_equal "000000077777"
|
183
|
+
pagamento.dv_conta_e_agencia.must_equal "0"
|
184
|
+
pagamento.nosso_numero.must_equal "0000000362"
|
185
|
+
pagamento.carteira.must_equal "1"
|
186
|
+
pagamento.numero_codumento.must_equal "000000000000362"
|
187
|
+
pagamento.data_vencimento.must_equal Date.parse('06/05/2016')
|
188
|
+
pagamento.valor_titulo.must_equal 47.37
|
189
|
+
pagamento.banco_recebedor.must_equal "104"
|
190
|
+
pagamento.agencia_recebedora_com_dv.must_equal "004140"
|
191
|
+
pagamento.identificacao_titulo_empresa.must_equal ""
|
192
|
+
pagamento.codigo_moeda.must_equal "09"
|
193
|
+
pagamento.sacado_tipo_documento.must_equal "1"
|
194
|
+
pagamento.sacado_documento.must_equal "555555555555555"
|
195
|
+
pagamento.sacado_nome.must_equal "NOME DO CLIENTE 5"
|
196
|
+
pagamento.numero_contrato.must_equal "0000000000"
|
197
|
+
pagamento.valor_tarifa.must_equal 2.69
|
198
|
+
pagamento.motivo_ocorrencia.must_equal "0000000004"
|
199
|
+
pagamento.valor_juros_multa.must_equal 0.0
|
200
|
+
pagamento.valor_desconto.must_equal 0.0
|
201
|
+
pagamento.valor_abatimento.must_equal 0.0
|
202
|
+
pagamento.valor_iof.must_equal 0.0
|
203
|
+
pagamento.valor_pago.must_equal 47.37
|
204
|
+
pagamento.valor_liquido.must_equal 47.37
|
205
|
+
pagamento.valor_coutras_despesas.must_equal 0.0
|
206
|
+
pagamento.valor_coutros_creditos.must_equal 0.0
|
207
|
+
pagamento.data_ocorrencia.must_equal Date.parse('06/05/2016')
|
208
|
+
pagamento.data_credito.must_equal nil
|
209
|
+
pagamento.codigo_ocorrencia_sacado.must_equal ""
|
210
|
+
pagamento.data_ocorrencia_sacado.must_equal nil
|
211
|
+
pagamento.valor_ocorrencia_sacado.must_equal 0.0
|
212
|
+
pagamento.complemento_ocorrencia_sacado.must_equal ""
|
213
|
+
pagamento.codigo_ocorrencia_banco_correspondente.must_equal "756"
|
214
|
+
pagamento.nosso_numero_banco_correspondente.must_equal ""
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
@@ -0,0 +1,179 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
describe BrBoleto::Retorno::Pagamento do
|
5
|
+
|
6
|
+
subject { FactoryGirl.build(:retorno_pagamento) }
|
7
|
+
|
8
|
+
describe "atributos que devem ser convertidos para data quando o valor for setado" do
|
9
|
+
describe "#data_vencimento" do
|
10
|
+
it "deve converter para uma data se a string estiver no formato DDMMYYYY" do
|
11
|
+
subject.data_vencimento = '12041991'
|
12
|
+
subject.data_vencimento.must_equal Date.parse('12/04/1991')
|
13
|
+
end
|
14
|
+
it "Se for uma data inválida deve setar o valor nil" do
|
15
|
+
subject.data_vencimento = '99999999'
|
16
|
+
subject.data_vencimento.must_be_nil
|
17
|
+
end
|
18
|
+
it "Deve aceitar o valor se for do tipo Date" do
|
19
|
+
subject.data_vencimento = Date.parse('05/07/2014')
|
20
|
+
subject.data_vencimento.must_equal Date.parse('05/07/2014')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe "#data_ocorrencia" do
|
24
|
+
it "deve converter para uma data se a string estiver no formato DDMMYYYY" do
|
25
|
+
subject.data_ocorrencia = '12041991'
|
26
|
+
subject.data_ocorrencia.must_equal Date.parse('12/04/1991')
|
27
|
+
end
|
28
|
+
it "Se for uma data inválida deve setar o valor nil" do
|
29
|
+
subject.data_ocorrencia = '99999999'
|
30
|
+
subject.data_ocorrencia.must_be_nil
|
31
|
+
end
|
32
|
+
it "Deve aceitar o valor se for do tipo Date" do
|
33
|
+
subject.data_ocorrencia = Date.parse('05/07/2014')
|
34
|
+
subject.data_ocorrencia.must_equal Date.parse('05/07/2014')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
describe "#data_credito" do
|
38
|
+
it "deve converter para uma data se a string estiver no formato DDMMYYYY" do
|
39
|
+
subject.data_credito = '12041991'
|
40
|
+
subject.data_credito.must_equal Date.parse('12/04/1991')
|
41
|
+
end
|
42
|
+
it "Se for uma data inválida deve setar o valor nil" do
|
43
|
+
subject.data_credito = '99999999'
|
44
|
+
subject.data_credito.must_be_nil
|
45
|
+
end
|
46
|
+
it "Deve aceitar o valor se for do tipo Date" do
|
47
|
+
subject.data_credito = Date.parse('05/07/2014')
|
48
|
+
subject.data_credito.must_equal Date.parse('05/07/2014')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
describe "#data_ocorrencia_sacado" do
|
52
|
+
it "deve converter para uma data se a string estiver no formato DDMMYYYY" do
|
53
|
+
subject.data_ocorrencia_sacado = '12041991'
|
54
|
+
subject.data_ocorrencia_sacado.must_equal Date.parse('12/04/1991')
|
55
|
+
end
|
56
|
+
it "Se for uma data inválida deve setar o valor nil" do
|
57
|
+
subject.data_ocorrencia_sacado = '99999999'
|
58
|
+
subject.data_ocorrencia_sacado.must_be_nil
|
59
|
+
end
|
60
|
+
it "Deve aceitar o valor se for do tipo Date" do
|
61
|
+
subject.data_ocorrencia_sacado = Date.parse('05/07/2014')
|
62
|
+
subject.data_ocorrencia_sacado.must_equal Date.parse('05/07/2014')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "atributos que devem ser convertidos para Float quando o valor for setado" do
|
68
|
+
describe "#valor_titulo" do
|
69
|
+
it "deve converter o valor string para float mantendo os 2 ultimos characteres com decimais" do
|
70
|
+
subject.valor_titulo = '00087944'
|
71
|
+
subject.valor_titulo.must_equal 879.44
|
72
|
+
end
|
73
|
+
it "se o valor setado for um numero deve mante-lo" do
|
74
|
+
subject.valor_titulo = 7_745.67
|
75
|
+
subject.valor_titulo.must_equal 7_745.67
|
76
|
+
end
|
77
|
+
end
|
78
|
+
describe "#valor_tarifa" do
|
79
|
+
it "deve converter o valor string para float mantendo os 2 ultimos characteres com decimais" do
|
80
|
+
subject.valor_tarifa = '00087944'
|
81
|
+
subject.valor_tarifa.must_equal 879.44
|
82
|
+
end
|
83
|
+
it "se o valor setado for um numero deve mante-lo" do
|
84
|
+
subject.valor_titulo = 7_745.67
|
85
|
+
subject.valor_titulo.must_equal 7_745.67
|
86
|
+
end
|
87
|
+
end
|
88
|
+
describe "#valor_juros_multa" do
|
89
|
+
it "deve converter o valor string para float mantendo os 2 ultimos characteres com decimais" do
|
90
|
+
subject.valor_juros_multa = '00087944'
|
91
|
+
subject.valor_juros_multa.must_equal 879.44
|
92
|
+
end
|
93
|
+
it "se o valor setado for um numero deve mante-lo" do
|
94
|
+
subject.valor_titulo = 7_745.67
|
95
|
+
subject.valor_titulo.must_equal 7_745.67
|
96
|
+
end
|
97
|
+
end
|
98
|
+
describe "#valor_desconto" do
|
99
|
+
it "deve converter o valor string para float mantendo os 2 ultimos characteres com decimais" do
|
100
|
+
subject.valor_desconto = '00087944'
|
101
|
+
subject.valor_desconto.must_equal 879.44
|
102
|
+
end
|
103
|
+
it "se o valor setado for um numero deve mante-lo" do
|
104
|
+
subject.valor_titulo = 7_745.67
|
105
|
+
subject.valor_titulo.must_equal 7_745.67
|
106
|
+
end
|
107
|
+
end
|
108
|
+
describe "#valor_abatimento" do
|
109
|
+
it "deve converter o valor string para float mantendo os 2 ultimos characteres com decimais" do
|
110
|
+
subject.valor_abatimento = '00087944'
|
111
|
+
subject.valor_abatimento.must_equal 879.44
|
112
|
+
end
|
113
|
+
it "se o valor setado for um numero deve mante-lo" do
|
114
|
+
subject.valor_titulo = 7_745.67
|
115
|
+
subject.valor_titulo.must_equal 7_745.67
|
116
|
+
end
|
117
|
+
end
|
118
|
+
describe "#valor_iof" do
|
119
|
+
it "deve converter o valor string para float mantendo os 2 ultimos characteres com decimais" do
|
120
|
+
subject.valor_iof = '00087944'
|
121
|
+
subject.valor_iof.must_equal 879.44
|
122
|
+
end
|
123
|
+
it "se o valor setado for um numero deve mante-lo" do
|
124
|
+
subject.valor_titulo = 7_745.67
|
125
|
+
subject.valor_titulo.must_equal 7_745.67
|
126
|
+
end
|
127
|
+
end
|
128
|
+
describe "#valor_pago" do
|
129
|
+
it "deve converter o valor string para float mantendo os 2 ultimos characteres com decimais" do
|
130
|
+
subject.valor_pago = '00087944'
|
131
|
+
subject.valor_pago.must_equal 879.44
|
132
|
+
end
|
133
|
+
it "se o valor setado for um numero deve mante-lo" do
|
134
|
+
subject.valor_titulo = 7_745.67
|
135
|
+
subject.valor_titulo.must_equal 7_745.67
|
136
|
+
end
|
137
|
+
end
|
138
|
+
describe "#valor_liquido" do
|
139
|
+
it "deve converter o valor string para float mantendo os 2 ultimos characteres com decimais" do
|
140
|
+
subject.valor_liquido = '00087944'
|
141
|
+
subject.valor_liquido.must_equal 879.44
|
142
|
+
end
|
143
|
+
it "se o valor setado for um numero deve mante-lo" do
|
144
|
+
subject.valor_titulo = 7_745.67
|
145
|
+
subject.valor_titulo.must_equal 7_745.67
|
146
|
+
end
|
147
|
+
end
|
148
|
+
describe "#valor_coutras_despesas" do
|
149
|
+
it "deve converter o valor string para float mantendo os 2 ultimos characteres com decimais" do
|
150
|
+
subject.valor_coutras_despesas = '00087944'
|
151
|
+
subject.valor_coutras_despesas.must_equal 879.44
|
152
|
+
end
|
153
|
+
it "se o valor setado for um numero deve mante-lo" do
|
154
|
+
subject.valor_titulo = 7_745.67
|
155
|
+
subject.valor_titulo.must_equal 7_745.67
|
156
|
+
end
|
157
|
+
end
|
158
|
+
describe "#valor_coutros_creditos" do
|
159
|
+
it "deve converter o valor string para float mantendo os 2 ultimos characteres com decimais" do
|
160
|
+
subject.valor_coutros_creditos = '00087944'
|
161
|
+
subject.valor_coutros_creditos.must_equal 879.44
|
162
|
+
end
|
163
|
+
it "se o valor setado for um numero deve mante-lo" do
|
164
|
+
subject.valor_titulo = 7_745.67
|
165
|
+
subject.valor_titulo.must_equal 7_745.67
|
166
|
+
end
|
167
|
+
end
|
168
|
+
describe "#valor_ocorrencia_sacado" do
|
169
|
+
it "deve converter o valor string para float mantendo os 2 ultimos characteres com decimais" do
|
170
|
+
subject.valor_ocorrencia_sacado = '00087944'
|
171
|
+
subject.valor_ocorrencia_sacado.must_equal 879.44
|
172
|
+
end
|
173
|
+
it "se o valor setado for um numero deve mante-lo" do
|
174
|
+
subject.valor_titulo = 7_745.67
|
175
|
+
subject.valor_titulo.must_equal 7_745.67
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
FactoryGirl.define do
|
4
|
+
factory :boleto_caixa, class: BrBoleto::Boleto::Caixa do
|
5
|
+
cedente 'Fabrica de Materiais LTDA'
|
6
|
+
documento_cedente '200.874.0006-87'
|
7
|
+
endereco_cedente 'Rua para Testes - Belo Horizonte / MG'
|
8
|
+
sacado 'Cleber Machado dos Santos'
|
9
|
+
documento_sacado '52166727964'
|
10
|
+
endereco_sacado 'Rua Teste do Seu Cliente'
|
11
|
+
numero_documento '458'
|
12
|
+
data_vencimento { Date.tomorrow }
|
13
|
+
data_documento { Date.current }
|
14
|
+
agencia "2391"
|
15
|
+
codigo_cedente '4433'
|
16
|
+
valor_documento 750.27
|
17
|
+
carteira '14'
|
18
|
+
instrucoes1 'instrucoes1'
|
19
|
+
instrucoes2 'instrucoes2'
|
20
|
+
instrucoes3 'instrucoes3'
|
21
|
+
instrucoes4 'instrucoes4'
|
22
|
+
instrucoes5 'instrucoes5'
|
23
|
+
instrucoes6 'instrucoes6'
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
FactoryGirl.define do
|
4
|
+
factory :remessa_cnab240_caixa, class: BrBoleto::Remessa::Cnab240::Caixa do
|
5
|
+
lotes { FactoryGirl.build(:remessa_lote) }
|
6
|
+
nome_empresa "Nome da empresa"
|
7
|
+
agencia "3069"
|
8
|
+
carteira '14'
|
9
|
+
sequencial_remessa 1
|
10
|
+
documento_cedente '93.671.653/0001-83'
|
11
|
+
convenio '31400'
|
12
|
+
modalidade_carteira '14'
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
10400000 299999666655555 03069000000007777780NOME DA EMPRESA SACADO LTDA NOME DO BANCO 20905201608511600000108500000
|
2
|
+
10400011T01 043 2099999666655555 306900000203069000000007777780NOME DA EMPRESA SACADO LTDA 000000000905201600000000
|
3
|
+
1040001300001T 06030690CEDEN1EC1BC1EXC1M1NOSSONUMERO00010XNUMEROCOD01EXCL03052016000000000012939104030690 092111111111111111NOME DO CLIENTE 1 00000000000000000000002690000000004
|
4
|
+
1040001300002U 060000000000000000000000000000000000000000000000000000000000000000000000129390000000000129390000000000000000000000000000000205201603052016 00000000000000000000000 75600000000000000000000
|
5
|
+
1040001300003T 06030690CEDEN2EC2BC1EXC2M2NOSSONUMERO00020XNUMEROCOD02EXCL06052016000000000002900104030690 092222222222222222NOME DO CLIENTE 2 00000000000000000000002690000000004
|
6
|
+
1040001300004U 060000000000000000000000000000000000000000000000000000000000000000000000029000000000000029000000000000000000000000000000000505201606052016 00000000000000000000000 30400000000000000000000
|
7
|
+
1040001300005T 06030690CEDEN3EC3BC1EXC3M3NOSSONUMERO00030XNUMEROCOD03EXCL06052016000000000008910104030690 092333333333333333NOME DO CLIENTE 3 00000000000000000000002690000000004
|
8
|
+
1040001300006U 060000000000000000000000000000000000000000000000000000000000000000000000089100000000000089100000000000000000000000000000000505201606052016 00000000000000000000000 10000000000000000000000
|
9
|
+
1040001300007T 06030690CEDEN4EC4BC1EXC4M4NOSSONUMERO00040XNUMEROCOD04EXCL06052016000000000002900104004140 091444444444444444NOME DO CLIENTE 4 00000000000000000000002690000000004
|
10
|
+
1040001300008U 060000000000000000000000000000000000000000000000000000000000000000000000029000000000000029000000000000000000000000000000000605201600000000 00000000000000000000000 10400000000000000000000
|
11
|
+
1040001300009T 06030690CEDEN5EC5BC1EXC5M5NOSSONUMERO00050XNUMEROCOD05EXCL06052016000000000004737104004140 091555555555555555NOME DO CLIENTE 5 00000000000000000000002690000000004
|
12
|
+
1040001300010U 060000000000000000000000000000000000000000000000000000000000000000000000047370000000000047370000000000000000000000000000000605201600000000 00000000000000000000000 10400000000000000000000
|
13
|
+
10400015 00001200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
14
|
+
10499999 000001000012000000
|
@@ -0,0 +1,14 @@
|
|
1
|
+
75600000 299999666655555 03069000000007777780NOME DA EMPRESA SACADO LTDA NOME DO BANCO 20905201608511600000108500000
|
2
|
+
75600011T01 043 2099999666655555 306900000203069000000007777780NOME DA EMPRESA SACADO LTDA 000000000905201600000000
|
3
|
+
7560001300001T 0603069000000007777780000000033001014 100000000000033003052016000000000012939756030690 092111111111111111NOME DO CLIENTE 1 00000000000000000000002690000000004
|
4
|
+
7560001300002U 060000000000000000000000000000000000000000000000000000000000000000000000129390000000000129390000000000000000000000000000000205201603052016 00000000000000000000000 75600000000000000000000
|
5
|
+
7560001300003T 0603069000000007777780000000034801024 100000000000034806052016000000000002900756030690 092222222222222222NOME DO CLIENTE 2 00000000000000000000002690000000004
|
6
|
+
7560001300004U 060000000000000000000000000000000000000000000000000000000000000000000000029000000000000029000000000000000000000000000000000505201606052016 00000000000000000000000 30400000000000000000000
|
7
|
+
7560001300005T 0603069000000007777780000000035501014 100000000000035506052016000000000008910756030690 092333333333333333NOME DO CLIENTE 3 00000000000000000000002690000000004
|
8
|
+
7560001300006U 060000000000000000000000000000000000000000000000000000000000000000000000089100000000000089100000000000000000000000000000000505201606052016 00000000000000000000000 10000000000000000000000
|
9
|
+
7560001300007T 0603069000000007777780000000036201014 100000000000036206052016000000000002900104004140 091444444444444444NOME DO CLIENTE 4 00000000000000000000002690000000004
|
10
|
+
7560001300008U 060000000000000000000000000000000000000000000000000000000000000000000000029000000000000029000000000000000000000000000000000605201600000000 00000000000000000000000 75600000000000000000000
|
11
|
+
7560001300009T 0603069000000007777780000000036201014 100000000000036206052016000000000004737104004140 091555555555555555NOME DO CLIENTE 5 00000000000000000000002690000000004
|
12
|
+
7560001300010U 060000000000000000000000000000000000000000000000000000000000000000000000047370000000000047370000000000000000000000000000000605201600000000 00000000000000000000000 75600000000000000000000
|
13
|
+
75600015 00001200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
14
|
+
75699999 000001000012000000
|