@@ -7,20 +7,23 @@ const ediParser = require('../../../index').EdiParser
77
88const ediFileContent = `
9902RETORNO01COBRANCA 00000000000004628596PAGAR.ME PAGAMENTOS S.A. 237BRADESCO 2005160160000000001 220514 000001
10- 1021872705300017400000250122900004693 000000000000000000600000000000000000000000000506200516 00000000000000000000000000000000000150034103830 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000 210516 00000000000000 000002
10+ 1021872705300017400000250122900004693 000000000000000000600000000000000000000000000506200516 00000000000000000000000000000000000150034103830 000000000000000000000000000000000000100000000000020000000000003000000000000400000000000010000000000005000000000000600 210516 00000000000000 000002
11+ 1021872705300017400000260122900004693 00000000000278613362000000000000000000000000060610041927861336 00000000000278613362090419000000000060934100262 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000071400000000001050000000000000 110419 00000000000000 152328
11129201237 000000010000000000150000000001 00000000000000000000000000500000010000000005000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000 000003`
1213
1314describe ( 'Bradesco EDI Parser' , ( ) => {
1415 describe ( 'when parsing a valid EDI file' , ( ) => {
1516 let result
1617 let boleto
18+ let boleto2
1719 before ( ( ) => {
1820 result = ediParser . parse ( 'bradesco' , ediFileContent )
1921 boleto = result . boletos [ 0 ]
22+ boleto2 = result . boletos [ 1 ]
2023 } )
2124
22- it ( 'should have found 1 boleto ' , ( ) => {
23- expect ( result . boletos ) . to . have . lengthOf ( 1 )
25+ it ( 'should have found 2 boletos ' , ( ) => {
26+ expect ( result . boletos ) . to . have . lengthOf ( 2 )
2427 } )
2528
2629 it ( 'should parse boleto correctly' , ( ) => {
@@ -35,16 +38,50 @@ describe('Bradesco EDI Parser', () => {
3538 ] ,
3639 valor_pago : '100' ,
3740 valor : '1500' ,
41+ juros_operacao_em_atraso : '100' ,
42+ iof_devido : '200' ,
43+ abatimento_concedido : '300' ,
44+ desconto_concedido : '400' ,
45+ juros_mora : '500' ,
46+ outros_creditos : '600' ,
3847 banco_recebedor : '341' ,
3948 agencia_recebedora : '3830' ,
4049 paid : true ,
4150 edi_line_number : 2 ,
42- edi_line_checksum : '3bc78a0fa0897ab07f14f17a6b723f1ca6140f93 ' ,
43- edi_line_fingerprint : '2:3bc78a0fa0897ab07f14f17a6b723f1ca6140f93 ' ,
51+ edi_line_checksum : '20c5b6ebeb167ffb24ebe64316a3433a193de0bf ' ,
52+ edi_line_fingerprint : '2:20c5b6ebeb167ffb24ebe64316a3433a193de0bf ' ,
4453 nosso_numero : '6'
4554 } )
4655 } )
4756
57+ it ( 'should parse boleto2 correctly' , ( ) => {
58+ expect ( boleto2 ) . to . containSubset ( {
59+ codigo_ocorrencia : '06' ,
60+ motivos_ocorrencia : [
61+ '00' ,
62+ '00' ,
63+ '00' ,
64+ '00' ,
65+ '00'
66+ ] ,
67+ valor_pago : '714' ,
68+ valor : '609' ,
69+ juros_operacao_em_atraso : '' ,
70+ iof_devido : '' ,
71+ abatimento_concedido : '' ,
72+ desconto_concedido : '' ,
73+ juros_mora : '105' ,
74+ outros_creditos : '' ,
75+ banco_recebedor : '341' ,
76+ agencia_recebedora : '262' ,
77+ paid : true ,
78+ edi_line_number : 3 ,
79+ edi_line_checksum : '686bf39b5d6533b49466e78391d1eeb593cb0db4' ,
80+ edi_line_fingerprint : '3:686bf39b5d6533b49466e78391d1eeb593cb0db4' ,
81+ nosso_numero : '27861336'
82+ } )
83+ } )
84+
4885 it ( 'should parse boleto data_ocorrencia correctly' , ( ) => {
4986 expect ( boleto . data_ocorrencia ) . to . equalDate ( new Date ( 2016 , 4 , 20 ) )
5087 } )
@@ -61,7 +98,7 @@ describe('Bradesco EDI Parser', () => {
6198 expect ( result ) . to . containSubset ( {
6299 razao_social : 'PAGAR.ME PAGAMENTOS S.A. ' ,
63100 cnpj : '18727053000174' ,
64- carteira : '25 ' ,
101+ carteira : '26 ' ,
65102 agencia_cedente : '1229' ,
66103 conta_cedente : '4693'
67104 } )
0 commit comments