-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Romulosanttos/develop
FIX #3 Melhorias gerais e criando classe para Geração de boletos
- Loading branch information
Showing
26 changed files
with
312 additions
and
204 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,58 @@ | ||
const Gerador = require('../index'); | ||
const { gerarPdf, gerarBoleto} = require('./index'); | ||
const streamToPromise = require('../lib/utils/util'); | ||
const { Bancos, Boletos, streamToPromise } = require('../lib/index'); | ||
|
||
const boleto = { | ||
banco: new Gerador.boleto.bancos.Bradesco(), | ||
pagador: { RegistroNacional: '12345678' }, | ||
beneficiario: { | ||
dadosBancarios:{ | ||
carteira: '09', | ||
agencia: '0101', | ||
agenciaDigito: '5', | ||
conta: '0326446', | ||
contaDigito: '0' , | ||
nossoNumero: '00000000061', | ||
nossoNumeroDigito: '8' | ||
} | ||
}, | ||
boleto: { | ||
numeroDocumento: '1001', | ||
especieDocumento: 'DM', | ||
valor: 110.00, | ||
datas: { | ||
vencimento: '02-04-2020', | ||
processamento: '02-04-2019', | ||
documentos: '02-04-2019' | ||
} | ||
} | ||
banco: new Bancos.Bradesco(), | ||
pagador: { | ||
nome: 'José Bonifácio de Andrada', | ||
RegistroNacional: '12345678', | ||
endereco: { | ||
logradouro: 'Rua Pedro Lessa, 15', | ||
bairro: 'Centro', | ||
cidade: 'Rio de Janeiro', | ||
estadoUF: 'RJ', | ||
cep: '20030-030' | ||
} | ||
}, | ||
instrucoes: ['Após o vencimento Mora dia R$ 1,59', 'Após o vencimento, multa de 2%'], | ||
beneficiario: { | ||
nome: 'Empresa Fictícia LTDA', | ||
cnpj: '43576788000191', | ||
dadosBancarios: { | ||
carteira: '09', | ||
agencia: '0101', | ||
agenciaDigito: '5', | ||
conta: '0326446', | ||
contaDigito: '0', | ||
nossoNumero: '00000000061', | ||
nossoNumeroDigito: '8' | ||
}, | ||
endereco: { | ||
logradouro: 'Rua Pedro Lessa, 15', | ||
bairro: 'Centro', | ||
cidade: 'Rio de Janeiro', | ||
estadoUF: 'RJ', | ||
cep: '20030-030' | ||
} | ||
}, | ||
boleto: { | ||
numeroDocumento: '1001', | ||
especieDocumento: 'DM', | ||
valor: 110.00, | ||
datas: { | ||
vencimento: '02-04-2020', | ||
processamento: '02-04-2019', | ||
documentos: '02-04-2019' | ||
} | ||
} | ||
}; | ||
|
||
const novoBoleto = gerarBoleto(boleto); | ||
gerarPdf(novoBoleto).then(async({stream})=>{ | ||
// ctx.res.set('Content-type', 'application/pdf'); | ||
await streamToPromise(stream); | ||
}).catch((error)=>{ | ||
return error; | ||
|
||
const novoBoleto = new Boletos(boleto); | ||
novoBoleto.gerarBoleto(); | ||
|
||
novoBoleto.pdfFile().then(async ({ stream }) => { | ||
// ctx.res.set('Content-type', 'application/pdf'); | ||
await streamToPromise(stream); | ||
}).catch((error) => { | ||
return error; | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,59 @@ | ||
const Gerador = require('../index'); | ||
const { gerarPdf, gerarBoleto} = require('./index'); | ||
const streamToPromise = require('../lib/utils/util'); | ||
const { Bancos, Boletos, streamToPromise } = require('../lib/index'); | ||
|
||
const boleto = { | ||
banco: new Gerador.boleto.bancos.Cecred(), | ||
pagador: { RegistroNacional: '12345678' }, | ||
beneficiario: { | ||
dadosBancarios:{ | ||
carteira: '09', | ||
convenio: '123456', | ||
agencia: '0101', | ||
agenciaDigito: '5', | ||
conta: '03264467', | ||
contaDigito: '0' , | ||
nossoNumero: '00115290000000004', | ||
nossoNumeroDigito: '8' | ||
} | ||
}, | ||
boleto: { | ||
numeroDocumento: '1001', | ||
especieDocumento: 'DM', | ||
valor: 110.00, | ||
datas: { | ||
vencimento: '02-04-2020', | ||
processamento: '02-04-2019', | ||
documentos: '02-04-2019' | ||
} | ||
} | ||
banco: new Bancos.Cecred(), | ||
pagador: { | ||
nome: 'José Bonifácio de Andrada', | ||
RegistroNacional: '12345678', | ||
endereco: { | ||
logradouro: 'Rua Pedro Lessa, 15', | ||
bairro: 'Centro', | ||
cidade: 'Rio de Janeiro', | ||
estadoUF: 'RJ', | ||
cep: '20030-030' | ||
} | ||
}, | ||
instrucoes: ['Após o vencimento Mora dia R$ 1,59', 'Após o vencimento, multa de 2%'], | ||
beneficiario: { | ||
nome: 'Empresa Fictícia LTDA', | ||
cnpj: '43576788000191', | ||
dadosBancarios: { | ||
carteira: '09', | ||
convenio: '123456', | ||
agencia: '0101', | ||
agenciaDigito: '5', | ||
conta: '03264467', | ||
contaDigito: '0', | ||
nossoNumero: '00115290000000004', | ||
nossoNumeroDigito: '8' | ||
}, | ||
endereco: { | ||
logradouro: 'Rua Pedro Lessa, 15', | ||
bairro: 'Centro', | ||
cidade: 'Rio de Janeiro', | ||
estadoUF: 'RJ', | ||
cep: '20030-030' | ||
} | ||
}, | ||
boleto: { | ||
numeroDocumento: '1001', | ||
especieDocumento: 'DM', | ||
valor: 110.00, | ||
datas: { | ||
vencimento: '02-04-2020', | ||
processamento: '02-04-2019', | ||
documentos: '02-04-2019' | ||
} | ||
} | ||
}; | ||
|
||
const novoBoleto = gerarBoleto(boleto); | ||
gerarPdf(novoBoleto).then(async({stream})=>{ | ||
// ctx.res.set('Content-type', 'application/pdf'); | ||
await streamToPromise(stream); | ||
}).catch((error)=>{ | ||
return error; | ||
|
||
const novoBoleto = new Boletos(boleto); | ||
novoBoleto.gerarBoleto(); | ||
|
||
novoBoleto.pdfFile().then(async ({ stream }) => { | ||
// ctx.res.set('Content-type', 'application/pdf'); | ||
await streamToPromise(stream); | ||
}).catch((error) => { | ||
return error; | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.