@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.mjs
CHANGED
|
@@ -287,7 +287,7 @@ function gerarPDF(_0) {
|
|
|
287
287
|
if (jurosDia > 0) {
|
|
288
288
|
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${maskFormat_default.numberToReal(jurosDia)} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
289
289
|
}
|
|
290
|
-
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto
|
|
290
|
+
const descontoVencimento = dadosPDF.boleto.desconto > 0 ? dadosPDF.boleto.desconto : dadosPDF.beneficiario.dadosBancario.desconto > 0 ? dadosPDF.beneficiario.dadosBancario.desconto : 0;
|
|
291
291
|
if (descontoVencimento > 0) {
|
|
292
292
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
293
293
|
}
|
|
@@ -454,7 +454,7 @@ function gerarRemessa({ dados }) {
|
|
|
454
454
|
"ddMMyyyy"
|
|
455
455
|
);
|
|
456
456
|
const codigoDesconto = dadosBancario.descontoPagamento > 0 ? "2" : "0";
|
|
457
|
-
const desconto = dadosBancario.descontoPagamento > 0 ? dadosBancario.descontoPagamento.toFixed(2) : "000000000000000";
|
|
457
|
+
const desconto = boleto.desconto > 0 ? boleto.desconto.toFixed(2) : dadosBancario.descontoPagamento > 0 ? dadosBancario.descontoPagamento.toFixed(2) : "000000000000000";
|
|
458
458
|
let diasProtesto = "00";
|
|
459
459
|
let protesto = "3";
|
|
460
460
|
switch (dadosBancario.tipo_protesto) {
|
|
@@ -1288,12 +1288,18 @@ function gerarPDF3(_0) {
|
|
|
1288
1288
|
return __async(this, arguments, function* ({ dados }) {
|
|
1289
1289
|
try {
|
|
1290
1290
|
const { generatePDF, dadosPDF } = dados;
|
|
1291
|
-
if (!dadosPDF.pagador.
|
|
1291
|
+
if (!dadosPDF.pagador.cpfcnpj) {
|
|
1292
1292
|
throw new Error("CPF/CNPJ do pagador na\u0303o informado!");
|
|
1293
1293
|
}
|
|
1294
|
+
const codigoBarraText = dadosPDF.boleto.codigoBarra.replace(/\D/g, "");
|
|
1295
|
+
if (!/^\d+$/.test(codigoBarraText)) {
|
|
1296
|
+
throw new Error("C\xF3digo de barras cont\xE9m caracteres inv\xE1lidos. Apenas d\xEDgitos s\xE3o permitidos.");
|
|
1297
|
+
}
|
|
1298
|
+
console.log(dadosPDF.boleto.codigoBarra);
|
|
1299
|
+
console.log(codigoBarraText);
|
|
1294
1300
|
const codigoBarra2 = yield BwipJs3.toBuffer({
|
|
1295
1301
|
bcid: "interleaved2of5",
|
|
1296
|
-
text:
|
|
1302
|
+
text: codigoBarraText,
|
|
1297
1303
|
height: 20
|
|
1298
1304
|
});
|
|
1299
1305
|
dadosPDF.beneficiario.dadosBancario.agencia = dadosPDF.beneficiario.dadosBancario.agencia.padStart(4, "0");
|
|
@@ -1308,7 +1314,7 @@ function gerarPDF3(_0) {
|
|
|
1308
1314
|
dadosPDF.pagador.endereco.cep = maskFormat_default.retornaCEPFormatado(
|
|
1309
1315
|
dadosPDF.pagador.endereco.cep
|
|
1310
1316
|
);
|
|
1311
|
-
dadosPDF.pagador.
|
|
1317
|
+
dadosPDF.pagador.cpfcnpj = maskFormat_default.retornaCpfCnpjFormatado(dadosPDF.pagador.cpfcnpj);
|
|
1312
1318
|
dadosPDF.boleto.valorAcrescimo = maskFormat_default.numberToReal(
|
|
1313
1319
|
dadosPDF.boleto.valorAcrescimo
|
|
1314
1320
|
);
|
|
@@ -1334,7 +1340,7 @@ function gerarPDF3(_0) {
|
|
|
1334
1340
|
if (jurosDia > 0) {
|
|
1335
1341
|
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${maskFormat_default.numberToReal(jurosDia)} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
1336
1342
|
}
|
|
1337
|
-
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto
|
|
1343
|
+
const descontoVencimento = dadosPDF.boleto.desconto > 0 ? dadosPDF.boleto.desconto : dadosPDF.beneficiario.dadosBancario.desconto > 0 ? dadosPDF.beneficiario.dadosBancario.desconto : 0;
|
|
1338
1344
|
if (descontoVencimento > 0) {
|
|
1339
1345
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
1340
1346
|
}
|
|
@@ -1347,6 +1353,7 @@ function gerarPDF3(_0) {
|
|
|
1347
1353
|
dadosPDF.boleto.instrucao4 = `PROTESTAR AP\xD3S ${protestoDias} DIAS CORRIDOS DO VENCIMENTO`;
|
|
1348
1354
|
}
|
|
1349
1355
|
dadosPDF.boleto.valor = maskFormat_default.numberToReal(dadosPDF.boleto.valor);
|
|
1356
|
+
dadosPDF.pagador.isCnpj = dadosPDF.pagador.cpfcnpj.length > 14;
|
|
1350
1357
|
const content = compileHbs(getPathTemplates("sicredi-boleto.hbs"), dadosPDF);
|
|
1351
1358
|
const config = {
|
|
1352
1359
|
displayHeaderFooter: false,
|
|
@@ -1435,7 +1442,11 @@ function gerarRemessa3({ dados }) {
|
|
|
1435
1442
|
let tipoInscricao = pagador.pessoa === "F" ? "1" : "2";
|
|
1436
1443
|
let desconto = "0000000000000";
|
|
1437
1444
|
let dataDesconto = "000000";
|
|
1438
|
-
if (
|
|
1445
|
+
if (boleto.desconto) {
|
|
1446
|
+
desconto = boleto.desconto.toFixed(2).replace(".", "").padStart(13, "0");
|
|
1447
|
+
dataDesconto = format3(new Date(boleto.vencimento), "ddMMyy");
|
|
1448
|
+
}
|
|
1449
|
+
if (!boleto.desconto && dadosBancario.descontoPagamento) {
|
|
1439
1450
|
desconto = dadosBancario.descontoPagamento.toFixed(2).replace(".", "").padStart(13, "0");
|
|
1440
1451
|
dataDesconto = format3(new Date(boleto.vencimento), "ddMMyy");
|
|
1441
1452
|
}
|
|
@@ -2281,7 +2292,7 @@ function gerarPDF5(_0) {
|
|
|
2281
2292
|
if (jurosDia > 0) {
|
|
2282
2293
|
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${jurosDia} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
2283
2294
|
}
|
|
2284
|
-
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto
|
|
2295
|
+
const descontoVencimento = dadosPDF.boleto.desconto > 0 ? dadosPDF.boleto.desconto : dadosPDF.beneficiario.dadosBancario.desconto > 0 ? dadosPDF.beneficiario.dadosBancario.desconto : 0;
|
|
2285
2296
|
if (descontoVencimento > 0) {
|
|
2286
2297
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
2287
2298
|
}
|
|
@@ -2443,6 +2454,8 @@ function gerarRemessa5({ dados }) {
|
|
|
2443
2454
|
const tipoInscricao = pagador.pessoa === "F" ? "1" : "2";
|
|
2444
2455
|
const vencimento = format5(new Date(boleto.vencimento), "ddMMyyyy");
|
|
2445
2456
|
total += Number(boleto.valor);
|
|
2457
|
+
const codigoDesconto = dadosBancario.descontoPagamento > 0 ? "2" : "0";
|
|
2458
|
+
const desconto = boleto.desconto > 0 ? boleto.desconto.toFixed(2) : dadosBancario.descontoPagamento > 0 ? dadosBancario.descontoPagamento.toFixed(2) : "000000000000000";
|
|
2446
2459
|
let protesto = "3";
|
|
2447
2460
|
let diasProtesto = "00";
|
|
2448
2461
|
let baixarDevolver = "1";
|
|
@@ -2500,9 +2513,9 @@ function gerarRemessa5({ dados }) {
|
|
|
2500
2513
|
arquivo.add("1");
|
|
2501
2514
|
arquivo.add("00000000");
|
|
2502
2515
|
arquivo.add(valorJurosDia.toFixed(2).replace(".", "").padStart(15, "0"));
|
|
2503
|
-
arquivo.add(
|
|
2504
|
-
arquivo.add(
|
|
2505
|
-
arquivo.add("
|
|
2516
|
+
arquivo.add(codigoDesconto);
|
|
2517
|
+
arquivo.add(vencimento);
|
|
2518
|
+
arquivo.add(desconto.replace(".", "").padStart(15, "0"));
|
|
2506
2519
|
arquivo.add("000000000000000");
|
|
2507
2520
|
arquivo.add("000000000000000");
|
|
2508
2521
|
arquivo.add(boleto.identificacaoTitulo.padEnd(25, " "));
|