@plasoft/boletos 1.0.56 → 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 +6 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +21 -9
- package/build/index.js.map +1 -1
- package/build/index.mjs +21 -9
- package/build/index.mjs.map +1 -1
- 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';
|
|
@@ -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';
|
|
@@ -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) {
|
|
@@ -1326,9 +1326,15 @@ function gerarPDF3(_0) {
|
|
|
1326
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");
|
|
@@ -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
|
}
|
|
@@ -1471,7 +1477,11 @@ function gerarRemessa3({ dados }) {
|
|
|
1471
1477
|
let tipoInscricao = pagador.pessoa === "F" ? "1" : "2";
|
|
1472
1478
|
let desconto = "0000000000000";
|
|
1473
1479
|
let dataDesconto = "000000";
|
|
1474
|
-
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) {
|
|
1475
1485
|
desconto = dadosBancario.descontoPagamento.toFixed(2).replace(".", "").padStart(13, "0");
|
|
1476
1486
|
dataDesconto = (0, import_date_fns4.format)(new Date(boleto.vencimento), "ddMMyy");
|
|
1477
1487
|
}
|
|
@@ -2317,7 +2327,7 @@ function gerarPDF5(_0) {
|
|
|
2317
2327
|
if (jurosDia > 0) {
|
|
2318
2328
|
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${jurosDia} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
2319
2329
|
}
|
|
2320
|
-
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;
|
|
2321
2331
|
if (descontoVencimento > 0) {
|
|
2322
2332
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
2323
2333
|
}
|
|
@@ -2479,6 +2489,8 @@ function gerarRemessa5({ dados }) {
|
|
|
2479
2489
|
const tipoInscricao = pagador.pessoa === "F" ? "1" : "2";
|
|
2480
2490
|
const vencimento = (0, import_date_fns6.format)(new Date(boleto.vencimento), "ddMMyyyy");
|
|
2481
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";
|
|
2482
2494
|
let protesto = "3";
|
|
2483
2495
|
let diasProtesto = "00";
|
|
2484
2496
|
let baixarDevolver = "1";
|
|
@@ -2536,9 +2548,9 @@ function gerarRemessa5({ dados }) {
|
|
|
2536
2548
|
arquivo.add("1");
|
|
2537
2549
|
arquivo.add("00000000");
|
|
2538
2550
|
arquivo.add(valorJurosDia.toFixed(2).replace(".", "").padStart(15, "0"));
|
|
2539
|
-
arquivo.add(
|
|
2540
|
-
arquivo.add(
|
|
2541
|
-
arquivo.add("
|
|
2551
|
+
arquivo.add(codigoDesconto);
|
|
2552
|
+
arquivo.add(vencimento);
|
|
2553
|
+
arquivo.add(desconto.replace(".", "").padStart(15, "0"));
|
|
2542
2554
|
arquivo.add("000000000000000");
|
|
2543
2555
|
arquivo.add("000000000000000");
|
|
2544
2556
|
arquivo.add(boleto.identificacaoTitulo.padEnd(25, " "));
|