@plasoft/boletos 1.0.56 → 1.0.58
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 -1
- package/build/index.d.ts +8 -1
- package/build/index.js +108 -41
- package/build/index.js.map +1 -1
- package/build/index.mjs +107 -40
- 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';
|
|
@@ -166,6 +168,7 @@ interface IDocumentoRetornoAilos {
|
|
|
166
168
|
valor_juros: number;
|
|
167
169
|
valor_desconto: number;
|
|
168
170
|
valor_total: number;
|
|
171
|
+
data: Date | string;
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
interface IGerarBoletoBradesco {
|
|
@@ -412,6 +415,7 @@ interface IDadosPDF$3 {
|
|
|
412
415
|
instrucao4?: string;
|
|
413
416
|
observacoes?: string[];
|
|
414
417
|
nfs: string;
|
|
418
|
+
desconto: number;
|
|
415
419
|
};
|
|
416
420
|
}
|
|
417
421
|
interface IGerarRemessaSicredi {
|
|
@@ -454,6 +458,7 @@ interface IDadosRemessa$2 {
|
|
|
454
458
|
numeroDocumento: string;
|
|
455
459
|
parcela: number | string;
|
|
456
460
|
aceite: string;
|
|
461
|
+
desconto: number;
|
|
457
462
|
pagador: {
|
|
458
463
|
nome: string;
|
|
459
464
|
pessoa: 'F' | 'J';
|
|
@@ -706,6 +711,7 @@ interface IDadosPDF$1 {
|
|
|
706
711
|
instrucao4?: string;
|
|
707
712
|
observacoes?: string[];
|
|
708
713
|
nfs: string;
|
|
714
|
+
desconto: number;
|
|
709
715
|
};
|
|
710
716
|
}
|
|
711
717
|
interface IGerarRemessaBancoBrasil {
|
|
@@ -752,6 +758,7 @@ interface IDadosRemessa {
|
|
|
752
758
|
numeroDocumento: string;
|
|
753
759
|
parcela: number | string;
|
|
754
760
|
aceite: string;
|
|
761
|
+
desconto: number;
|
|
755
762
|
pagador: {
|
|
756
763
|
nome: string;
|
|
757
764
|
pessoa: 'F' | 'J';
|
|
@@ -870,7 +877,7 @@ declare function remessa({ banco, dados }: IGerarRemessa): {
|
|
|
870
877
|
arquivo: string;
|
|
871
878
|
} | null> | null | undefined;
|
|
872
879
|
|
|
873
|
-
declare function retorno({ banco, dados }: IGerarRetorno): IDocumentoRetornoAilos[] | null | undefined;
|
|
880
|
+
declare function retorno({ banco, dados }: IGerarRetorno): Record<string, IDocumentoRetornoAilos[]> | null | undefined;
|
|
874
881
|
|
|
875
882
|
interface IConfig {
|
|
876
883
|
apiClient?: {
|
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';
|
|
@@ -166,6 +168,7 @@ interface IDocumentoRetornoAilos {
|
|
|
166
168
|
valor_juros: number;
|
|
167
169
|
valor_desconto: number;
|
|
168
170
|
valor_total: number;
|
|
171
|
+
data: Date | string;
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
interface IGerarBoletoBradesco {
|
|
@@ -412,6 +415,7 @@ interface IDadosPDF$3 {
|
|
|
412
415
|
instrucao4?: string;
|
|
413
416
|
observacoes?: string[];
|
|
414
417
|
nfs: string;
|
|
418
|
+
desconto: number;
|
|
415
419
|
};
|
|
416
420
|
}
|
|
417
421
|
interface IGerarRemessaSicredi {
|
|
@@ -454,6 +458,7 @@ interface IDadosRemessa$2 {
|
|
|
454
458
|
numeroDocumento: string;
|
|
455
459
|
parcela: number | string;
|
|
456
460
|
aceite: string;
|
|
461
|
+
desconto: number;
|
|
457
462
|
pagador: {
|
|
458
463
|
nome: string;
|
|
459
464
|
pessoa: 'F' | 'J';
|
|
@@ -706,6 +711,7 @@ interface IDadosPDF$1 {
|
|
|
706
711
|
instrucao4?: string;
|
|
707
712
|
observacoes?: string[];
|
|
708
713
|
nfs: string;
|
|
714
|
+
desconto: number;
|
|
709
715
|
};
|
|
710
716
|
}
|
|
711
717
|
interface IGerarRemessaBancoBrasil {
|
|
@@ -752,6 +758,7 @@ interface IDadosRemessa {
|
|
|
752
758
|
numeroDocumento: string;
|
|
753
759
|
parcela: number | string;
|
|
754
760
|
aceite: string;
|
|
761
|
+
desconto: number;
|
|
755
762
|
pagador: {
|
|
756
763
|
nome: string;
|
|
757
764
|
pessoa: 'F' | 'J';
|
|
@@ -870,7 +877,7 @@ declare function remessa({ banco, dados }: IGerarRemessa): {
|
|
|
870
877
|
arquivo: string;
|
|
871
878
|
} | null> | null | undefined;
|
|
872
879
|
|
|
873
|
-
declare function retorno({ banco, dados }: IGerarRetorno): IDocumentoRetornoAilos[] | null | undefined;
|
|
880
|
+
declare function retorno({ banco, dados }: IGerarRetorno): Record<string, IDocumentoRetornoAilos[]> | null | undefined;
|
|
874
881
|
|
|
875
882
|
interface IConfig {
|
|
876
883
|
apiClient?: {
|
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) {
|
|
@@ -655,6 +655,22 @@ function gerarRemessa({ dados }) {
|
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
657
|
|
|
658
|
+
// src/banks/ailos/gerarRetorno.ts
|
|
659
|
+
var import_date_fns4 = require("date-fns");
|
|
660
|
+
|
|
661
|
+
// src/utils/agruparRetorno.ts
|
|
662
|
+
var import_date_fns3 = require("date-fns");
|
|
663
|
+
function agruparRetorno(documentos) {
|
|
664
|
+
return documentos.reduce((acc, documento) => {
|
|
665
|
+
const dataKey = (0, import_date_fns3.format)(new Date(documento.data), "yyyy-MM-dd");
|
|
666
|
+
if (!acc[dataKey]) {
|
|
667
|
+
acc[dataKey] = [];
|
|
668
|
+
}
|
|
669
|
+
acc[dataKey].push(documento);
|
|
670
|
+
return acc;
|
|
671
|
+
}, {});
|
|
672
|
+
}
|
|
673
|
+
|
|
658
674
|
// src/banks/ailos/gerarRetorno.ts
|
|
659
675
|
function gerarRetorno({ dados }) {
|
|
660
676
|
try {
|
|
@@ -680,6 +696,14 @@ function gerarRetorno({ dados }) {
|
|
|
680
696
|
linha = arquivo[index + 1];
|
|
681
697
|
segmento = linha.substring(13, 14);
|
|
682
698
|
if (segmento === "U") {
|
|
699
|
+
let dataCredito;
|
|
700
|
+
const dataCreditoString = linha.substring(145, 153);
|
|
701
|
+
if (dataCreditoString && dataCreditoString !== "00000000") {
|
|
702
|
+
dataCredito = (0, import_date_fns4.parse)(dataCreditoString, "ddMMyyyy", /* @__PURE__ */ new Date());
|
|
703
|
+
} else {
|
|
704
|
+
const dataOcorrenciaString = linha.substring(157, 165);
|
|
705
|
+
dataCredito = (0, import_date_fns4.parse)(dataOcorrenciaString, "ddMMyyyy", /* @__PURE__ */ new Date());
|
|
706
|
+
}
|
|
683
707
|
const valorAbatimentoString = linha.substring(47, 62);
|
|
684
708
|
const valorAbatimento = Number(valorAbatimentoString) / 100;
|
|
685
709
|
const valorDescontoString = linha.substring(32, 47);
|
|
@@ -698,7 +722,8 @@ function gerarRetorno({ dados }) {
|
|
|
698
722
|
valor_multa: valorMulta,
|
|
699
723
|
valor_juros: valorJuros,
|
|
700
724
|
valor_desconto: valorDesconto,
|
|
701
|
-
valor_total: valorTotal
|
|
725
|
+
valor_total: valorTotal,
|
|
726
|
+
data: dataCredito
|
|
702
727
|
};
|
|
703
728
|
documentos.push(documento);
|
|
704
729
|
}
|
|
@@ -706,7 +731,8 @@ function gerarRetorno({ dados }) {
|
|
|
706
731
|
}
|
|
707
732
|
index++;
|
|
708
733
|
}
|
|
709
|
-
|
|
734
|
+
const documentoAgrupado = agruparRetorno(documentos);
|
|
735
|
+
return documentoAgrupado;
|
|
710
736
|
} catch (error) {
|
|
711
737
|
console.log(error);
|
|
712
738
|
return null;
|
|
@@ -896,15 +922,15 @@ function gerarPDF2(_0) {
|
|
|
896
922
|
}
|
|
897
923
|
|
|
898
924
|
// src/banks/bradesco/gerarRemessa.ts
|
|
899
|
-
var
|
|
925
|
+
var import_date_fns5 = require("date-fns");
|
|
900
926
|
function gerarRemessa2(_0) {
|
|
901
927
|
return __async(this, arguments, function* ({ dados }) {
|
|
902
928
|
try {
|
|
903
929
|
const { dadosBancario, beneficiario, boletos } = dados.remessa;
|
|
904
930
|
const arquivo = new Arquivo();
|
|
905
931
|
const dataAtual = /* @__PURE__ */ new Date();
|
|
906
|
-
const data = (0,
|
|
907
|
-
const hora = (0,
|
|
932
|
+
const data = (0, import_date_fns5.format)(dataAtual, "ddMMyyyy");
|
|
933
|
+
const hora = (0, import_date_fns5.format)(dataAtual, "HHmmss");
|
|
908
934
|
const convenio = dadosBancario.convenio.padStart(7, "0");
|
|
909
935
|
const numero = dadosBancario.conta.padStart(7, "0") + dadosBancario.contaDigito;
|
|
910
936
|
const remessa2 = `REM${convenio}-${numero}-${data}.REM`;
|
|
@@ -962,12 +988,12 @@ function gerarRemessa2(_0) {
|
|
|
962
988
|
let total = 0;
|
|
963
989
|
for (const boleto of boletos) {
|
|
964
990
|
const { pagador } = boleto;
|
|
965
|
-
const vencimento = (0,
|
|
991
|
+
const vencimento = (0, import_date_fns5.format)(new Date(boleto.vencimento), "ddMMyyyy");
|
|
966
992
|
total += Number(boleto.valor);
|
|
967
993
|
const codigoJuro = dadosBancario.jurosMes > 0 ? "2" : "3";
|
|
968
994
|
const juros = dadosBancario.jurosMes > 0 ? dadosBancario.jurosMes.toFixed(2) : "000000000000000";
|
|
969
|
-
const jurosVencimento = (0,
|
|
970
|
-
(0,
|
|
995
|
+
const jurosVencimento = (0, import_date_fns5.format)(
|
|
996
|
+
(0, import_date_fns5.addDays)(new Date(boleto.vencimento), 1),
|
|
971
997
|
"ddMMyyyy"
|
|
972
998
|
);
|
|
973
999
|
const codigoDesconto = dadosBancario.descontoPagamento > 0 ? "2" : "0";
|
|
@@ -1165,7 +1191,8 @@ function gerarRetorno2({ dados }) {
|
|
|
1165
1191
|
valor_desconto: 0,
|
|
1166
1192
|
valor_juros: 0,
|
|
1167
1193
|
valor_multa: 0,
|
|
1168
|
-
valor_total: 0
|
|
1194
|
+
valor_total: 0,
|
|
1195
|
+
data: /* @__PURE__ */ new Date()
|
|
1169
1196
|
};
|
|
1170
1197
|
documentos.push(documento);
|
|
1171
1198
|
}
|
|
@@ -1173,7 +1200,8 @@ function gerarRetorno2({ dados }) {
|
|
|
1173
1200
|
}
|
|
1174
1201
|
index++;
|
|
1175
1202
|
}
|
|
1176
|
-
|
|
1203
|
+
const documentoAgrupado = agruparRetorno(documentos);
|
|
1204
|
+
return documentoAgrupado;
|
|
1177
1205
|
} catch (error) {
|
|
1178
1206
|
console.log(error);
|
|
1179
1207
|
return null;
|
|
@@ -1369,7 +1397,7 @@ function gerarPDF3(_0) {
|
|
|
1369
1397
|
if (jurosDia > 0) {
|
|
1370
1398
|
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${maskFormat_default.numberToReal(jurosDia)} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
1371
1399
|
}
|
|
1372
|
-
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto
|
|
1400
|
+
const descontoVencimento = dadosPDF.boleto.desconto > 0 ? dadosPDF.boleto.desconto : dadosPDF.beneficiario.dadosBancario.desconto > 0 ? dadosPDF.beneficiario.dadosBancario.desconto : 0;
|
|
1373
1401
|
if (descontoVencimento > 0) {
|
|
1374
1402
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
1375
1403
|
}
|
|
@@ -1422,7 +1450,7 @@ function gerarPDF3(_0) {
|
|
|
1422
1450
|
}
|
|
1423
1451
|
|
|
1424
1452
|
// src/banks/sicredi/gerarRemessa.ts
|
|
1425
|
-
var
|
|
1453
|
+
var import_date_fns6 = require("date-fns");
|
|
1426
1454
|
function gerarRemessa3({ dados }) {
|
|
1427
1455
|
try {
|
|
1428
1456
|
const { dadosBancario, beneficiario, boletos } = dados.remessa;
|
|
@@ -1456,7 +1484,7 @@ function gerarRemessa3({ dados }) {
|
|
|
1456
1484
|
arquivo.add(" ".padEnd(31, " "));
|
|
1457
1485
|
arquivo.add("748");
|
|
1458
1486
|
arquivo.add("SICREDI".padEnd(15, " "));
|
|
1459
|
-
arquivo.add((0,
|
|
1487
|
+
arquivo.add((0, import_date_fns6.format)(data, "yyyyMMdd"));
|
|
1460
1488
|
arquivo.add(" ".padEnd(8, " "));
|
|
1461
1489
|
arquivo.add(dadosBancario.numeroRemessa.padStart(7, "0"));
|
|
1462
1490
|
arquivo.add(" ".padEnd(273, " "));
|
|
@@ -1471,9 +1499,13 @@ function gerarRemessa3({ dados }) {
|
|
|
1471
1499
|
let tipoInscricao = pagador.pessoa === "F" ? "1" : "2";
|
|
1472
1500
|
let desconto = "0000000000000";
|
|
1473
1501
|
let dataDesconto = "000000";
|
|
1474
|
-
if (
|
|
1502
|
+
if (boleto.desconto) {
|
|
1503
|
+
desconto = boleto.desconto.toFixed(2).replace(".", "").padStart(13, "0");
|
|
1504
|
+
dataDesconto = (0, import_date_fns6.format)(new Date(boleto.vencimento), "ddMMyy");
|
|
1505
|
+
}
|
|
1506
|
+
if (!boleto.desconto && dadosBancario.descontoPagamento) {
|
|
1475
1507
|
desconto = dadosBancario.descontoPagamento.toFixed(2).replace(".", "").padStart(13, "0");
|
|
1476
|
-
dataDesconto = (0,
|
|
1508
|
+
dataDesconto = (0, import_date_fns6.format)(new Date(boleto.vencimento), "ddMMyy");
|
|
1477
1509
|
}
|
|
1478
1510
|
let valorJurosDias = Number(boleto.valor) * Number(dadosBancario.jurosMes) / 100 / 30;
|
|
1479
1511
|
let multaAtraso = String(dadosBancario.multaAtraso * 100);
|
|
@@ -1484,7 +1516,7 @@ function gerarRemessa3({ dados }) {
|
|
|
1484
1516
|
arquivo.add(" ".padEnd(28, " "));
|
|
1485
1517
|
arquivo.add(boleto.nossoNumero.padEnd(9, " "));
|
|
1486
1518
|
arquivo.add(" ".padEnd(6, " "));
|
|
1487
|
-
arquivo.add((0,
|
|
1519
|
+
arquivo.add((0, import_date_fns6.format)(new Date(boleto.emissao), "yyyyMMdd"));
|
|
1488
1520
|
arquivo.add(" ");
|
|
1489
1521
|
arquivo.add("N");
|
|
1490
1522
|
arquivo.add(" ");
|
|
@@ -1496,12 +1528,12 @@ function gerarRemessa3({ dados }) {
|
|
|
1496
1528
|
arquivo.add(" ".padEnd(12, " "));
|
|
1497
1529
|
arquivo.add("01");
|
|
1498
1530
|
arquivo.add(boleto.identificacaoTitulo.padEnd(10, " "));
|
|
1499
|
-
arquivo.add((0,
|
|
1531
|
+
arquivo.add((0, import_date_fns6.format)(new Date(boleto.vencimento), "ddMMyy"));
|
|
1500
1532
|
arquivo.add(Number(boleto.valor).toFixed(2).replace(".", "").padStart(13, "0"));
|
|
1501
1533
|
arquivo.add(" ".padEnd(9, " "));
|
|
1502
1534
|
arquivo.add("A");
|
|
1503
1535
|
arquivo.add(boleto.aceite);
|
|
1504
|
-
arquivo.add((0,
|
|
1536
|
+
arquivo.add((0, import_date_fns6.format)(new Date(boleto.emissao), "ddMMyy"));
|
|
1505
1537
|
arquivo.add(protestar);
|
|
1506
1538
|
arquivo.add(String(dadosBancario.diasProtesto).padStart(2, "0"));
|
|
1507
1539
|
arquivo.add(Number(valorJurosDias).toFixed(2).replace(".", "").padStart(13, "0"));
|
|
@@ -1529,7 +1561,7 @@ function gerarRemessa3({ dados }) {
|
|
|
1529
1561
|
arquivo.add(String(sequencia).padStart(6, "0"));
|
|
1530
1562
|
arquivo.addLine();
|
|
1531
1563
|
return {
|
|
1532
|
-
download: `${dadosBancario.codigo_cedente}${retornaMes(data)}${(0,
|
|
1564
|
+
download: `${dadosBancario.codigo_cedente}${retornaMes(data)}${(0, import_date_fns6.format)(data, "dd")}.crm`,
|
|
1533
1565
|
arquivo: arquivo.getArquivo()
|
|
1534
1566
|
};
|
|
1535
1567
|
} catch (error) {
|
|
@@ -1552,6 +1584,7 @@ function retornaMes(data) {
|
|
|
1552
1584
|
}
|
|
1553
1585
|
|
|
1554
1586
|
// src/banks/sicredi/gerarRetorno.ts
|
|
1587
|
+
var import_date_fns7 = require("date-fns");
|
|
1555
1588
|
function gerarRetorno3({ dados }) {
|
|
1556
1589
|
try {
|
|
1557
1590
|
const { arquivo } = dados;
|
|
@@ -1577,6 +1610,14 @@ function gerarRetorno3({ dados }) {
|
|
|
1577
1610
|
if (tipo_documento.length) {
|
|
1578
1611
|
especie = tipo_documento === "N" ? "NFE" : tipo_documento === "F" ? "FAT" : tipo_documento === "L" ? "FIN" : "INDEFINIDO";
|
|
1579
1612
|
}
|
|
1613
|
+
let dataCredito;
|
|
1614
|
+
const dataCreditoString = linha.substring(328, 336);
|
|
1615
|
+
if (dataCreditoString && dataCreditoString !== "00000000") {
|
|
1616
|
+
dataCredito = (0, import_date_fns7.parse)(dataCreditoString, "yyyyMMdd", /* @__PURE__ */ new Date());
|
|
1617
|
+
} else {
|
|
1618
|
+
const dataOcorrenciaString = linha.substring(110, 116);
|
|
1619
|
+
dataCredito = (0, import_date_fns7.parse)(dataOcorrenciaString, "ddMMyy", /* @__PURE__ */ new Date());
|
|
1620
|
+
}
|
|
1580
1621
|
const valor_titulo = Number(linha.substring(152, 165)) / 100;
|
|
1581
1622
|
const abatimento = Number(linha.substring(227, 240)) / 100;
|
|
1582
1623
|
let valor_desconto = Number(linha.substring(240, 253)) / 100;
|
|
@@ -1598,10 +1639,12 @@ function gerarRetorno3({ dados }) {
|
|
|
1598
1639
|
valor_multa,
|
|
1599
1640
|
valor_juros,
|
|
1600
1641
|
valor_desconto,
|
|
1601
|
-
valor_total
|
|
1642
|
+
valor_total,
|
|
1643
|
+
data: dataCredito
|
|
1602
1644
|
});
|
|
1603
1645
|
}
|
|
1604
|
-
|
|
1646
|
+
const documentosAgrupado = agruparRetorno(documentos);
|
|
1647
|
+
return documentosAgrupado;
|
|
1605
1648
|
} catch (error) {
|
|
1606
1649
|
console.log(error);
|
|
1607
1650
|
return null;
|
|
@@ -1726,14 +1769,14 @@ function getDigito4(texto) {
|
|
|
1726
1769
|
}
|
|
1727
1770
|
|
|
1728
1771
|
// src/banks/sicoob/gerarRemessa.ts
|
|
1729
|
-
var
|
|
1772
|
+
var import_date_fns8 = require("date-fns");
|
|
1730
1773
|
function gerarRemessa4({ dados }) {
|
|
1731
1774
|
try {
|
|
1732
1775
|
const { dadosBancario, beneficiario, boletos } = dados.remessa;
|
|
1733
1776
|
const arquivo = new Arquivo();
|
|
1734
1777
|
const dataAtual = /* @__PURE__ */ new Date();
|
|
1735
|
-
const data = (0,
|
|
1736
|
-
const hora = (0,
|
|
1778
|
+
const data = (0, import_date_fns8.format)(dataAtual, "ddMMyyyy");
|
|
1779
|
+
const hora = (0, import_date_fns8.format)(dataAtual, "HHmmss");
|
|
1737
1780
|
const remessa2 = `REM${dadosBancario.numeroRemessa.padStart(6, "0")}.REM`;
|
|
1738
1781
|
arquivo.add("756");
|
|
1739
1782
|
arquivo.add("0000");
|
|
@@ -1786,7 +1829,7 @@ function gerarRemessa4({ dados }) {
|
|
|
1786
1829
|
let total = 0;
|
|
1787
1830
|
for (const boleto of boletos) {
|
|
1788
1831
|
const { pagador } = boleto;
|
|
1789
|
-
const vencimento = (0,
|
|
1832
|
+
const vencimento = (0, import_date_fns8.format)(new Date(boleto.vencimento), "ddMMyyyy");
|
|
1790
1833
|
const valor_juros_dia = Number(boleto.valor) * dadosBancario.jurosMes / 100 / 30;
|
|
1791
1834
|
let protesto = "3";
|
|
1792
1835
|
switch (dadosBancario.tipo_protesto) {
|
|
@@ -1830,7 +1873,7 @@ function gerarRemessa4({ dados }) {
|
|
|
1830
1873
|
arquivo.add(boleto.aceite);
|
|
1831
1874
|
arquivo.add(data);
|
|
1832
1875
|
arquivo.add("1");
|
|
1833
|
-
arquivo.add((0,
|
|
1876
|
+
arquivo.add((0, import_date_fns8.format)((0, import_date_fns8.addDays)(new Date(boleto.vencimento), 1), "ddMMyyyy"));
|
|
1834
1877
|
arquivo.add(valor_juros_dia.toFixed(2).replace(".", "").padStart(15, "0"));
|
|
1835
1878
|
arquivo.add("0");
|
|
1836
1879
|
arquivo.add("00000000");
|
|
@@ -1880,7 +1923,7 @@ function gerarRemessa4({ dados }) {
|
|
|
1880
1923
|
dadosBancario.multaAtraso = Number(dadosBancario.multaAtraso || 0);
|
|
1881
1924
|
if (dadosBancario.multaAtraso > 0) {
|
|
1882
1925
|
multa = "2";
|
|
1883
|
-
data_multa = (0,
|
|
1926
|
+
data_multa = (0, import_date_fns8.format)((0, import_date_fns8.addDays)(new Date(boleto.vencimento), 1), "ddMMyyyy");
|
|
1884
1927
|
valor_multa = dadosBancario.multaAtraso.toFixed(2).replace(".", "").padStart(15, "0");
|
|
1885
1928
|
}
|
|
1886
1929
|
arquivo.add("756");
|
|
@@ -2064,6 +2107,7 @@ function formatNossoNumero(parcela, nossoNumero) {
|
|
|
2064
2107
|
}
|
|
2065
2108
|
|
|
2066
2109
|
// src/banks/sicoob/gerarRetorno.ts
|
|
2110
|
+
var import_date_fns9 = require("date-fns");
|
|
2067
2111
|
function gerarRetorno4({ dados }) {
|
|
2068
2112
|
try {
|
|
2069
2113
|
const { arquivo } = dados;
|
|
@@ -2092,6 +2136,14 @@ function gerarRetorno4({ dados }) {
|
|
|
2092
2136
|
linha = arquivo[++i];
|
|
2093
2137
|
segmento = linha.substring(13, 14);
|
|
2094
2138
|
if (segmento === "U") {
|
|
2139
|
+
let dataCredito;
|
|
2140
|
+
const dataCreditoString = linha.substring(145, 153);
|
|
2141
|
+
if (dataCreditoString && dataCreditoString !== "00000000") {
|
|
2142
|
+
dataCredito = (0, import_date_fns9.parse)(dataCreditoString, "ddMMyyyy", /* @__PURE__ */ new Date());
|
|
2143
|
+
} else {
|
|
2144
|
+
const dataOcorrenciaString = linha.substring(137, 145);
|
|
2145
|
+
dataCredito = (0, import_date_fns9.parse)(dataOcorrenciaString, "ddMMyy", /* @__PURE__ */ new Date());
|
|
2146
|
+
}
|
|
2095
2147
|
const valorAbatimentoString = linha.substring(47, 62);
|
|
2096
2148
|
const valorAbatimento = Number(valorAbatimentoString) / 100;
|
|
2097
2149
|
const valorDescontoString = linha.substring(32, 47);
|
|
@@ -2110,13 +2162,15 @@ function gerarRetorno4({ dados }) {
|
|
|
2110
2162
|
valor_multa: valorMulta,
|
|
2111
2163
|
valor_juros: valorJuros,
|
|
2112
2164
|
valor_desconto: valorDesconto,
|
|
2113
|
-
valor_total: valorTotal
|
|
2165
|
+
valor_total: valorTotal,
|
|
2166
|
+
data: dataCredito
|
|
2114
2167
|
};
|
|
2115
2168
|
documentos.push(documento);
|
|
2116
2169
|
}
|
|
2117
2170
|
}
|
|
2118
2171
|
}
|
|
2119
|
-
|
|
2172
|
+
const documentoAgrupado = agruparRetorno(documentos);
|
|
2173
|
+
return documentoAgrupado;
|
|
2120
2174
|
} catch (error) {
|
|
2121
2175
|
console.log(error);
|
|
2122
2176
|
return null;
|
|
@@ -2317,7 +2371,7 @@ function gerarPDF5(_0) {
|
|
|
2317
2371
|
if (jurosDia > 0) {
|
|
2318
2372
|
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${jurosDia} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
2319
2373
|
}
|
|
2320
|
-
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto
|
|
2374
|
+
const descontoVencimento = dadosPDF.boleto.desconto > 0 ? dadosPDF.boleto.desconto : dadosPDF.beneficiario.dadosBancario.desconto > 0 ? dadosPDF.beneficiario.dadosBancario.desconto : 0;
|
|
2321
2375
|
if (descontoVencimento > 0) {
|
|
2322
2376
|
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
2323
2377
|
}
|
|
@@ -2366,7 +2420,7 @@ function gerarPDF5(_0) {
|
|
|
2366
2420
|
}
|
|
2367
2421
|
|
|
2368
2422
|
// src/banks/banco-brasil/gerarRemessa.ts
|
|
2369
|
-
var
|
|
2423
|
+
var import_date_fns10 = require("date-fns");
|
|
2370
2424
|
function gerarRemessa5({ dados }) {
|
|
2371
2425
|
try {
|
|
2372
2426
|
const {
|
|
@@ -2376,8 +2430,8 @@ function gerarRemessa5({ dados }) {
|
|
|
2376
2430
|
} = dados.remessa;
|
|
2377
2431
|
const arquivo = new Arquivo();
|
|
2378
2432
|
const dataAtual = /* @__PURE__ */ new Date();
|
|
2379
|
-
const data = (0,
|
|
2380
|
-
const hora = (0,
|
|
2433
|
+
const data = (0, import_date_fns10.format)(dataAtual, "ddMMyyyy");
|
|
2434
|
+
const hora = (0, import_date_fns10.format)(dataAtual, "HHmmss");
|
|
2381
2435
|
const remessa2 = `REM${dadosBancario.numeroRemessa.padStart(5, "0")}.CNAB`;
|
|
2382
2436
|
arquivo.add("001");
|
|
2383
2437
|
arquivo.add("0000");
|
|
@@ -2477,8 +2531,10 @@ function gerarRemessa5({ dados }) {
|
|
|
2477
2531
|
const valorJurosDia = dadosBancario.jurosMes > 0 ? Number(boleto.valor) * dadosBancario.jurosMes / 100 / 30 : 0;
|
|
2478
2532
|
const { pagador } = boleto;
|
|
2479
2533
|
const tipoInscricao = pagador.pessoa === "F" ? "1" : "2";
|
|
2480
|
-
const vencimento = (0,
|
|
2534
|
+
const vencimento = (0, import_date_fns10.format)(new Date(boleto.vencimento), "ddMMyyyy");
|
|
2481
2535
|
total += Number(boleto.valor);
|
|
2536
|
+
const codigoDesconto = dadosBancario.descontoPagamento > 0 ? "2" : "0";
|
|
2537
|
+
const desconto = boleto.desconto > 0 ? boleto.desconto.toFixed(2) : dadosBancario.descontoPagamento > 0 ? dadosBancario.descontoPagamento.toFixed(2) : "000000000000000";
|
|
2482
2538
|
let protesto = "3";
|
|
2483
2539
|
let diasProtesto = "00";
|
|
2484
2540
|
let baixarDevolver = "1";
|
|
@@ -2536,9 +2592,9 @@ function gerarRemessa5({ dados }) {
|
|
|
2536
2592
|
arquivo.add("1");
|
|
2537
2593
|
arquivo.add("00000000");
|
|
2538
2594
|
arquivo.add(valorJurosDia.toFixed(2).replace(".", "").padStart(15, "0"));
|
|
2539
|
-
arquivo.add(
|
|
2540
|
-
arquivo.add(
|
|
2541
|
-
arquivo.add("
|
|
2595
|
+
arquivo.add(codigoDesconto);
|
|
2596
|
+
arquivo.add(vencimento);
|
|
2597
|
+
arquivo.add(desconto.replace(".", "").padStart(15, "0"));
|
|
2542
2598
|
arquivo.add("000000000000000");
|
|
2543
2599
|
arquivo.add("000000000000000");
|
|
2544
2600
|
arquivo.add(boleto.identificacaoTitulo.padEnd(25, " "));
|
|
@@ -2638,6 +2694,7 @@ function gerarRemessa5({ dados }) {
|
|
|
2638
2694
|
}
|
|
2639
2695
|
|
|
2640
2696
|
// src/banks/banco-brasil/gerarRetorno.ts
|
|
2697
|
+
var import_date_fns11 = require("date-fns");
|
|
2641
2698
|
function gerarRetorno5({ dados }) {
|
|
2642
2699
|
try {
|
|
2643
2700
|
const { arquivo } = dados;
|
|
@@ -2666,6 +2723,14 @@ function gerarRetorno5({ dados }) {
|
|
|
2666
2723
|
linha = arquivo[++i];
|
|
2667
2724
|
segmento = linha.substring(13, 14);
|
|
2668
2725
|
if (segmento === "U") {
|
|
2726
|
+
let dataCredito;
|
|
2727
|
+
const dataCreditoString = linha.substring(145, 153);
|
|
2728
|
+
if (dataCreditoString && dataCreditoString !== "00000000") {
|
|
2729
|
+
dataCredito = (0, import_date_fns11.parse)(dataCreditoString, "ddMMyyyy", /* @__PURE__ */ new Date());
|
|
2730
|
+
} else {
|
|
2731
|
+
const dataOcorrenciaString = linha.substring(137, 145);
|
|
2732
|
+
dataCredito = (0, import_date_fns11.parse)(dataOcorrenciaString, "ddMMyyyy", /* @__PURE__ */ new Date());
|
|
2733
|
+
}
|
|
2669
2734
|
const valorAbatimentoString = linha.substring(47, 62);
|
|
2670
2735
|
const valorAbatimento = Number(valorAbatimentoString) / 100;
|
|
2671
2736
|
const valorDescontoString = linha.substring(32, 47);
|
|
@@ -2684,13 +2749,15 @@ function gerarRetorno5({ dados }) {
|
|
|
2684
2749
|
valor_multa: valorMulta,
|
|
2685
2750
|
valor_juros: valorJuros,
|
|
2686
2751
|
valor_desconto: valorDesconto,
|
|
2687
|
-
valor_total: valorTotal
|
|
2752
|
+
valor_total: valorTotal,
|
|
2753
|
+
data: dataCredito
|
|
2688
2754
|
};
|
|
2689
2755
|
documentos.push(documento);
|
|
2690
2756
|
}
|
|
2691
2757
|
}
|
|
2692
2758
|
}
|
|
2693
|
-
|
|
2759
|
+
const documentoAgrupado = agruparRetorno(documentos);
|
|
2760
|
+
return documentoAgrupado;
|
|
2694
2761
|
} catch (error) {
|
|
2695
2762
|
console.log(error);
|
|
2696
2763
|
return null;
|