@plasoft/boletos 1.0.20 → 1.0.22
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 +2 -2
- package/build/index.d.ts +2 -2
- package/build/index.js +80 -61
- package/build/index.mjs +64 -45
- package/build/sicoob-boleto.hbs +842 -842
- package/build/sicredi-boleto.hbs +7 -7
- package/build/teste.html +842 -842
- package/package.json +55 -55
- package/build/teste2.html +0 -490
package/build/index.d.mts
CHANGED
|
@@ -618,10 +618,10 @@ declare function gerar({ banco, dados }: IGerarBoleto): {
|
|
|
618
618
|
|
|
619
619
|
declare function pdf({ banco, dados }: IGerarPDF): Promise<{
|
|
620
620
|
erro: boolean;
|
|
621
|
-
dados: string
|
|
621
|
+
dados: string;
|
|
622
622
|
} | {
|
|
623
623
|
erro: boolean;
|
|
624
|
-
dados:
|
|
624
|
+
dados: null;
|
|
625
625
|
}> | undefined;
|
|
626
626
|
|
|
627
627
|
declare function remessa({ banco, dados }: IGerarRemessa): {
|
package/build/index.d.ts
CHANGED
|
@@ -618,10 +618,10 @@ declare function gerar({ banco, dados }: IGerarBoleto): {
|
|
|
618
618
|
|
|
619
619
|
declare function pdf({ banco, dados }: IGerarPDF): Promise<{
|
|
620
620
|
erro: boolean;
|
|
621
|
-
dados: string
|
|
621
|
+
dados: string;
|
|
622
622
|
} | {
|
|
623
623
|
erro: boolean;
|
|
624
|
-
dados:
|
|
624
|
+
dados: null;
|
|
625
625
|
}> | undefined;
|
|
626
626
|
|
|
627
627
|
declare function remessa({ banco, dados }: IGerarRemessa): {
|
package/build/index.js
CHANGED
|
@@ -56,9 +56,6 @@ __export(src_exports, {
|
|
|
56
56
|
});
|
|
57
57
|
module.exports = __toCommonJS(src_exports);
|
|
58
58
|
|
|
59
|
-
// src/banks/ailos/gerarDadosBoleto.ts
|
|
60
|
-
var import_date_fns = require("date-fns");
|
|
61
|
-
|
|
62
59
|
// src/utils/pafLeft.ts
|
|
63
60
|
function padLeft(numero, tamanho) {
|
|
64
61
|
numero = String(numero);
|
|
@@ -86,6 +83,17 @@ function copy(texto, startPosition, endPosition) {
|
|
|
86
83
|
return retorno2;
|
|
87
84
|
}
|
|
88
85
|
|
|
86
|
+
// src/utils/getFatorVencimento.ts
|
|
87
|
+
var import_date_fns = require("date-fns");
|
|
88
|
+
function getFatorVencimento(vencimento) {
|
|
89
|
+
vencimento = new Date(vencimento);
|
|
90
|
+
if (vencimento >= new Date(2025, 1, 22)) {
|
|
91
|
+
return (0, import_date_fns.differenceInDays)(new Date(vencimento), new Date(2022, 4, 29)).toString();
|
|
92
|
+
} else {
|
|
93
|
+
return (0, import_date_fns.differenceInDays)(new Date(vencimento), new Date(1997, 9, 7)).toString();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
89
97
|
// src/banks/ailos/gerarDadosBoleto.ts
|
|
90
98
|
function gerarDadosBoleto({ dados }) {
|
|
91
99
|
try {
|
|
@@ -125,10 +133,6 @@ function gerarDadosBoleto({ dados }) {
|
|
|
125
133
|
return null;
|
|
126
134
|
}
|
|
127
135
|
}
|
|
128
|
-
function getFatorVencimento(vencimento) {
|
|
129
|
-
const data = new Date(1997, 9, 7);
|
|
130
|
-
return (0, import_date_fns.differenceInDays)(new Date(vencimento), data).toString();
|
|
131
|
-
}
|
|
132
136
|
function getValor(valor) {
|
|
133
137
|
const valorFormatado = valor.toFixed(2).replace(/\D/g, "");
|
|
134
138
|
return padLeft(valorFormatado, 10);
|
|
@@ -236,6 +240,19 @@ var api = import_axios.default.create({
|
|
|
236
240
|
baseURL: process.env.API_URL
|
|
237
241
|
});
|
|
238
242
|
|
|
243
|
+
// src/utils/zip.ts
|
|
244
|
+
var zlib = __toESM(require("zlib"));
|
|
245
|
+
function decompress(input) {
|
|
246
|
+
return new Promise((resolve, reject) => {
|
|
247
|
+
zlib.gunzip(input, (error, result) => {
|
|
248
|
+
if (error) {
|
|
249
|
+
return reject(error);
|
|
250
|
+
}
|
|
251
|
+
resolve(result.toString());
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
239
256
|
// src/banks/ailos/gerarPDF.ts
|
|
240
257
|
function gerarPDF(_0) {
|
|
241
258
|
return __async(this, arguments, function* ({ dados }) {
|
|
@@ -312,7 +329,8 @@ function gerarPDF(_0) {
|
|
|
312
329
|
throw new Error("BaseURL api not found");
|
|
313
330
|
}
|
|
314
331
|
const response = yield api.post("/", { content, config });
|
|
315
|
-
|
|
332
|
+
const buffer = Buffer.from(response.data.pdf);
|
|
333
|
+
pdfBase64 = yield decompress(buffer);
|
|
316
334
|
}
|
|
317
335
|
return {
|
|
318
336
|
erro: false,
|
|
@@ -322,7 +340,7 @@ function gerarPDF(_0) {
|
|
|
322
340
|
console.log(error);
|
|
323
341
|
return {
|
|
324
342
|
erro: true,
|
|
325
|
-
dados:
|
|
343
|
+
dados: null
|
|
326
344
|
};
|
|
327
345
|
}
|
|
328
346
|
});
|
|
@@ -653,12 +671,11 @@ var Banco = /* @__PURE__ */ ((Banco2) => {
|
|
|
653
671
|
})(Banco || {});
|
|
654
672
|
|
|
655
673
|
// src/banks/bradesco/gerarDadosBoleto.ts
|
|
656
|
-
var import_date_fns3 = require("date-fns");
|
|
657
674
|
function gerarDadosBoleto2({ dados }) {
|
|
658
675
|
try {
|
|
659
676
|
const { bancario, parcela } = dados;
|
|
660
677
|
parcela.valor = Number(parcela.valor);
|
|
661
|
-
const fatorVencimento =
|
|
678
|
+
const fatorVencimento = getFatorVencimento(parcela.vencimento);
|
|
662
679
|
const valor = getValor2(parcela.valor);
|
|
663
680
|
const convenio = padLeft(bancario.convenio, 6);
|
|
664
681
|
const numeroDocumento = padLeft(`${parcela.id_boleto}`, 9);
|
|
@@ -693,10 +710,6 @@ function gerarDadosBoleto2({ dados }) {
|
|
|
693
710
|
return null;
|
|
694
711
|
}
|
|
695
712
|
}
|
|
696
|
-
function getFatorVencimento2(vencimento) {
|
|
697
|
-
const data = new Date(1997, 9, 7);
|
|
698
|
-
return (0, import_date_fns3.differenceInDays)(new Date(vencimento), data).toString();
|
|
699
|
-
}
|
|
700
713
|
function getValor2(valor) {
|
|
701
714
|
const valorFormatado = valor.toFixed(2).replace(/\D/g, "");
|
|
702
715
|
return padLeft(valorFormatado, 10);
|
|
@@ -804,7 +817,8 @@ function gerarPDF2(_0) {
|
|
|
804
817
|
throw new Error("BaseURL api not found");
|
|
805
818
|
}
|
|
806
819
|
const response = yield api.post("/", { content, config });
|
|
807
|
-
|
|
820
|
+
const buffer = Buffer.from(response.data.pdf);
|
|
821
|
+
pdfBase64 = yield decompress(buffer);
|
|
808
822
|
}
|
|
809
823
|
return {
|
|
810
824
|
erro: false,
|
|
@@ -820,15 +834,15 @@ function gerarPDF2(_0) {
|
|
|
820
834
|
}
|
|
821
835
|
|
|
822
836
|
// src/banks/bradesco/gerarRemessa.ts
|
|
823
|
-
var
|
|
837
|
+
var import_date_fns3 = require("date-fns");
|
|
824
838
|
function gerarRemessa2(_0) {
|
|
825
839
|
return __async(this, arguments, function* ({ dados }) {
|
|
826
840
|
try {
|
|
827
841
|
const { dadosBancario, beneficiario, boletos } = dados.remessa;
|
|
828
842
|
const arquivo = new Arquivo();
|
|
829
843
|
const dataAtual = /* @__PURE__ */ new Date();
|
|
830
|
-
const data = (0,
|
|
831
|
-
const hora = (0,
|
|
844
|
+
const data = (0, import_date_fns3.format)(dataAtual, "ddMMyyyy");
|
|
845
|
+
const hora = (0, import_date_fns3.format)(dataAtual, "HHmmss");
|
|
832
846
|
const convenio = dadosBancario.convenio.padStart(7, "0");
|
|
833
847
|
const numero = dadosBancario.conta.padStart(7, "0") + dadosBancario.contaDigito;
|
|
834
848
|
const remessa2 = `REM${convenio}-${numero}-${data}.REM`;
|
|
@@ -886,12 +900,12 @@ function gerarRemessa2(_0) {
|
|
|
886
900
|
let total = 0;
|
|
887
901
|
for (const boleto of boletos) {
|
|
888
902
|
const { pagador } = boleto;
|
|
889
|
-
const vencimento = (0,
|
|
903
|
+
const vencimento = (0, import_date_fns3.format)(new Date(boleto.vencimento), "ddMMyyyy");
|
|
890
904
|
total += Number(boleto.valor);
|
|
891
905
|
const codigoJuro = dadosBancario.jurosMes > 0 ? "2" : "3";
|
|
892
906
|
const juros = dadosBancario.jurosMes > 0 ? dadosBancario.jurosMes.toFixed(2) : "000000000000000";
|
|
893
|
-
const jurosVencimento = (0,
|
|
894
|
-
(0,
|
|
907
|
+
const jurosVencimento = (0, import_date_fns3.format)(
|
|
908
|
+
(0, import_date_fns3.addDays)(new Date(boleto.vencimento), 1),
|
|
895
909
|
"ddMMyyyy"
|
|
896
910
|
);
|
|
897
911
|
const codigoDesconto = dadosBancario.descontoPagamento > 0 ? "2" : "0";
|
|
@@ -1113,12 +1127,11 @@ var bradesco = {
|
|
|
1113
1127
|
};
|
|
1114
1128
|
|
|
1115
1129
|
// src/banks/sicredi/gerarDadosBoleto.ts
|
|
1116
|
-
var import_date_fns5 = require("date-fns");
|
|
1117
1130
|
function gerarDadosBoleto3({ dados }) {
|
|
1118
1131
|
try {
|
|
1119
1132
|
const { bancario, parcela } = dados;
|
|
1120
1133
|
parcela.valor = Number(parcela.valor);
|
|
1121
|
-
const fatorVencimento =
|
|
1134
|
+
const fatorVencimento = getFatorVencimento(parcela.vencimento);
|
|
1122
1135
|
const valor = getValor3(parcela.valor);
|
|
1123
1136
|
const nossoNumero = getNossoNumero(
|
|
1124
1137
|
parcela.numeroUnico,
|
|
@@ -1176,10 +1189,6 @@ function getNossoNumero(id, agencia, posto, codigoCedente) {
|
|
|
1176
1189
|
digito = 0;
|
|
1177
1190
|
return id.padStart(8, "0") + digito.toString();
|
|
1178
1191
|
}
|
|
1179
|
-
function getFatorVencimento3(vencimento) {
|
|
1180
|
-
const data = new Date(1997, 9, 7);
|
|
1181
|
-
return (0, import_date_fns5.differenceInDays)(new Date(vencimento), data).toString();
|
|
1182
|
-
}
|
|
1183
1192
|
function getValor3(valor) {
|
|
1184
1193
|
const valorFormatado = valor.toFixed(2).replace(/\D/g, "");
|
|
1185
1194
|
return valorFormatado.padStart(10, "0");
|
|
@@ -1322,7 +1331,8 @@ function gerarPDF3(_0) {
|
|
|
1322
1331
|
throw new Error("BaseURL api not found");
|
|
1323
1332
|
}
|
|
1324
1333
|
const response = yield api.post("/", { content, config });
|
|
1325
|
-
|
|
1334
|
+
const buffer = Buffer.from(response.data.pdf);
|
|
1335
|
+
pdfBase64 = yield decompress(buffer);
|
|
1326
1336
|
}
|
|
1327
1337
|
return {
|
|
1328
1338
|
erro: false,
|
|
@@ -1332,27 +1342,24 @@ function gerarPDF3(_0) {
|
|
|
1332
1342
|
console.log(error);
|
|
1333
1343
|
return {
|
|
1334
1344
|
erro: true,
|
|
1335
|
-
dados:
|
|
1345
|
+
dados: null
|
|
1336
1346
|
};
|
|
1337
1347
|
}
|
|
1338
1348
|
});
|
|
1339
1349
|
}
|
|
1340
1350
|
|
|
1341
1351
|
// src/banks/sicredi/gerarRemessa.ts
|
|
1342
|
-
var
|
|
1352
|
+
var import_date_fns4 = require("date-fns");
|
|
1343
1353
|
function gerarRemessa3({ dados }) {
|
|
1344
1354
|
try {
|
|
1345
1355
|
const { dadosBancario, beneficiario, boletos } = dados.remessa;
|
|
1346
1356
|
const arquivo = new Arquivo();
|
|
1347
|
-
const
|
|
1348
|
-
const dia = copy(dataAtual, 1, 2);
|
|
1349
|
-
const mes = copy(dataAtual, 2, 4);
|
|
1357
|
+
const data = /* @__PURE__ */ new Date();
|
|
1350
1358
|
let protestar = "00";
|
|
1351
1359
|
let negativar = "0000";
|
|
1352
1360
|
if (dadosBancario.diasProtesto > 0) {
|
|
1353
1361
|
protestar = "06";
|
|
1354
1362
|
}
|
|
1355
|
-
const remessa2 = `${dadosBancario.codigo_cedente}`;
|
|
1356
1363
|
arquivo.add("01REMESSA");
|
|
1357
1364
|
arquivo.add("01");
|
|
1358
1365
|
arquivo.add("COBRANCA".padEnd(15, " "));
|
|
@@ -1361,7 +1368,7 @@ function gerarRemessa3({ dados }) {
|
|
|
1361
1368
|
arquivo.add(" ".padEnd(31, " "));
|
|
1362
1369
|
arquivo.add("748");
|
|
1363
1370
|
arquivo.add("SICREDI".padEnd(15, " "));
|
|
1364
|
-
arquivo.add((0,
|
|
1371
|
+
arquivo.add((0, import_date_fns4.format)(data, "yyyyMMdd"));
|
|
1365
1372
|
arquivo.add(" ".padEnd(8, " "));
|
|
1366
1373
|
arquivo.add(dadosBancario.numeroRemessa.padStart(7, "0"));
|
|
1367
1374
|
arquivo.add(" ".padEnd(273, " "));
|
|
@@ -1373,11 +1380,13 @@ function gerarRemessa3({ dados }) {
|
|
|
1373
1380
|
for (const boleto of boletos) {
|
|
1374
1381
|
const { pagador } = boleto;
|
|
1375
1382
|
total += Number(boleto.valor);
|
|
1376
|
-
|
|
1377
|
-
let
|
|
1378
|
-
let
|
|
1379
|
-
|
|
1380
|
-
|
|
1383
|
+
let tipoInscricao = pagador.pessoa === "F" ? "1" : "2";
|
|
1384
|
+
let desconto = "0000000000000";
|
|
1385
|
+
let dataDesconto = "000000";
|
|
1386
|
+
if (dadosBancario.descontoPagamento) {
|
|
1387
|
+
desconto = dadosBancario.descontoPagamento.toFixed(2).replace(".", "").padStart(13, "0");
|
|
1388
|
+
dataDesconto = (0, import_date_fns4.format)(new Date(boleto.vencimento), "ddMMyy");
|
|
1389
|
+
}
|
|
1381
1390
|
let valorJurosDias = Number(boleto.valor) + Number(dadosBancario.jurosMes) / 100 / 30;
|
|
1382
1391
|
let multaAtraso = String(dadosBancario.multaAtraso * 100);
|
|
1383
1392
|
arquivo.add("1");
|
|
@@ -1385,9 +1394,9 @@ function gerarRemessa3({ dados }) {
|
|
|
1385
1394
|
arquivo.add(" ".padEnd(12, " "));
|
|
1386
1395
|
arquivo.add("AAA");
|
|
1387
1396
|
arquivo.add(" ".padEnd(28, " "));
|
|
1388
|
-
arquivo.add(nossoNumero.padEnd(9, " "));
|
|
1397
|
+
arquivo.add(boleto.nossoNumero.padEnd(9, " "));
|
|
1389
1398
|
arquivo.add(" ".padEnd(6, " "));
|
|
1390
|
-
arquivo.add((0,
|
|
1399
|
+
arquivo.add((0, import_date_fns4.format)(new Date(boleto.emissao), "yyyyMMdd"));
|
|
1391
1400
|
arquivo.add(" ");
|
|
1392
1401
|
arquivo.add("N");
|
|
1393
1402
|
arquivo.add(" ");
|
|
@@ -1398,17 +1407,17 @@ function gerarRemessa3({ dados }) {
|
|
|
1398
1407
|
arquivo.add(multaAtraso.padStart(4, "0"));
|
|
1399
1408
|
arquivo.add(" ".padEnd(12, " "));
|
|
1400
1409
|
arquivo.add("01");
|
|
1401
|
-
arquivo.add(boleto.
|
|
1402
|
-
arquivo.add((0,
|
|
1410
|
+
arquivo.add((boleto.numeroDocumento + "/" + boleto.parcela).padEnd(10, " "));
|
|
1411
|
+
arquivo.add((0, import_date_fns4.format)(new Date(boleto.vencimento), "ddMMyy"));
|
|
1403
1412
|
arquivo.add(Number(boleto.valor).toFixed(2).replace(".", "").padStart(13, "0"));
|
|
1404
1413
|
arquivo.add(" ".padEnd(9, " "));
|
|
1405
1414
|
arquivo.add("AN");
|
|
1406
|
-
arquivo.add((0,
|
|
1415
|
+
arquivo.add((0, import_date_fns4.format)(new Date(boleto.emissao), "ddMMyy"));
|
|
1407
1416
|
arquivo.add(protestar);
|
|
1408
1417
|
arquivo.add(String(dadosBancario.diasProtesto).padStart(2, "0"));
|
|
1409
1418
|
arquivo.add(Number(valorJurosDias).toFixed(2).replace(".", "").padStart(13, "0"));
|
|
1410
1419
|
arquivo.add(dataDesconto);
|
|
1411
|
-
arquivo.add(
|
|
1420
|
+
arquivo.add(desconto);
|
|
1412
1421
|
arquivo.add(negativar);
|
|
1413
1422
|
arquivo.add("0".padEnd(22, "0"));
|
|
1414
1423
|
arquivo.add(tipoInscricao);
|
|
@@ -1429,8 +1438,9 @@ function gerarRemessa3({ dados }) {
|
|
|
1429
1438
|
arquivo.add(dadosBancario.codigo_cedente);
|
|
1430
1439
|
arquivo.add(" ".padEnd(384, " "));
|
|
1431
1440
|
arquivo.add(String(sequencia).padStart(6, "0"));
|
|
1441
|
+
arquivo.addLine();
|
|
1432
1442
|
return {
|
|
1433
|
-
download: "
|
|
1443
|
+
download: `${dadosBancario.codigo_cedente}${retornaMes(data)}${(0, import_date_fns4.format)(data, "dd")}.crm`,
|
|
1434
1444
|
arquivo: arquivo.getArquivo()
|
|
1435
1445
|
};
|
|
1436
1446
|
} catch (error) {
|
|
@@ -1438,6 +1448,19 @@ function gerarRemessa3({ dados }) {
|
|
|
1438
1448
|
return null;
|
|
1439
1449
|
}
|
|
1440
1450
|
}
|
|
1451
|
+
function retornaMes(data) {
|
|
1452
|
+
const mes = data.getMonth() + 1;
|
|
1453
|
+
switch (mes) {
|
|
1454
|
+
case 10:
|
|
1455
|
+
return "O";
|
|
1456
|
+
case 11:
|
|
1457
|
+
return "N";
|
|
1458
|
+
case 12:
|
|
1459
|
+
return "D";
|
|
1460
|
+
default:
|
|
1461
|
+
return mes.toString();
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1441
1464
|
|
|
1442
1465
|
// src/banks/sicredi/index.ts
|
|
1443
1466
|
var sicredi = {
|
|
@@ -1447,7 +1470,6 @@ var sicredi = {
|
|
|
1447
1470
|
};
|
|
1448
1471
|
|
|
1449
1472
|
// src/banks/sicoob/gerarDadosBoleto.ts
|
|
1450
|
-
var import_date_fns7 = require("date-fns");
|
|
1451
1473
|
function gerarDadosBoleto4({ dados }) {
|
|
1452
1474
|
try {
|
|
1453
1475
|
const { bancario, parcela } = dados;
|
|
@@ -1456,7 +1478,7 @@ function gerarDadosBoleto4({ dados }) {
|
|
|
1456
1478
|
}
|
|
1457
1479
|
bancario.modalidade = padLeft(bancario.modalidade, 2);
|
|
1458
1480
|
const nossoNumero = getNossoNumero2(bancario.agencia, bancario.codigo_cliente, parcela.id_boleto);
|
|
1459
|
-
const fatorVencimento =
|
|
1481
|
+
const fatorVencimento = getFatorVencimento(parcela.vencimento);
|
|
1460
1482
|
const valor = getValor4(Number(parcela.valor));
|
|
1461
1483
|
const campoLivre = "1" + padLeft(copy(bancario.agencia, 1, 4), 4) + bancario.modalidade + padLeft(bancario.codigo_cliente, 7) + nossoNumero + padLeft(parcela.parcela, 3);
|
|
1462
1484
|
const digitoGeral = getDigitoGeral4(`7569${fatorVencimento}${valor}${campoLivre}`);
|
|
@@ -1485,10 +1507,6 @@ function gerarDadosBoleto4({ dados }) {
|
|
|
1485
1507
|
return null;
|
|
1486
1508
|
}
|
|
1487
1509
|
}
|
|
1488
|
-
function getFatorVencimento4(vencimento) {
|
|
1489
|
-
const data = new Date(1997, 9, 7);
|
|
1490
|
-
return (0, import_date_fns7.differenceInDays)(new Date(vencimento), data).toString().padStart(4, "0");
|
|
1491
|
-
}
|
|
1492
1510
|
function getNossoNumero2(numero_cooperativa, codigo_cliente, id_boleto) {
|
|
1493
1511
|
const constante_calculo = "3197";
|
|
1494
1512
|
numero_cooperativa = padLeft(copy(numero_cooperativa, 1, 4), 4);
|
|
@@ -1552,14 +1570,14 @@ function getDigito4(texto) {
|
|
|
1552
1570
|
}
|
|
1553
1571
|
|
|
1554
1572
|
// src/banks/sicoob/gerarRemessa.ts
|
|
1555
|
-
var
|
|
1573
|
+
var import_date_fns5 = require("date-fns");
|
|
1556
1574
|
function gerarRemessa4({ dados }) {
|
|
1557
1575
|
try {
|
|
1558
1576
|
const { dadosBancario, beneficiario, boletos } = dados.remessa;
|
|
1559
1577
|
const arquivo = new Arquivo();
|
|
1560
1578
|
const dataAtual = /* @__PURE__ */ new Date();
|
|
1561
|
-
const data = (0,
|
|
1562
|
-
const hora = (0,
|
|
1579
|
+
const data = (0, import_date_fns5.format)(dataAtual, "ddMMyyyy");
|
|
1580
|
+
const hora = (0, import_date_fns5.format)(dataAtual, "HHmmss");
|
|
1563
1581
|
const remessa2 = `REM${dadosBancario.numeroRemessa.padStart(6, "0")}.REM`;
|
|
1564
1582
|
arquivo.add("756");
|
|
1565
1583
|
arquivo.add("0000");
|
|
@@ -1608,7 +1626,7 @@ function gerarRemessa4({ dados }) {
|
|
|
1608
1626
|
let total = 0;
|
|
1609
1627
|
for (const boleto of boletos) {
|
|
1610
1628
|
const { pagador } = boleto;
|
|
1611
|
-
const vencimento = (0,
|
|
1629
|
+
const vencimento = (0, import_date_fns5.format)(new Date(boleto.vencimento), "ddMMyyyy");
|
|
1612
1630
|
const valor_juros_dia = Number(boleto.valor) * dadosBancario.jurosMes / 100 / 30;
|
|
1613
1631
|
const protesto = dadosBancario.diasProtesto > 0 ? "1" : "3";
|
|
1614
1632
|
const diasProtesto = protesto === "1" ? dadosBancario.diasProtesto.toString() : "00";
|
|
@@ -1643,7 +1661,7 @@ function gerarRemessa4({ dados }) {
|
|
|
1643
1661
|
arquivo.add(dadosBancario.aceite);
|
|
1644
1662
|
arquivo.add(data);
|
|
1645
1663
|
arquivo.add("1");
|
|
1646
|
-
arquivo.add((0,
|
|
1664
|
+
arquivo.add((0, import_date_fns5.format)((0, import_date_fns5.addDays)(new Date(boleto.vencimento), 1), "ddMMyyyy"));
|
|
1647
1665
|
arquivo.add(valor_juros_dia.toFixed(2).replace(".", "").padStart(15, "0"));
|
|
1648
1666
|
arquivo.add("0");
|
|
1649
1667
|
arquivo.add("00000000");
|
|
@@ -1703,7 +1721,7 @@ function gerarRemessa4({ dados }) {
|
|
|
1703
1721
|
dadosBancario.multaAtraso = Number(dadosBancario.multaAtraso || 0);
|
|
1704
1722
|
if (dadosBancario.multaAtraso > 0) {
|
|
1705
1723
|
multa = "2";
|
|
1706
|
-
data_multa = (0,
|
|
1724
|
+
data_multa = (0, import_date_fns5.format)((0, import_date_fns5.addDays)(new Date(boleto.vencimento), 1), "ddMMyyyy");
|
|
1707
1725
|
percentual_multa = (dadosBancario.multaAtraso * 100).toString().padStart(15, "0");
|
|
1708
1726
|
}
|
|
1709
1727
|
arquivo.add("756");
|
|
@@ -1874,7 +1892,8 @@ function gerarPDF4(_0) {
|
|
|
1874
1892
|
throw new Error("BaseURL api not found");
|
|
1875
1893
|
}
|
|
1876
1894
|
const response = yield api.post("/", { content, config });
|
|
1877
|
-
|
|
1895
|
+
const buffer = Buffer.from(response.data.pdf);
|
|
1896
|
+
pdfBase64 = yield decompress(buffer);
|
|
1878
1897
|
}
|
|
1879
1898
|
return {
|
|
1880
1899
|
erro: false,
|