brcobranca 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +13 -9
- data/README.md +5 -1
- data/brcobranca.gemspec +2 -0
- data/lib/brcobranca/arquivos/logos/sicoob.eps +209 -0
- data/lib/brcobranca/boleto/bradesco.rb +20 -0
- data/lib/brcobranca/boleto/sicoob.rb +80 -0
- data/lib/brcobranca/remessa/base.rb +1 -1
- data/lib/brcobranca/remessa/cnab240/banco_brasil.rb +7 -2
- data/lib/brcobranca/remessa/cnab240/base.rb +133 -134
- data/lib/brcobranca/remessa/cnab240/caixa.rb +6 -1
- data/lib/brcobranca/remessa/cnab240/sicoob.rb +128 -0
- data/lib/brcobranca/remessa/cnab400/base.rb +5 -5
- data/lib/brcobranca/remessa/cnab400/bradesco.rb +5 -3
- data/lib/brcobranca/remessa/cnab400/citibank.rb +140 -0
- data/lib/brcobranca/remessa/cnab400/itau.rb +4 -11
- data/lib/brcobranca/remessa/pagamento.rb +39 -5
- data/lib/brcobranca/retorno/base.rb +1 -0
- data/lib/brcobranca/retorno/cnab400/base.rb +40 -0
- data/lib/brcobranca/retorno/cnab400/bradesco.rb +117 -0
- data/lib/brcobranca/retorno/cnab400/itau.rb +136 -0
- data/lib/brcobranca/retorno/retorno_cnab400.rb +6 -1
- data/lib/brcobranca/util/empresa.rb +29 -0
- data/lib/brcobranca/version.rb +1 -1
- data/lib/brcobranca.rb +19 -5
- data/spec/arquivos/CNAB400BRADESCO.RET +8 -0
- data/spec/arquivos/CNAB400ITAU.RET +54 -0
- data/spec/brcobranca/base_spec.rb +175 -179
- data/spec/brcobranca/{banco_bradesco_spec.rb → boleto/banco_bradesco_spec.rb} +80 -53
- data/spec/brcobranca/{banco_brasil_spec.rb → boleto/banco_brasil_spec.rb} +2 -2
- data/spec/brcobranca/{banco_caixa_spec.rb → boleto/banco_caixa_spec.rb} +1 -1
- data/spec/brcobranca/{banco_hsbc_spec.rb → boleto/banco_hsbc_spec.rb} +2 -2
- data/spec/brcobranca/{banco_itau_spec.rb → boleto/banco_itau_spec.rb} +2 -2
- data/spec/brcobranca/{banco_santander_spec.rb → boleto/banco_santander_spec.rb} +2 -2
- data/spec/brcobranca/boleto/banco_sicoob_spec.rb +132 -0
- data/spec/brcobranca/{banco_sicredi_spec.rb → boleto/banco_sicredi_spec.rb} +2 -2
- data/spec/brcobranca/boletos_em_lote_spec.rb +2 -2
- data/spec/brcobranca/core_ext_spec.rb +198 -199
- data/spec/brcobranca/currency_spec.rb +67 -71
- data/spec/brcobranca/remessa/base_spec.rb +1 -17
- data/spec/brcobranca/remessa/cnab240/banco_brasil_spec.rb +22 -13
- data/spec/brcobranca/remessa/cnab240/base_spec.rb +28 -27
- data/spec/brcobranca/remessa/cnab240/caixa_spec.rb +13 -4
- data/spec/brcobranca/remessa/cnab240/sicoob_spec.rb +155 -0
- data/spec/brcobranca/remessa/cnab400/base_spec.rb +1 -17
- data/spec/brcobranca/remessa/cnab400/bradesco_spec.rb +15 -2
- data/spec/brcobranca/remessa/cnab400/citibank_spec.rb +117 -0
- data/spec/brcobranca/remessa/cnab400/itau_spec.rb +15 -10
- data/spec/brcobranca/remessa/pagamento_spec.rb +6 -8
- data/spec/brcobranca/retorno/cnab400/base_spec.rb +35 -0
- data/spec/brcobranca/retorno/cnab400/bradesco_spec.rb +55 -0
- data/spec/brcobranca/retorno/cnab400/itau_spec.rb +55 -0
- data/spec/brcobranca/{retorno_cbr643_spec.rb → retorno/retorno_cbr643_spec.rb} +3 -3
- data/spec/brcobranca/{retorno_cnab400_spec.rb → retorno/retorno_cnab400_spec.rb} +3 -3
- data/spec/brcobranca/{retorno_cnab_240_spec.rb → retorno/retorno_cnab_240_spec.rb} +3 -3
- data/spec/brcobranca/rghost_spec.rb +2 -2
- data/spec/brcobranca/util/empresa_spec.rb +35 -0
- data/spec/brcobranca_spec.rb +25 -10
- data/spec/fixtures/remessa/.keep +0 -0
- data/spec/fixtures/remessa/remessa-bancoob.rem +6 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/support/remessa_helpers.rb +12 -0
- data/spec/{shared_examples → support/shared_examples}/cnab240.rb +17 -15
- data/spec/{shared_examples → support/shared_examples}/cnab400.rb +11 -3
- metadata +72 -26
data/lib/brcobranca.rb
CHANGED
@@ -97,23 +97,30 @@ module Brcobranca
|
|
97
97
|
autoload :Hsbc, 'brcobranca/boleto/hsbc'
|
98
98
|
autoload :Bradesco, 'brcobranca/boleto/bradesco'
|
99
99
|
autoload :Caixa, 'brcobranca/boleto/caixa'
|
100
|
+
autoload :Sicoob, 'brcobranca/boleto/sicoob'
|
100
101
|
autoload :Sicredi, 'brcobranca/boleto/sicredi'
|
101
102
|
autoload :Santander, 'brcobranca/boleto/santander'
|
102
103
|
|
103
104
|
# Módulos para classes de template
|
104
105
|
module Template
|
105
|
-
autoload :Base,
|
106
|
-
autoload :Rghost,
|
106
|
+
autoload :Base, 'brcobranca/boleto/template/base'
|
107
|
+
autoload :Rghost, 'brcobranca/boleto/template/rghost'
|
107
108
|
autoload :RghostCarne, 'brcobranca/boleto/template/rghost_carne'
|
108
109
|
end
|
109
110
|
end
|
110
111
|
|
111
112
|
# Módulos para classes de retorno bancário
|
112
113
|
module Retorno
|
113
|
-
autoload :Base,
|
114
|
-
autoload :RetornoCbr643,
|
114
|
+
autoload :Base, 'brcobranca/retorno/base'
|
115
|
+
autoload :RetornoCbr643, 'brcobranca/retorno/retorno_cbr643'
|
115
116
|
autoload :RetornoCnab240, 'brcobranca/retorno/retorno_cnab240'
|
116
|
-
autoload :RetornoCnab400, 'brcobranca/retorno/retorno_cnab400'
|
117
|
+
autoload :RetornoCnab400, 'brcobranca/retorno/retorno_cnab400' # DEPRECATED
|
118
|
+
|
119
|
+
module Cnab400
|
120
|
+
autoload :Base, 'brcobranca/retorno/cnab400/base'
|
121
|
+
autoload :Bradesco, 'brcobranca/retorno/cnab400/bradesco'
|
122
|
+
autoload :Itau, 'brcobranca/retorno/cnab400/itau'
|
123
|
+
end
|
117
124
|
end
|
118
125
|
|
119
126
|
# Módulos para as classes que geram os arquivos remessa
|
@@ -125,12 +132,19 @@ module Brcobranca
|
|
125
132
|
autoload :Base, 'brcobranca/remessa/cnab400/base'
|
126
133
|
autoload :Bradesco, 'brcobranca/remessa/cnab400/bradesco'
|
127
134
|
autoload :Itau, 'brcobranca/remessa/cnab400/itau'
|
135
|
+
autoload :Citibank, 'brcobranca/remessa/cnab400/citibank'
|
128
136
|
end
|
129
137
|
|
130
138
|
module Cnab240
|
131
139
|
autoload :Base, 'brcobranca/remessa/cnab240/base'
|
132
140
|
autoload :Caixa, 'brcobranca/remessa/cnab240/caixa'
|
133
141
|
autoload :BancoBrasil, 'brcobranca/remessa/cnab240/banco_brasil'
|
142
|
+
autoload :Sicoob, 'brcobranca/remessa/cnab240/sicoob'
|
134
143
|
end
|
135
144
|
end
|
145
|
+
|
146
|
+
# Módulos para classes de utilidades
|
147
|
+
module Util
|
148
|
+
autoload :Empresa, 'brcobranca/util/empresa'
|
149
|
+
end
|
136
150
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
02RETORNO01COBRANCA 00000000000004540691NOME DA EMPRESA 237BRADESCO 1505150160000000405 150515 000001
|
2
|
+
102120958700001700000009014670019669P 0000000000000000030300000000000000000000000009021505150030 00000000000000000030250515000000014500023704157 000000000016000000000000000000000000000000000000000000000000000000000000000000000000014500000000000000000000000000000 150515 0000000000 000002
|
3
|
+
102120958700001700000009014670019669P 0000000051350000004P00000000000000000000000009021505151146 0000000051350000004P250515000000001800023704157 000000000016000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000 000003
|
4
|
+
102120958700001700000009014670019669P 0000000051350000007400000000000000000000000009021505151142 00000000513500000074250515000000007200023704157 000000000016000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000 000004
|
5
|
+
102120958700001700000009014670019669P 0000000051350000009000000000000000000000000009021505151145 00000000513500000090120615000000002000023704157 000000000016000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000 000005
|
6
|
+
102120958700001700000009014670019669P 0000000051350000011200000000000000000000000009021505151144 00000000513500000112250515000000001800023704157 000000000016000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000 000006
|
7
|
+
102120958700001700000009014670019669P 0000000050980000002800000000000000000000000009101505151053 00000000509800000028060515000000002000023700000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000 000007
|
8
|
+
9201237 000000180000000086450000000405 00005000000202000000000000000000000000000000000000100000002000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000 000008
|
@@ -0,0 +1,54 @@
|
|
1
|
+
02RETORNO01COBRANCA 073000035110 PLUTO ALTO ELENTAS LTDA ME 341BANCO ITAU S.A.20051301600BPI00025210513 000001
|
2
|
+
10216733872000107073000035110 00000011 109000000114 I06200513 00000011 000000000000000400010418739 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000002
|
3
|
+
10216733872000107073000035110 00000035 109000000353 I06200513 00000035 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000003
|
4
|
+
10216733872000107073000035110 00000052 109000000528 I06200513 00000052 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000004
|
5
|
+
10216733872000107073000035110 00000107 109000001070 I06200513 00000107 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000005
|
6
|
+
10216733872000107073000035110 00000139 109000001393 I06200513 00000139 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000006
|
7
|
+
10216733872000107073000035110 00000195 109000001955 I06200513 00000195 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000007
|
8
|
+
10216733872000107073000035110 00000267 109000002672 I06200513 00000267 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000008
|
9
|
+
10216733872000107073000035110 00000331 109000003316 I06200513 00000331 000000000000000400010404085 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000009
|
10
|
+
10216733872000107073000035110 00000541 109000005410 I06200513 00000541 000000000000001050010417848 000000000021000000000000000000000000000000000000000000000000000000000000000000000000001029000000000000000000000000000 21051300000000000000000000000 B5000010
|
11
|
+
10216733872000107073000035110 00000890 109000008901 I06200513 00000890 000000000000000400010418754 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000011
|
12
|
+
10216733872000107073000035110 00000956 109000009560 I06200513 00000956 000000000000000750010417848 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000729000000000000000000000000000 21051300000000000000000000000 B5000012
|
13
|
+
10216733872000107073000035110 00000975 109000009750 I06200513 00000975 000000000000000750010417848 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000729000000000000000000000000000 21051300000000000000000000000 B2000013
|
14
|
+
10216733872000107073000035110 00001036 109000010360 I06200513 00001036 000000000000000210034178584 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000189000000000000000000000000000 21051300000000000000000000000 CP000014
|
15
|
+
10216733872000107073000035110 00001052 109000010527 I06200513 00001052 000000000000000840010417848 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000819000000000000000000000000000 21051300000000000000000000000 B5000015
|
16
|
+
10216733872000107073000035110 00001109 109000011095 I06200513 00001109 000000000000000460010436921 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000439000000000000000000000000000 21051300000000000000000000000 B5000016
|
17
|
+
10216733872000107073000035110 00001123 109000011236 I06200513 00001123 000000000000000400010418754 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000017
|
18
|
+
10216733872000107073000035110 00001206 109000012069 I06200513 00001206 000000000000000400010418754 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000018
|
19
|
+
10216733872000107073000035110 00001324 109000013240 I06200513 00001324 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000019
|
20
|
+
10216733872000107073000035110 00001351 109000013513 I06200513 00001351 000000000000000400023729371 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B2000020
|
21
|
+
10216733872000107073000035110 00001372 109000013729 I06200513 00001372 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000021
|
22
|
+
10216733872000107073000035110 00001373 109000013737 I06200513 00001373 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000022
|
23
|
+
10216733872000107073000035110 00001380 109000013802 I06200513 00001380 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000023
|
24
|
+
10216733872000107073000035110 00001458 109000014586 I06200513 00001458 000000000000000400000152480 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000024
|
25
|
+
10216733872000107073000035110 00001498 109000014982 I06200513 00001498 000000000000000400034102899 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 AA000025
|
26
|
+
10216733872000107073000035110 00001698 109000016987 I06200513 00001698 000000000000000191010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000 21051300000000000000000000000 B5000026
|
27
|
+
10216733872000107073000035110 00002129 109000021292 I06200513 00002129 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000027
|
28
|
+
10216733872000107073000035110 00002236 109000022365 I06200513 00002236 000000000000000400010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000028
|
29
|
+
10216733872000107073000035110 00002260 109000022605 I06200513 00002260 000000000000000400010436921 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B2000029
|
30
|
+
10216733872000107073000035110 00002274 109000022746 I06200513 00002274 000000000000000400034186686 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 CP000030
|
31
|
+
10216733872000107073000035110 00002286 109000022860 I06200513 00002286 000000000000000400010436921 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000031
|
32
|
+
10216733872000107073000035110 00002311 109000023116 I06200513 00002311 000000000000000400010418770 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000379000000000000000000000000000 21051300000000000000000000000 B5000032
|
33
|
+
10216733872000107073000035110 00002586 109000025863 I06200513 00002586 000000000000000640010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000619000000000000000000000000000 21051300000000000000000000000 B5000033
|
34
|
+
10216733872000107073000035110 00002597 109000025970 I06200513 00002597 000000000000000440000126385 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000419000000000000000000000000000 21051300000000000000000000000 B5000034
|
35
|
+
10216733872000107073000035110 00002601 109000026010 I06200513 00002601 000000000000000440010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000419000000000000000000000000000 21051300000000000000000000000 B5000035
|
36
|
+
10216733872000107073000035110 00002607 109000026077 I06200513 00002607 000000000000000440010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000419000000000000000000000000000 21051300000000000000000000000 B5000036
|
37
|
+
10216733872000107073000035110 00002617 109000026176 I06200513 00002617 000000000000000440000148322 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000419000000000000000000000000000 21051300000000000000000000000 B1000037
|
38
|
+
10216733872000107073000035110 00002627 109000026275 I06200513 00002627 000000000000000440000148298 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000419000000000000000000000000000 21051300000000000000000000000 B1000038
|
39
|
+
10216733872000107073000035110 00002668 109000026689 I06200513 00002668 000000000000000440023729371 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000419000000000000000000000000000 21051300000000000000000000000 B3000039
|
40
|
+
10216733872000107073000035110 00002674 109000026747 I06200513 00002674 000000000000000440010404085 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000419000000000000000000000000000 21051300000000000000000000000 B5000040
|
41
|
+
10216733872000107073000035110 00002721 109000027216 I06200513 00002721 000000000000000440010415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000419000000000000000000000000000 21051300000000000000000000000 B5000041
|
42
|
+
10216733872000107073000035110 00003136 109000031366 I06200513 00003136 000000000000000487534148272 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000476700000000001020000000000000 21051300000000000000000000000 CP000042
|
43
|
+
10216733872000107073000035110 00003238 109000032380 I06200513 00003238 000000000000003500000130478 000000000021000000000000000000000000000000000000000000000000000000000000000000000000003479000000000000000000000000000 21051300000000000000000000000 B2000043
|
44
|
+
10216733872000107073000035110 00003344 109000033446 I06200513 00003344 000000000000000440000148298 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000419000000000000000000000000000 21051300000000000000000000000 B1000044
|
45
|
+
10216733872000107073000035110 00003391 109000033917 I06200513 00003391 000000000000000440034186132 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000419000000000000000000000000000 21051300000000000000000000000 BL000045
|
46
|
+
10216733872000107073000035110 00003456 109000034568 I06200513 00003456 000000000000000571534102899 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000562200000000001170000000000000 21051300000000000000000000000 CP000046
|
47
|
+
10216733872000107073000035110 00003505 109000035052 I06200513 00003505 000000000000000457100148322 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000436100000000000000000000000000 21051300000000000000000000000 B1000047
|
48
|
+
10216733872000107073000035110 00003925 109000039252 I06200513 00003925 000000000000000571034165466 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000561900000000001190000000000000 21051300000000000000000000000 CP000048
|
49
|
+
10216733872000107073000035110 00004012 109000040128 I06200513 00004012 000000000000000500010430783 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000479000000000000000000000000000 21051300000000000000000000000 B5000049
|
50
|
+
10216733872000107073000035110 00004019 109000040193 I06200513 00004019 000000000000000571510415552 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000550500000000000000000000000000 21051300000000000000000000000 B5000050
|
51
|
+
10216733872000107073000035110 00004026 109000040268 I06200513 00004026 000000000000000500039913003 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000479000000000000000000000000000 21051300000000000000000000000 B3000051
|
52
|
+
10216733872000107073000035110 27615123 157276151236 I06200513000000108927615123 100513000000000440034165466 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000428800000000000980000000000000 21051300000000000000000000000DIVA LOUZAMARA DO CASTO BLITTO CP000052
|
53
|
+
10216733872000107073000035110 27714592 157277145922 I09200513000000206827714592 100513000000000400034177099 000000000021000000000000000000000000000000000000000000000000000000000000000000000000000021000000000000000000000000000 00000000000000000000000MIRCALO TIADORO 000053
|
54
|
+
9201341 000000000000000000000000000000 000000000000000000000000000000 000000000000000000000000000000 0000003200000000148705 21/05S000250000005200000000268896 000054
|
@@ -1,196 +1,192 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
}
|
26
|
-
end
|
4
|
+
RSpec.describe Brcobranca::Boleto::Base do
|
5
|
+
before do
|
6
|
+
@valid_attributes = {
|
7
|
+
especie_documento: 'DM',
|
8
|
+
moeda: '9',
|
9
|
+
data_documento: Date.today,
|
10
|
+
dias_vencimento: 1,
|
11
|
+
aceite: 'S',
|
12
|
+
quantidade: 1,
|
13
|
+
valor: 0.0,
|
14
|
+
local_pagamento: 'QUALQUER BANCO ATÉ O VENCIMENTO',
|
15
|
+
cedente: 'Kivanio Barbosa',
|
16
|
+
documento_cedente: '12345678912',
|
17
|
+
sacado: 'Claudio Pozzebom',
|
18
|
+
sacado_documento: '12345678900',
|
19
|
+
agencia: '4042',
|
20
|
+
conta_corrente: '61900',
|
21
|
+
convenio: 12_387_989,
|
22
|
+
numero_documento: '777700168'
|
23
|
+
}
|
24
|
+
end
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
26
|
+
it 'Criar nova instancia com atributos padrões' do
|
27
|
+
boleto_novo = Brcobranca::Boleto::Base.new
|
28
|
+
expect(boleto_novo.especie_documento).to eql('DM')
|
29
|
+
expect(boleto_novo.especie).to eql('R$')
|
30
|
+
expect(boleto_novo.moeda).to eql('9')
|
31
|
+
expect(boleto_novo.data_documento).to eql(Date.today)
|
32
|
+
expect(boleto_novo.dias_vencimento).to eql(1)
|
33
|
+
expect(boleto_novo.data_vencimento).to eql(Date.today + 1)
|
34
|
+
expect(boleto_novo.aceite).to eql('S')
|
35
|
+
expect(boleto_novo.quantidade).to eql(1)
|
36
|
+
expect(boleto_novo.valor).to eql(0.0)
|
37
|
+
expect(boleto_novo.valor_documento).to eql(0.0)
|
38
|
+
expect(boleto_novo.local_pagamento).to eql('QUALQUER BANCO ATÉ O VENCIMENTO')
|
39
|
+
expect(boleto_novo.valid?).to be_falsey
|
40
|
+
end
|
43
41
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
42
|
+
it 'Criar nova instancia com atributos válidos' do
|
43
|
+
boleto_novo = Brcobranca::Boleto::Base.new(@valid_attributes)
|
44
|
+
expect(boleto_novo.especie_documento).to eql('DM')
|
45
|
+
expect(boleto_novo.especie).to eql('R$')
|
46
|
+
expect(boleto_novo.moeda).to eql('9')
|
47
|
+
expect(boleto_novo.data_documento).to eql(Date.today)
|
48
|
+
expect(boleto_novo.dias_vencimento).to eql(1)
|
49
|
+
expect(boleto_novo.data_vencimento).to eql(Date.today + 1)
|
50
|
+
expect(boleto_novo.aceite).to eql('S')
|
51
|
+
expect(boleto_novo.quantidade).to eql(1)
|
52
|
+
expect(boleto_novo.valor).to eql(0.0)
|
53
|
+
expect(boleto_novo.valor_documento).to eql(0.00)
|
54
|
+
expect(boleto_novo.local_pagamento).to eql('QUALQUER BANCO ATÉ O VENCIMENTO')
|
55
|
+
expect(boleto_novo.cedente).to eql('Kivanio Barbosa')
|
56
|
+
expect(boleto_novo.documento_cedente).to eql('12345678912')
|
57
|
+
expect(boleto_novo.sacado).to eql('Claudio Pozzebom')
|
58
|
+
expect(boleto_novo.sacado_documento).to eql('12345678900')
|
59
|
+
expect(boleto_novo.conta_corrente).to eql('0061900')
|
60
|
+
expect(boleto_novo.agencia).to eql('4042')
|
61
|
+
expect(boleto_novo.convenio).to eql(12_387_989)
|
62
|
+
expect(boleto_novo.numero_documento).to eql('777700168')
|
63
|
+
expect(boleto_novo.valid?).to be_truthy
|
64
|
+
end
|
67
65
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
66
|
+
it 'Calcula agencia_dv' do
|
67
|
+
boleto_novo = Brcobranca::Boleto::Base.new(@valid_attributes)
|
68
|
+
boleto_novo.agencia = '85068014982'
|
69
|
+
expect(boleto_novo.agencia_dv).to eql(9)
|
70
|
+
boleto_novo.agencia = '05009401448'
|
71
|
+
expect(boleto_novo.agencia_dv).to eql(1)
|
72
|
+
boleto_novo.agencia = '12387987777700168'
|
73
|
+
expect(boleto_novo.agencia_dv).to eql(2)
|
74
|
+
boleto_novo.agencia = '4042'
|
75
|
+
expect(boleto_novo.agencia_dv).to eql(8)
|
76
|
+
boleto_novo.agencia = '61900'
|
77
|
+
expect(boleto_novo.agencia_dv).to eql(0)
|
78
|
+
boleto_novo.agencia = '0719'
|
79
|
+
expect(boleto_novo.agencia_dv).to eql(6)
|
80
|
+
boleto_novo.agencia = 85_068_014_982
|
81
|
+
expect(boleto_novo.agencia_dv).to eql(9)
|
82
|
+
boleto_novo.agencia = 5_009_401_448
|
83
|
+
expect(boleto_novo.agencia_dv).to eql(1)
|
84
|
+
boleto_novo.agencia = 12_387_987_777_700_168
|
85
|
+
expect(boleto_novo.agencia_dv).to eql(2)
|
86
|
+
boleto_novo.agencia = 4042
|
87
|
+
expect(boleto_novo.agencia_dv).to eql(8)
|
88
|
+
boleto_novo.agencia = 61_900
|
89
|
+
expect(boleto_novo.agencia_dv).to eql(0)
|
90
|
+
boleto_novo.agencia = 719
|
91
|
+
expect(boleto_novo.agencia_dv).to eql(6)
|
92
|
+
end
|
95
93
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
94
|
+
it 'Calcula conta_corrente_dv' do
|
95
|
+
boleto_novo = Brcobranca::Boleto::Base.new(@valid_attributes)
|
96
|
+
boleto_novo.conta_corrente = '85068014982'
|
97
|
+
expect(boleto_novo.conta_corrente_dv).to eql(9)
|
98
|
+
boleto_novo.conta_corrente = '05009401448'
|
99
|
+
expect(boleto_novo.conta_corrente_dv).to eql(1)
|
100
|
+
boleto_novo.conta_corrente = '12387987777700168'
|
101
|
+
expect(boleto_novo.conta_corrente_dv).to eql(2)
|
102
|
+
boleto_novo.conta_corrente = '4042'
|
103
|
+
expect(boleto_novo.conta_corrente_dv).to eql(8)
|
104
|
+
boleto_novo.conta_corrente = '61900'
|
105
|
+
expect(boleto_novo.conta_corrente_dv).to eql(0)
|
106
|
+
boleto_novo.conta_corrente = '0719'
|
107
|
+
expect(boleto_novo.conta_corrente_dv).to eql(6)
|
108
|
+
boleto_novo.conta_corrente = 85_068_014_982
|
109
|
+
expect(boleto_novo.conta_corrente_dv).to eql(9)
|
110
|
+
boleto_novo.conta_corrente = 5_009_401_448
|
111
|
+
expect(boleto_novo.conta_corrente_dv).to eql(1)
|
112
|
+
boleto_novo.conta_corrente = 12_387_987_777_700_168
|
113
|
+
expect(boleto_novo.conta_corrente_dv).to eql(2)
|
114
|
+
boleto_novo.conta_corrente = 4042
|
115
|
+
expect(boleto_novo.conta_corrente_dv).to eql(8)
|
116
|
+
boleto_novo.conta_corrente = 61_900
|
117
|
+
expect(boleto_novo.conta_corrente_dv).to eql(0)
|
118
|
+
boleto_novo.conta_corrente = 719
|
119
|
+
expect(boleto_novo.conta_corrente_dv).to eql(6)
|
120
|
+
end
|
123
121
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
122
|
+
it 'Calcula o valor do documento' do
|
123
|
+
boleto_novo = Brcobranca::Boleto::Base.new(@valid_attributes)
|
124
|
+
boleto_novo.quantidade = 1
|
125
|
+
boleto_novo.valor = 1
|
126
|
+
expect(boleto_novo.valor_documento).to eql(1.0)
|
127
|
+
boleto_novo.quantidade = 1
|
128
|
+
boleto_novo.valor = 1.0
|
129
|
+
expect(boleto_novo.valor_documento).to eql(1.0)
|
130
|
+
boleto_novo.quantidade = 100
|
131
|
+
boleto_novo.valor = 1
|
132
|
+
expect(boleto_novo.valor_documento).to eql(100.0)
|
133
|
+
boleto_novo.quantidade = 1
|
134
|
+
boleto_novo.valor = 1.2
|
135
|
+
expect(boleto_novo.valor_documento).to eql(1.2)
|
136
|
+
boleto_novo.quantidade = 1
|
137
|
+
boleto_novo.valor = 135.43
|
138
|
+
expect(boleto_novo.valor_documento).to eql(135.43)
|
139
|
+
boleto_novo.quantidade = 'gh'
|
140
|
+
boleto_novo.valor = 135.43
|
141
|
+
expect(boleto_novo.valor_documento).to eql(0.0)
|
142
|
+
end
|
145
143
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
144
|
+
it 'Calcula data_vencimento' do
|
145
|
+
boleto_novo = Brcobranca::Boleto::Base.new(@valid_attributes)
|
146
|
+
boleto_novo.data_documento = Date.parse '2008-02-01'
|
147
|
+
boleto_novo.dias_vencimento = 1
|
148
|
+
expect(boleto_novo.data_vencimento.to_s).to eql('2008-02-02')
|
149
|
+
expect(boleto_novo.data_vencimento).to eql(Date.parse('2008-02-02'))
|
150
|
+
boleto_novo.data_documento = Date.parse '2008-02-02'
|
151
|
+
boleto_novo.dias_vencimento = 28
|
152
|
+
expect(boleto_novo.data_vencimento.to_s).to eql('2008-03-01')
|
153
|
+
expect(boleto_novo.data_vencimento).to eql(Date.parse('2008-03-01'))
|
154
|
+
boleto_novo.data_documento = Date.parse '2008-02-06'
|
155
|
+
boleto_novo.dias_vencimento = 100
|
156
|
+
expect(boleto_novo.data_vencimento.to_s).to eql('2008-05-16')
|
157
|
+
expect(boleto_novo.data_vencimento).to eql(Date.parse('2008-05-16'))
|
158
|
+
boleto_novo.data_documento = Date.parse '2008-02-06'
|
159
|
+
boleto_novo.dias_vencimento = 'df'
|
160
|
+
expect(boleto_novo.data_vencimento).to eql(boleto_novo.data_documento)
|
161
|
+
end
|
164
162
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
163
|
+
it 'Mostrar aviso sobre sobrecarga de métodos padrões' do
|
164
|
+
boleto_novo = Brcobranca::Boleto::Base.new(@valid_attributes)
|
165
|
+
expect { boleto_novo.codigo_barras_segunda_parte }.to raise_error(Brcobranca::NaoImplementado, 'Sobreescreva este método na classe referente ao banco que você esta criando')
|
166
|
+
expect { boleto_novo.nosso_numero_boleto }.to raise_error(Brcobranca::NaoImplementado, 'Sobreescreva este método na classe referente ao banco que você esta criando')
|
167
|
+
expect { boleto_novo.agencia_conta_boleto }.to raise_error(Brcobranca::NaoImplementado, 'Sobreescreva este método na classe referente ao banco que você esta criando')
|
168
|
+
end
|
171
169
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
170
|
+
it 'Incluir módulos de template na classe' do
|
171
|
+
expect(Brcobranca::Boleto::Base.respond_to?(:lote)).to be_truthy
|
172
|
+
expect(Brcobranca::Boleto::Base.respond_to?(:to)).to be_truthy
|
173
|
+
end
|
176
174
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
175
|
+
it 'Incluir módulos de template na instancia' do
|
176
|
+
boleto_novo = Brcobranca::Boleto::Base.new
|
177
|
+
expect(boleto_novo.respond_to?(:lote)).to be_truthy
|
178
|
+
expect(boleto_novo.respond_to?(:to)).to be_truthy
|
179
|
+
end
|
182
180
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
181
|
+
context 'Validações' do
|
182
|
+
it 'data_documento em branco' do
|
183
|
+
boleto_novo = Brcobranca::Boleto::Base.new(data_documento: '')
|
184
|
+
expect { boleto_novo.data_vencimento }.to raise_error(/Data Documento não pode estar em branco/)
|
185
|
+
end
|
188
186
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
end
|
193
|
-
end
|
187
|
+
it 'data_documento em string' do
|
188
|
+
boleto_novo = Brcobranca::Boleto::Base.new(data_documento: '2015-06-15')
|
189
|
+
expect(boleto_novo.data_vencimento).to eql(Date.parse('2015-06-16'))
|
194
190
|
end
|
195
191
|
end
|
196
192
|
end
|