@plasoft/boletos 1.0.55 → 1.0.57
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.
- package/build/index.d.mts +8 -2
- package/build/index.d.ts +8 -2
- package/build/index.js +24 -11
- package/build/index.js.map +1 -1
- package/build/index.mjs +24 -11
- package/build/index.mjs.map +1 -1
- package/build/sicredi-boleto.hbs +2 -3
- package/package.json +1 -1
package/build/index.d.mts
CHANGED
|
@@ -94,6 +94,7 @@ interface IDadosPDF$5 {
|
|
|
94
94
|
instrucao4?: string;
|
|
95
95
|
observacoes?: string[];
|
|
96
96
|
nfs: string;
|
|
97
|
+
desconto: number;
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
interface IGerarRemessaAilos {
|
|
@@ -137,6 +138,7 @@ interface IDadosRemessa$4 {
|
|
|
137
138
|
numeroDocumento: string;
|
|
138
139
|
parcela: number | string;
|
|
139
140
|
aceite: string;
|
|
141
|
+
desconto: number;
|
|
140
142
|
pagador: {
|
|
141
143
|
nome: string;
|
|
142
144
|
pessoa: 'F' | 'J';
|
|
@@ -350,8 +352,8 @@ interface IGerarPDFSicredi {
|
|
|
350
352
|
interface IDadosPDF$3 {
|
|
351
353
|
pagador: {
|
|
352
354
|
nome: string;
|
|
353
|
-
|
|
354
|
-
|
|
355
|
+
cpfcnpj: string;
|
|
356
|
+
isCnpj?: boolean;
|
|
355
357
|
endereco: {
|
|
356
358
|
logradouro: string;
|
|
357
359
|
numero: string;
|
|
@@ -412,6 +414,7 @@ interface IDadosPDF$3 {
|
|
|
412
414
|
instrucao4?: string;
|
|
413
415
|
observacoes?: string[];
|
|
414
416
|
nfs: string;
|
|
417
|
+
desconto: number;
|
|
415
418
|
};
|
|
416
419
|
}
|
|
417
420
|
interface IGerarRemessaSicredi {
|
|
@@ -454,6 +457,7 @@ interface IDadosRemessa$2 {
|
|
|
454
457
|
numeroDocumento: string;
|
|
455
458
|
parcela: number | string;
|
|
456
459
|
aceite: string;
|
|
460
|
+
desconto: number;
|
|
457
461
|
pagador: {
|
|
458
462
|
nome: string;
|
|
459
463
|
pessoa: 'F' | 'J';
|
|
@@ -706,6 +710,7 @@ interface IDadosPDF$1 {
|
|
|
706
710
|
instrucao4?: string;
|
|
707
711
|
observacoes?: string[];
|
|
708
712
|
nfs: string;
|
|
713
|
+
desconto: number;
|
|
709
714
|
};
|
|
710
715
|
}
|
|
711
716
|
interface IGerarRemessaBancoBrasil {
|
|
@@ -752,6 +757,7 @@ interface IDadosRemessa {
|
|
|
752
757
|
numeroDocumento: string;
|
|
753
758
|
parcela: number | string;
|
|
754
759
|
aceite: string;
|
|
760
|
+
desconto: number;
|
|
755
761
|
pagador: {
|
|
756
762
|
nome: string;
|
|
757
763
|
pessoa: 'F' | 'J';
|
package/build/index.d.ts
CHANGED
|
@@ -94,6 +94,7 @@ interface IDadosPDF$5 {
|
|
|
94
94
|
instrucao4?: string;
|
|
95
95
|
observacoes?: string[];
|
|
96
96
|
nfs: string;
|
|
97
|
+
desconto: number;
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
interface IGerarRemessaAilos {
|
|
@@ -137,6 +138,7 @@ interface IDadosRemessa$4 {
|
|
|
137
138
|
numeroDocumento: string;
|
|
138
139
|
parcela: number | string;
|
|
139
140
|
aceite: string;
|
|
141
|
+
desconto: number;
|
|
140
142
|
pagador: {
|
|
141
143
|
nome: string;
|
|
142
144
|
pessoa: 'F' | 'J';
|
|
@@ -350,8 +352,8 @@ interface IGerarPDFSicredi {
|
|
|
350
352
|
interface IDadosPDF$3 {
|
|
351
353
|
pagador: {
|
|
352
354
|
nome: string;
|
|
353
|
-
|
|
354
|
-
|
|
355
|
+
cpfcnpj: string;
|
|
356
|
+
isCnpj?: boolean;
|
|
355
357
|
endereco: {
|
|
356
358
|
logradouro: string;
|
|
357
359
|
numero: string;
|
|
@@ -412,6 +414,7 @@ interface IDadosPDF$3 {
|
|
|
412
414
|
instrucao4?: string;
|
|
413
415
|
observacoes?: string[];
|
|
414
416
|
nfs: string;
|
|
417
|
+
desconto: number;
|
|
415
418
|
};
|
|
416
419
|
}
|
|
417
420
|
interface IGerarRemessaSicredi {
|
|
@@ -454,6 +457,7 @@ interface IDadosRemessa$2 {
|
|
|
454
457
|
numeroDocumento: string;
|
|
455
458
|
parcela: number | string;
|
|
456
459
|
aceite: string;
|
|
460
|
+
desconto: number;
|
|
457
461
|
pagador: {
|
|
458
462
|
nome: string;
|
|
459
463
|
pessoa: 'F' | 'J';
|
|
@@ -706,6 +710,7 @@ interface IDadosPDF$1 {
|
|
|
706
710
|
instrucao4?: string;
|
|
707
711
|
observacoes?: string[];
|
|
708
712
|
nfs: string;
|
|
713
|
+
desconto: number;
|
|
709
714
|
};
|
|
710
715
|
}
|
|
711
716
|
interface IGerarRemessaBancoBrasil {
|
|
@@ -752,6 +757,7 @@ interface IDadosRemessa {
|
|
|
752
757
|
numeroDocumento: string;
|
|
753
758
|
parcela: number | string;
|
|
754
759
|
aceite: string;
|
|
760
|
+
desconto: number;
|
|
755
761
|
pagador: {
|
|
756
762
|
nome: string;
|
|
757
763
|
pessoa: 'F' | 'J';
|
package/build/index.js
CHANGED
|
@@ -322,7 +322,7 @@ function gerarPDF(_0) {
|
|
|
322
322
|
if (jurosDia > 0) {
|
|
323
323
|
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${maskFormat_default.numberToReal(jurosDia)} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
324
324
|
}
|
|
325
|
-
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto
|
|
325
|
+
const descontoVencimento = dadosPDF.boleto.desconto > 0 ? dadosPDF.boleto.desconto : dadosPDF.beneficiario.dadosBancario.desconto > 0 ? dadosPDF.beneficiario.dadosBancario.desconto : 0;
|
|
326
326
|
if (descontoVencimento > 0) {
|
|
327
327
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
328
328
|
}
|
|
@@ -489,7 +489,7 @@ function gerarRemessa({ dados }) {
|
|
|
489
489
|
"ddMMyyyy"
|
|
490
490
|
);
|
|
491
491
|
const codigoDesconto = dadosBancario.descontoPagamento > 0 ? "2" : "0";
|
|
492
|
-
const desconto = dadosBancario.descontoPagamento > 0 ? dadosBancario.descontoPagamento.toFixed(2) : "000000000000000";
|
|
492
|
+
const desconto = boleto.desconto > 0 ? boleto.desconto.toFixed(2) : dadosBancario.descontoPagamento > 0 ? dadosBancario.descontoPagamento.toFixed(2) : "000000000000000";
|
|
493
493
|
let diasProtesto = "00";
|
|
494
494
|
let protesto = "3";
|
|
495
495
|
switch (dadosBancario.tipo_protesto) {
|
|
@@ -1323,12 +1323,18 @@ function gerarPDF3(_0) {
|
|
|
1323
1323
|
return __async(this, arguments, function* ({ dados }) {
|
|
1324
1324
|
try {
|
|
1325
1325
|
const { generatePDF, dadosPDF } = dados;
|
|
1326
|
-
if (!dadosPDF.pagador.
|
|
1326
|
+
if (!dadosPDF.pagador.cpfcnpj) {
|
|
1327
1327
|
throw new Error("CPF/CNPJ do pagador na\u0303o informado!");
|
|
1328
1328
|
}
|
|
1329
|
+
const codigoBarraText = dadosPDF.boleto.codigoBarra.replace(/\D/g, "");
|
|
1330
|
+
if (!/^\d+$/.test(codigoBarraText)) {
|
|
1331
|
+
throw new Error("C\xF3digo de barras cont\xE9m caracteres inv\xE1lidos. Apenas d\xEDgitos s\xE3o permitidos.");
|
|
1332
|
+
}
|
|
1333
|
+
console.log(dadosPDF.boleto.codigoBarra);
|
|
1334
|
+
console.log(codigoBarraText);
|
|
1329
1335
|
const codigoBarra2 = yield import_bwip_js3.default.toBuffer({
|
|
1330
1336
|
bcid: "interleaved2of5",
|
|
1331
|
-
text:
|
|
1337
|
+
text: codigoBarraText,
|
|
1332
1338
|
height: 20
|
|
1333
1339
|
});
|
|
1334
1340
|
dadosPDF.beneficiario.dadosBancario.agencia = dadosPDF.beneficiario.dadosBancario.agencia.padStart(4, "0");
|
|
@@ -1343,7 +1349,7 @@ function gerarPDF3(_0) {
|
|
|
1343
1349
|
dadosPDF.pagador.endereco.cep = maskFormat_default.retornaCEPFormatado(
|
|
1344
1350
|
dadosPDF.pagador.endereco.cep
|
|
1345
1351
|
);
|
|
1346
|
-
dadosPDF.pagador.
|
|
1352
|
+
dadosPDF.pagador.cpfcnpj = maskFormat_default.retornaCpfCnpjFormatado(dadosPDF.pagador.cpfcnpj);
|
|
1347
1353
|
dadosPDF.boleto.valorAcrescimo = maskFormat_default.numberToReal(
|
|
1348
1354
|
dadosPDF.boleto.valorAcrescimo
|
|
1349
1355
|
);
|
|
@@ -1369,7 +1375,7 @@ function gerarPDF3(_0) {
|
|
|
1369
1375
|
if (jurosDia > 0) {
|
|
1370
1376
|
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${maskFormat_default.numberToReal(jurosDia)} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
1371
1377
|
}
|
|
1372
|
-
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto
|
|
1378
|
+
const descontoVencimento = dadosPDF.boleto.desconto > 0 ? dadosPDF.boleto.desconto : dadosPDF.beneficiario.dadosBancario.desconto > 0 ? dadosPDF.beneficiario.dadosBancario.desconto : 0;
|
|
1373
1379
|
if (descontoVencimento > 0) {
|
|
1374
1380
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
1375
1381
|
}
|
|
@@ -1382,6 +1388,7 @@ function gerarPDF3(_0) {
|
|
|
1382
1388
|
dadosPDF.boleto.instrucao4 = `PROTESTAR AP\xD3S ${protestoDias} DIAS CORRIDOS DO VENCIMENTO`;
|
|
1383
1389
|
}
|
|
1384
1390
|
dadosPDF.boleto.valor = maskFormat_default.numberToReal(dadosPDF.boleto.valor);
|
|
1391
|
+
dadosPDF.pagador.isCnpj = dadosPDF.pagador.cpfcnpj.length > 14;
|
|
1385
1392
|
const content = compileHbs(getPathTemplates("sicredi-boleto.hbs"), dadosPDF);
|
|
1386
1393
|
const config = {
|
|
1387
1394
|
displayHeaderFooter: false,
|
|
@@ -1470,7 +1477,11 @@ function gerarRemessa3({ dados }) {
|
|
|
1470
1477
|
let tipoInscricao = pagador.pessoa === "F" ? "1" : "2";
|
|
1471
1478
|
let desconto = "0000000000000";
|
|
1472
1479
|
let dataDesconto = "000000";
|
|
1473
|
-
if (
|
|
1480
|
+
if (boleto.desconto) {
|
|
1481
|
+
desconto = boleto.desconto.toFixed(2).replace(".", "").padStart(13, "0");
|
|
1482
|
+
dataDesconto = (0, import_date_fns4.format)(new Date(boleto.vencimento), "ddMMyy");
|
|
1483
|
+
}
|
|
1484
|
+
if (!boleto.desconto && dadosBancario.descontoPagamento) {
|
|
1474
1485
|
desconto = dadosBancario.descontoPagamento.toFixed(2).replace(".", "").padStart(13, "0");
|
|
1475
1486
|
dataDesconto = (0, import_date_fns4.format)(new Date(boleto.vencimento), "ddMMyy");
|
|
1476
1487
|
}
|
|
@@ -2316,7 +2327,7 @@ function gerarPDF5(_0) {
|
|
|
2316
2327
|
if (jurosDia > 0) {
|
|
2317
2328
|
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${jurosDia} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
2318
2329
|
}
|
|
2319
|
-
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto
|
|
2330
|
+
const descontoVencimento = dadosPDF.boleto.desconto > 0 ? dadosPDF.boleto.desconto : dadosPDF.beneficiario.dadosBancario.desconto > 0 ? dadosPDF.beneficiario.dadosBancario.desconto : 0;
|
|
2320
2331
|
if (descontoVencimento > 0) {
|
|
2321
2332
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
2322
2333
|
}
|
|
@@ -2478,6 +2489,8 @@ function gerarRemessa5({ dados }) {
|
|
|
2478
2489
|
const tipoInscricao = pagador.pessoa === "F" ? "1" : "2";
|
|
2479
2490
|
const vencimento = (0, import_date_fns6.format)(new Date(boleto.vencimento), "ddMMyyyy");
|
|
2480
2491
|
total += Number(boleto.valor);
|
|
2492
|
+
const codigoDesconto = dadosBancario.descontoPagamento > 0 ? "2" : "0";
|
|
2493
|
+
const desconto = boleto.desconto > 0 ? boleto.desconto.toFixed(2) : dadosBancario.descontoPagamento > 0 ? dadosBancario.descontoPagamento.toFixed(2) : "000000000000000";
|
|
2481
2494
|
let protesto = "3";
|
|
2482
2495
|
let diasProtesto = "00";
|
|
2483
2496
|
let baixarDevolver = "1";
|
|
@@ -2535,9 +2548,9 @@ function gerarRemessa5({ dados }) {
|
|
|
2535
2548
|
arquivo.add("1");
|
|
2536
2549
|
arquivo.add("00000000");
|
|
2537
2550
|
arquivo.add(valorJurosDia.toFixed(2).replace(".", "").padStart(15, "0"));
|
|
2538
|
-
arquivo.add(
|
|
2539
|
-
arquivo.add(
|
|
2540
|
-
arquivo.add("
|
|
2551
|
+
arquivo.add(codigoDesconto);
|
|
2552
|
+
arquivo.add(vencimento);
|
|
2553
|
+
arquivo.add(desconto.replace(".", "").padStart(15, "0"));
|
|
2541
2554
|
arquivo.add("000000000000000");
|
|
2542
2555
|
arquivo.add("000000000000000");
|
|
2543
2556
|
arquivo.add(boleto.identificacaoTitulo.padEnd(25, " "));
|