@plasoft/boletos 1.0.38 → 1.0.40
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 +11 -5
- package/build/index.d.ts +11 -5
- package/build/index.js +135 -102
- package/build/index.mjs +135 -102
- package/build/sicoob-boleto.hbs +849 -842
- package/package.json +1 -1
package/build/index.d.mts
CHANGED
|
@@ -481,6 +481,7 @@ interface IGerarBoletoSicoob {
|
|
|
481
481
|
interface IDadosBancario$1 {
|
|
482
482
|
agencia: string;
|
|
483
483
|
codigo_cliente: string;
|
|
484
|
+
codigo_cliente_dv: string;
|
|
484
485
|
modalidade: string;
|
|
485
486
|
}
|
|
486
487
|
interface IParcela$1 {
|
|
@@ -488,8 +489,6 @@ interface IParcela$1 {
|
|
|
488
489
|
parcela: number;
|
|
489
490
|
vencimento: string | Date;
|
|
490
491
|
valor: number | string;
|
|
491
|
-
pago: number | string;
|
|
492
|
-
data_emissao: string | Date;
|
|
493
492
|
}
|
|
494
493
|
interface IGerarPDFSicoob {
|
|
495
494
|
banco: Banco.SICOOB;
|
|
@@ -505,6 +504,10 @@ interface IDadosPDF$1 {
|
|
|
505
504
|
agencia: string;
|
|
506
505
|
codigo_cliente: string;
|
|
507
506
|
carteira: string;
|
|
507
|
+
juros: number;
|
|
508
|
+
multa: number;
|
|
509
|
+
desconto: number;
|
|
510
|
+
protesto: number;
|
|
508
511
|
};
|
|
509
512
|
};
|
|
510
513
|
pagador: {
|
|
@@ -535,7 +538,6 @@ interface IDadosPDF$1 {
|
|
|
535
538
|
numeroDocumento: string;
|
|
536
539
|
nossoNumero: string;
|
|
537
540
|
especieDocumento: string;
|
|
538
|
-
aceite: 'S' | 'N';
|
|
539
541
|
moeda: string;
|
|
540
542
|
usoDoBanco?: string;
|
|
541
543
|
codigoBarra: string;
|
|
@@ -545,7 +547,9 @@ interface IDadosPDF$1 {
|
|
|
545
547
|
instrucao1?: string;
|
|
546
548
|
instrucao2?: string;
|
|
547
549
|
instrucao3?: string;
|
|
548
|
-
|
|
550
|
+
instrucao4?: string;
|
|
551
|
+
observacoes?: string[];
|
|
552
|
+
nfs: string;
|
|
549
553
|
};
|
|
550
554
|
}
|
|
551
555
|
interface IGerarRemessaSicoob {
|
|
@@ -562,15 +566,17 @@ interface IDadosRemessa$1 {
|
|
|
562
566
|
dadosBancario: {
|
|
563
567
|
carteira: string;
|
|
564
568
|
agencia: string;
|
|
569
|
+
agenciaDigito: string;
|
|
565
570
|
conta: string;
|
|
571
|
+
contaDigito: string;
|
|
566
572
|
numeroRemessa: string;
|
|
567
573
|
jurosMes: number;
|
|
568
574
|
multaAtraso: number;
|
|
569
575
|
diasProtesto: number;
|
|
570
576
|
modalidade: string;
|
|
571
|
-
aceite: string;
|
|
572
577
|
};
|
|
573
578
|
boletos: {
|
|
579
|
+
identificacaoTitulo: string;
|
|
574
580
|
vencimento: string | Date;
|
|
575
581
|
valor: number | string;
|
|
576
582
|
nossoNumero: string;
|
package/build/index.d.ts
CHANGED
|
@@ -481,6 +481,7 @@ interface IGerarBoletoSicoob {
|
|
|
481
481
|
interface IDadosBancario$1 {
|
|
482
482
|
agencia: string;
|
|
483
483
|
codigo_cliente: string;
|
|
484
|
+
codigo_cliente_dv: string;
|
|
484
485
|
modalidade: string;
|
|
485
486
|
}
|
|
486
487
|
interface IParcela$1 {
|
|
@@ -488,8 +489,6 @@ interface IParcela$1 {
|
|
|
488
489
|
parcela: number;
|
|
489
490
|
vencimento: string | Date;
|
|
490
491
|
valor: number | string;
|
|
491
|
-
pago: number | string;
|
|
492
|
-
data_emissao: string | Date;
|
|
493
492
|
}
|
|
494
493
|
interface IGerarPDFSicoob {
|
|
495
494
|
banco: Banco.SICOOB;
|
|
@@ -505,6 +504,10 @@ interface IDadosPDF$1 {
|
|
|
505
504
|
agencia: string;
|
|
506
505
|
codigo_cliente: string;
|
|
507
506
|
carteira: string;
|
|
507
|
+
juros: number;
|
|
508
|
+
multa: number;
|
|
509
|
+
desconto: number;
|
|
510
|
+
protesto: number;
|
|
508
511
|
};
|
|
509
512
|
};
|
|
510
513
|
pagador: {
|
|
@@ -535,7 +538,6 @@ interface IDadosPDF$1 {
|
|
|
535
538
|
numeroDocumento: string;
|
|
536
539
|
nossoNumero: string;
|
|
537
540
|
especieDocumento: string;
|
|
538
|
-
aceite: 'S' | 'N';
|
|
539
541
|
moeda: string;
|
|
540
542
|
usoDoBanco?: string;
|
|
541
543
|
codigoBarra: string;
|
|
@@ -545,7 +547,9 @@ interface IDadosPDF$1 {
|
|
|
545
547
|
instrucao1?: string;
|
|
546
548
|
instrucao2?: string;
|
|
547
549
|
instrucao3?: string;
|
|
548
|
-
|
|
550
|
+
instrucao4?: string;
|
|
551
|
+
observacoes?: string[];
|
|
552
|
+
nfs: string;
|
|
549
553
|
};
|
|
550
554
|
}
|
|
551
555
|
interface IGerarRemessaSicoob {
|
|
@@ -562,15 +566,17 @@ interface IDadosRemessa$1 {
|
|
|
562
566
|
dadosBancario: {
|
|
563
567
|
carteira: string;
|
|
564
568
|
agencia: string;
|
|
569
|
+
agenciaDigito: string;
|
|
565
570
|
conta: string;
|
|
571
|
+
contaDigito: string;
|
|
566
572
|
numeroRemessa: string;
|
|
567
573
|
jurosMes: number;
|
|
568
574
|
multaAtraso: number;
|
|
569
575
|
diasProtesto: number;
|
|
570
576
|
modalidade: string;
|
|
571
|
-
aceite: string;
|
|
572
577
|
};
|
|
573
578
|
boletos: {
|
|
579
|
+
identificacaoTitulo: string;
|
|
574
580
|
vencimento: string | Date;
|
|
575
581
|
valor: number | string;
|
|
576
582
|
nossoNumero: string;
|
package/build/index.js
CHANGED
|
@@ -1536,13 +1536,14 @@ function gerarDadosBoleto4({ dados }) {
|
|
|
1536
1536
|
bancario.modalidade = "01";
|
|
1537
1537
|
}
|
|
1538
1538
|
bancario.modalidade = padLeft(bancario.modalidade, 2);
|
|
1539
|
-
const
|
|
1539
|
+
const codigo_cliente = `${bancario.codigo_cliente}${bancario.codigo_cliente_dv}`;
|
|
1540
|
+
const nossoNumero = getNossoNumero2(bancario.agencia, codigo_cliente, String(parcela.id_boleto));
|
|
1540
1541
|
const fatorVencimento = getFatorVencimento(parcela.vencimento);
|
|
1541
1542
|
const valor = getValor4(Number(parcela.valor));
|
|
1542
|
-
const campoLivre = "1" +
|
|
1543
|
+
const campoLivre = "1" + bancario.agencia + bancario.modalidade + codigo_cliente + nossoNumero + padLeft(parcela.parcela, 3);
|
|
1543
1544
|
const digitoGeral = getDigitoGeral4(`7569${fatorVencimento}${valor}${campoLivre}`);
|
|
1544
1545
|
const codigoBarra2 = `7569${digitoGeral}${fatorVencimento}${valor}${campoLivre}`;
|
|
1545
|
-
const campo1 = copy(codigoBarra2, 1, 4) + copy(codigoBarra2, 20, 24);
|
|
1546
|
+
const campo1 = copy(codigoBarra2, 1, 3) + copy(codigoBarra2, 4, 4) + copy(codigoBarra2, 20, 24);
|
|
1546
1547
|
const campo2 = copy(codigoBarra2, 25, 34);
|
|
1547
1548
|
const campo3 = copy(codigoBarra2, 35, 44);
|
|
1548
1549
|
const campo4 = copy(codigoBarra2, 5, 5);
|
|
@@ -1566,15 +1567,24 @@ function gerarDadosBoleto4({ dados }) {
|
|
|
1566
1567
|
return null;
|
|
1567
1568
|
}
|
|
1568
1569
|
}
|
|
1569
|
-
function getNossoNumero2(
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1570
|
+
function getNossoNumero2(agencia, codigo_cliente, id_boleto) {
|
|
1571
|
+
codigo_cliente = codigo_cliente.padStart(10, "0");
|
|
1572
|
+
id_boleto = id_boleto.padStart(7, "0");
|
|
1573
|
+
const aux = `${agencia}${codigo_cliente}${id_boleto}`;
|
|
1574
|
+
let i = 22, m = 3, soma = 0;
|
|
1575
|
+
while (true) {
|
|
1576
|
+
i--;
|
|
1577
|
+
soma += m * Number(copy(aux, i, i));
|
|
1578
|
+
if (i === 1)
|
|
1579
|
+
break;
|
|
1580
|
+
if (m === 3)
|
|
1581
|
+
m = 7;
|
|
1582
|
+
if (m === 7)
|
|
1583
|
+
m = 9;
|
|
1584
|
+
if (m === 9)
|
|
1585
|
+
m = 1;
|
|
1586
|
+
if (m === 1)
|
|
1587
|
+
m = 3;
|
|
1578
1588
|
}
|
|
1579
1589
|
let dig = soma % 11;
|
|
1580
1590
|
dig = dig === 1 ? dig = 0 : 11 - dig;
|
|
@@ -1645,10 +1655,12 @@ function gerarRemessa4({ dados }) {
|
|
|
1645
1655
|
arquivo.add("2");
|
|
1646
1656
|
arquivo.add(beneficiario.cnpj);
|
|
1647
1657
|
arquivo.add(" ".padEnd(20, " "));
|
|
1648
|
-
arquivo.add(dadosBancario.agencia.padStart(
|
|
1649
|
-
arquivo.add(dadosBancario.
|
|
1658
|
+
arquivo.add(dadosBancario.agencia.padStart(5, "0"));
|
|
1659
|
+
arquivo.add(dadosBancario.agenciaDigito);
|
|
1660
|
+
arquivo.add(dadosBancario.conta.padStart(12, "0"));
|
|
1661
|
+
arquivo.add(dadosBancario.contaDigito);
|
|
1650
1662
|
arquivo.add("0");
|
|
1651
|
-
arquivo.add(beneficiario.nome.padEnd(30, " "));
|
|
1663
|
+
arquivo.add(removerAcentos(beneficiario.nome).substring(0, 30).padEnd(30, " "));
|
|
1652
1664
|
arquivo.add("SICOOB".padEnd(30, " "));
|
|
1653
1665
|
arquivo.add(" ".padEnd(10, " "));
|
|
1654
1666
|
arquivo.add("1");
|
|
@@ -1670,10 +1682,12 @@ function gerarRemessa4({ dados }) {
|
|
|
1670
1682
|
arquivo.add("2");
|
|
1671
1683
|
arquivo.add(beneficiario.cnpj.padStart(15, "0"));
|
|
1672
1684
|
arquivo.add(" ".padEnd(20, " "));
|
|
1673
|
-
arquivo.add(dadosBancario.agencia.padStart(
|
|
1674
|
-
arquivo.add(dadosBancario.
|
|
1685
|
+
arquivo.add(dadosBancario.agencia.padStart(5, "0"));
|
|
1686
|
+
arquivo.add(dadosBancario.agenciaDigito);
|
|
1687
|
+
arquivo.add(dadosBancario.conta.padStart(12, "0"));
|
|
1688
|
+
arquivo.add(dadosBancario.contaDigito);
|
|
1675
1689
|
arquivo.add(" ");
|
|
1676
|
-
arquivo.add(beneficiario.nome.padEnd(30, " "));
|
|
1690
|
+
arquivo.add(removerAcentos(beneficiario.nome).substring(0, 30).padEnd(30, " "));
|
|
1677
1691
|
arquivo.add(" ".padEnd(80, " "));
|
|
1678
1692
|
arquivo.add(dadosBancario.numeroRemessa.padStart(8, "0"));
|
|
1679
1693
|
arquivo.add(data);
|
|
@@ -1688,21 +1702,19 @@ function gerarRemessa4({ dados }) {
|
|
|
1688
1702
|
const vencimento = (0, import_date_fns5.format)(new Date(boleto.vencimento), "ddMMyyyy");
|
|
1689
1703
|
const valor_juros_dia = Number(boleto.valor) * dadosBancario.jurosMes / 100 / 30;
|
|
1690
1704
|
const protesto = dadosBancario.diasProtesto > 0 ? "1" : "3";
|
|
1691
|
-
const diasProtesto =
|
|
1692
|
-
if (dadosBancario.aceite === "S") {
|
|
1693
|
-
dadosBancario.aceite = "A";
|
|
1694
|
-
}
|
|
1705
|
+
const diasProtesto = dadosBancario.diasProtesto.toString().padStart(2, "0");
|
|
1695
1706
|
total += Number(boleto.valor);
|
|
1696
|
-
sequencia++;
|
|
1697
1707
|
arquivo.add("756");
|
|
1698
1708
|
arquivo.add("0001");
|
|
1699
1709
|
arquivo.add("3");
|
|
1700
|
-
arquivo.add(sequencia.toString().padStart(5, "0"));
|
|
1710
|
+
arquivo.add((++sequencia).toString().padStart(5, "0"));
|
|
1701
1711
|
arquivo.add("P");
|
|
1702
1712
|
arquivo.add(" ");
|
|
1703
1713
|
arquivo.add("01");
|
|
1704
|
-
arquivo.add(dadosBancario.agencia.padStart(
|
|
1705
|
-
arquivo.add(dadosBancario.
|
|
1714
|
+
arquivo.add(dadosBancario.agencia.padStart(5, "0"));
|
|
1715
|
+
arquivo.add(dadosBancario.agenciaDigito);
|
|
1716
|
+
arquivo.add(dadosBancario.conta.padStart(12, "0"));
|
|
1717
|
+
arquivo.add(dadosBancario.contaDigito);
|
|
1706
1718
|
arquivo.add(" ");
|
|
1707
1719
|
arquivo.add(boleto.nossoNumero.padStart(10, "0"));
|
|
1708
1720
|
arquivo.add(boleto.parcela.toString().padStart(2, "0"));
|
|
@@ -1717,7 +1729,7 @@ function gerarRemessa4({ dados }) {
|
|
|
1717
1729
|
arquivo.add("00000");
|
|
1718
1730
|
arquivo.add(" ");
|
|
1719
1731
|
arquivo.add("02");
|
|
1720
|
-
arquivo.add(
|
|
1732
|
+
arquivo.add("N");
|
|
1721
1733
|
arquivo.add(data);
|
|
1722
1734
|
arquivo.add("1");
|
|
1723
1735
|
arquivo.add((0, import_date_fns5.format)((0, import_date_fns5.addDays)(new Date(boleto.vencimento), 1), "ddMMyyyy"));
|
|
@@ -1727,15 +1739,14 @@ function gerarRemessa4({ dados }) {
|
|
|
1727
1739
|
arquivo.add("000000000000000");
|
|
1728
1740
|
arquivo.add("000000000000000");
|
|
1729
1741
|
arquivo.add("000000000000000");
|
|
1730
|
-
arquivo.add(
|
|
1742
|
+
arquivo.add(boleto.identificacaoTitulo.padEnd(25, " "));
|
|
1731
1743
|
arquivo.add(protesto);
|
|
1732
|
-
arquivo.add(diasProtesto
|
|
1744
|
+
arquivo.add(diasProtesto);
|
|
1733
1745
|
arquivo.add("0");
|
|
1734
1746
|
arquivo.add(" ");
|
|
1735
1747
|
arquivo.add("09");
|
|
1736
1748
|
arquivo.add("0000000000");
|
|
1737
1749
|
arquivo.add(" ");
|
|
1738
|
-
sequencia++;
|
|
1739
1750
|
arquivo.addLine();
|
|
1740
1751
|
let tipoInscricao = "1";
|
|
1741
1752
|
if (pagador.pessoa === "F") {
|
|
@@ -1743,26 +1754,18 @@ function gerarRemessa4({ dados }) {
|
|
|
1743
1754
|
} else {
|
|
1744
1755
|
tipoInscricao = "2";
|
|
1745
1756
|
}
|
|
1746
|
-
pagador.endereco.
|
|
1747
|
-
pagador.endereco.logradouro = pagador.endereco.logradouro.toUpperCase();
|
|
1748
|
-
pagador.endereco.municipio = pagador.endereco.municipio.toUpperCase();
|
|
1749
|
-
pagador.endereco.uf = pagador.endereco.uf.toUpperCase();
|
|
1750
|
-
const { tipo_logradouro, logradouro } = getLogradouro(pagador.endereco.logradouro);
|
|
1757
|
+
pagador.endereco.logradouro = `${removerAcentos(pagador.endereco.logradouro).substring(0, 32).padEnd(32, " ")}${pagador.endereco.numero.padEnd(8, " ")}`;
|
|
1751
1758
|
arquivo.add("756");
|
|
1752
1759
|
arquivo.add("0001");
|
|
1753
1760
|
arquivo.add("3");
|
|
1754
|
-
arquivo.add(sequencia.toString().padStart(5, "0"));
|
|
1761
|
+
arquivo.add((++sequencia).toString().padStart(5, "0"));
|
|
1755
1762
|
arquivo.add("Q");
|
|
1756
1763
|
arquivo.add(" ");
|
|
1757
1764
|
arquivo.add("01");
|
|
1758
1765
|
arquivo.add(tipoInscricao);
|
|
1759
1766
|
arquivo.add(pagador.cpfCnpj.padStart(15, "0"));
|
|
1760
|
-
arquivo.add(removerAcentos(pagador.nome
|
|
1761
|
-
arquivo.add(removerAcentos(
|
|
1762
|
-
arquivo.add(" ");
|
|
1763
|
-
arquivo.add(removerAcentos(logradouro).substring(0, 29).padEnd(29, " "));
|
|
1764
|
-
arquivo.add(" ");
|
|
1765
|
-
arquivo.add(pagador.endereco.numero.padEnd(6, " "));
|
|
1767
|
+
arquivo.add(removerAcentos(pagador.nome).substring(0, 40).padEnd(40, " "));
|
|
1768
|
+
arquivo.add(removerAcentos(pagador.endereco.logradouro).substring(0, 40).padEnd(40, " "));
|
|
1766
1769
|
arquivo.add(removerAcentos(pagador.endereco.bairro).substring(0, 15).padEnd(15, " "));
|
|
1767
1770
|
arquivo.add(pagador.endereco.cep.padEnd(8, " "));
|
|
1768
1771
|
arquivo.add(removerAcentos(pagador.endereco.municipio).substring(0, 15).padEnd(15, " "));
|
|
@@ -1772,22 +1775,21 @@ function gerarRemessa4({ dados }) {
|
|
|
1772
1775
|
arquivo.add(" ".padEnd(40, " "));
|
|
1773
1776
|
arquivo.add("000");
|
|
1774
1777
|
arquivo.add(" ".padEnd(28, " "));
|
|
1775
|
-
sequencia++;
|
|
1776
1778
|
arquivo.addLine();
|
|
1777
1779
|
let multa = "0";
|
|
1778
1780
|
let data_multa = "00000000";
|
|
1779
|
-
let
|
|
1781
|
+
let valor_multa = "000000000000000";
|
|
1780
1782
|
dadosBancario.multaAtraso = Number(dadosBancario.multaAtraso || 0);
|
|
1781
1783
|
if (dadosBancario.multaAtraso > 0) {
|
|
1782
1784
|
multa = "2";
|
|
1783
1785
|
data_multa = (0, import_date_fns5.format)((0, import_date_fns5.addDays)(new Date(boleto.vencimento), 1), "ddMMyyyy");
|
|
1784
|
-
|
|
1786
|
+
valor_multa = dadosBancario.multaAtraso.toFixed(2).replace(".", "").padStart(15, "0");
|
|
1785
1787
|
}
|
|
1786
1788
|
arquivo.add("756");
|
|
1787
1789
|
arquivo.add("0001");
|
|
1788
1790
|
arquivo.add("3");
|
|
1789
1791
|
arquivo.add("");
|
|
1790
|
-
arquivo.add(sequencia.toString().padStart(5, "0"));
|
|
1792
|
+
arquivo.add((++sequencia).toString().padStart(5, "0"));
|
|
1791
1793
|
arquivo.add("R");
|
|
1792
1794
|
arquivo.add(" ");
|
|
1793
1795
|
arquivo.add("01");
|
|
@@ -1799,7 +1801,7 @@ function gerarRemessa4({ dados }) {
|
|
|
1799
1801
|
arquivo.add("000000000000000");
|
|
1800
1802
|
arquivo.add(multa);
|
|
1801
1803
|
arquivo.add(data_multa);
|
|
1802
|
-
arquivo.add(
|
|
1804
|
+
arquivo.add(valor_multa);
|
|
1803
1805
|
arquivo.add(" ".padEnd(10, " "));
|
|
1804
1806
|
arquivo.add(" ".padEnd(40, " "));
|
|
1805
1807
|
arquivo.add(" ".padEnd(40, " "));
|
|
@@ -1843,47 +1845,6 @@ function gerarRemessa4({ dados }) {
|
|
|
1843
1845
|
return null;
|
|
1844
1846
|
}
|
|
1845
1847
|
}
|
|
1846
|
-
function getLogradouro(logradouro) {
|
|
1847
|
-
const logradouro_split = logradouro.split(" ");
|
|
1848
|
-
let tipo_logradouro = "RUA";
|
|
1849
|
-
if (/^R(\.|UA)?\b/i.test(logradouro_split[0])) {
|
|
1850
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1851
|
-
} else if (/^AV(\.|ENIDA)?\b/i.test(logradouro_split[0])) {
|
|
1852
|
-
tipo_logradouro = "AV";
|
|
1853
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1854
|
-
} else if (/^SERVIDAO\b/i.test(logradouro_split[0])) {
|
|
1855
|
-
tipo_logradouro = "SEV";
|
|
1856
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1857
|
-
} else if (/^SEV(\.)?\b/i.test(logradouro_split[0])) {
|
|
1858
|
-
tipo_logradouro = "SEV";
|
|
1859
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1860
|
-
} else if (/^ROD(\.|OVIA)?\b/i.test(logradouro_split[0])) {
|
|
1861
|
-
tipo_logradouro = "ROD";
|
|
1862
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1863
|
-
} else if (/^FAZ(\.|ENDA)?\b/i.test(logradouro_split[0])) {
|
|
1864
|
-
tipo_logradouro = "FAZ";
|
|
1865
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1866
|
-
} else if (/^EST(\.|RADA)?\b/i.test(logradouro_split[0])) {
|
|
1867
|
-
tipo_logradouro = "EST";
|
|
1868
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1869
|
-
} else if (/^ALA(\.|MEDA)?\b/i.test(logradouro_split[0])) {
|
|
1870
|
-
tipo_logradouro = "ALA";
|
|
1871
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1872
|
-
} else if (/^ENC(\.|RUZILHADA)?\b/i.test(logradouro_split[0])) {
|
|
1873
|
-
tipo_logradouro = "ENC";
|
|
1874
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1875
|
-
} else if (/^PR(\.|ACA)?\b/i.test(logradouro_split[0])) {
|
|
1876
|
-
tipo_logradouro = "PR";
|
|
1877
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1878
|
-
} else if (/^TRAVESSA\b/i.test(logradouro_split[0])) {
|
|
1879
|
-
tipo_logradouro = "TV";
|
|
1880
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1881
|
-
} else if (/^TV(\.)?\b/i.test(logradouro_split[0])) {
|
|
1882
|
-
tipo_logradouro = "TV";
|
|
1883
|
-
logradouro = logradouro_split.slice(1).join(" ");
|
|
1884
|
-
}
|
|
1885
|
-
return { tipo_logradouro, logradouro };
|
|
1886
|
-
}
|
|
1887
1848
|
|
|
1888
1849
|
// src/banks/sicoob/gerarPDF.ts
|
|
1889
1850
|
var import_bwip_js4 = __toESM(require("bwip-js"));
|
|
@@ -1897,14 +1858,11 @@ function gerarPDF4(_0) {
|
|
|
1897
1858
|
text: dadosPDF.boleto.codigoBarra,
|
|
1898
1859
|
height: 20
|
|
1899
1860
|
});
|
|
1900
|
-
dadosPDF.boleto.numeroDocumento = formatNumeroDocumento(
|
|
1901
|
-
dadosPDF.boleto.numeroDocumento,
|
|
1902
|
-
dadosPDF.boleto.parcela
|
|
1903
|
-
);
|
|
1904
1861
|
dadosPDF.beneficiario.dadosBancario.agencia = formatAgenciaCodigoCedente(
|
|
1905
1862
|
dadosPDF.beneficiario.dadosBancario.agencia,
|
|
1906
1863
|
dadosPDF.beneficiario.dadosBancario.codigo_cliente
|
|
1907
1864
|
);
|
|
1865
|
+
dadosPDF.beneficiario.dadosBancario.carteira = dadosPDF.beneficiario.dadosBancario.carteira.padStart(2, "0");
|
|
1908
1866
|
dadosPDF.boleto.nossoNumero = formatNossoNumero(
|
|
1909
1867
|
dadosPDF.boleto.parcela,
|
|
1910
1868
|
dadosPDF.boleto.nossoNumero
|
|
@@ -1925,6 +1883,7 @@ function gerarPDF4(_0) {
|
|
|
1925
1883
|
dadosPDF.boleto.valorDescontoAbatimento = maskFormat_default.numberToReal(
|
|
1926
1884
|
dadosPDF.boleto.valorDescontoAbatimento
|
|
1927
1885
|
);
|
|
1886
|
+
const valorDocumento = Number(dadosPDF.boleto.valorDocumento);
|
|
1928
1887
|
dadosPDF.boleto.valorDocumento = maskFormat_default.numberToReal(
|
|
1929
1888
|
dadosPDF.boleto.valorDocumento
|
|
1930
1889
|
);
|
|
@@ -1935,6 +1894,23 @@ function gerarPDF4(_0) {
|
|
|
1935
1894
|
if (dadosPDF.boleto.quantidade) {
|
|
1936
1895
|
dadosPDF.boleto.quantidade = maskFormat_default.numberToReal(dadosPDF.boleto.quantidade);
|
|
1937
1896
|
}
|
|
1897
|
+
const jurosMes = dadosPDF.beneficiario.dadosBancario.juros;
|
|
1898
|
+
const jurosDia = jurosMes / 100 / 30 * valorDocumento;
|
|
1899
|
+
if (jurosDia > 0) {
|
|
1900
|
+
dadosPDF.boleto.instrucao1 = `COBRAR JUROS DE R$${maskFormat_default.numberToReal(jurosDia)} AO DIA, AP\xD3S O VENCIMENTO`;
|
|
1901
|
+
}
|
|
1902
|
+
const descontoVencimento = dadosPDF.beneficiario.dadosBancario.desconto || 0;
|
|
1903
|
+
if (descontoVencimento > 0) {
|
|
1904
|
+
dadosPDF.boleto.instrucao2 = `AT\xC9 O VENCIMENTO, CONCEDER DESCONTO DE ${descontoVencimento}%`;
|
|
1905
|
+
}
|
|
1906
|
+
const multaAtraso = dadosPDF.beneficiario.dadosBancario.multa || 0;
|
|
1907
|
+
if (multaAtraso > 0) {
|
|
1908
|
+
dadosPDF.boleto.instrucao3 = `MULTA DE ${multaAtraso}%`;
|
|
1909
|
+
}
|
|
1910
|
+
const protestoDias = dadosPDF.beneficiario.dadosBancario.protesto || 0;
|
|
1911
|
+
if (protestoDias > 0) {
|
|
1912
|
+
dadosPDF.boleto.instrucao4 = `PROTESTAR AP\xD3S ${protestoDias} DIAS CORRIDOS DO VENCIMENTO`;
|
|
1913
|
+
}
|
|
1938
1914
|
dadosPDF.boleto.valor = maskFormat_default.numberToReal(dadosPDF.boleto.valor);
|
|
1939
1915
|
const content = compileHbs(getPathTemplates("sicoob-boleto.hbs"), dadosPDF);
|
|
1940
1916
|
const config = {
|
|
@@ -1975,21 +1951,75 @@ function formatAgenciaCodigoCedente(agencia, conta) {
|
|
|
1975
1951
|
function formatNossoNumero(parcela, nossoNumero) {
|
|
1976
1952
|
parcela = String(parcela).padStart(2, "0");
|
|
1977
1953
|
nossoNumero = nossoNumero.padStart(8, "0");
|
|
1978
|
-
|
|
1979
|
-
return nossoNumeroFmt.apply(parcela + nossoNumero);
|
|
1954
|
+
return `${parcela}/${nossoNumero.slice(0, 7)}-${nossoNumero.slice(7, 8)}`;
|
|
1980
1955
|
}
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1956
|
+
|
|
1957
|
+
// src/banks/sicoob/gerarRetorno.ts
|
|
1958
|
+
function gerarRetorno4({ dados }) {
|
|
1959
|
+
try {
|
|
1960
|
+
const { arquivo } = dados;
|
|
1961
|
+
const documentos = [];
|
|
1962
|
+
for (let i = 0; i < arquivo.length; i++) {
|
|
1963
|
+
let linha = arquivo[i];
|
|
1964
|
+
const banco = linha.substring(0, 3);
|
|
1965
|
+
if (banco !== "756" /* SICOOB */) {
|
|
1966
|
+
continue;
|
|
1967
|
+
}
|
|
1968
|
+
const ocorrencia = linha.substring(15, 17);
|
|
1969
|
+
if (ocorrencia !== "06" && ocorrencia !== "17") {
|
|
1970
|
+
continue;
|
|
1971
|
+
}
|
|
1972
|
+
let segmento = linha.substring(13, 14);
|
|
1973
|
+
if (segmento === "T") {
|
|
1974
|
+
const meu_numero = linha.substring(105, 130).trimEnd();
|
|
1975
|
+
let tipo_documento = "INDEFINIDO";
|
|
1976
|
+
let id_documento = meu_numero;
|
|
1977
|
+
if (meu_numero.includes("-")) {
|
|
1978
|
+
const [tipo, id] = meu_numero.split("-");
|
|
1979
|
+
tipo_documento = tipo;
|
|
1980
|
+
id_documento = id;
|
|
1981
|
+
}
|
|
1982
|
+
const especie = tipo_documento.length ? tipo_documento : "INDEFINIDO";
|
|
1983
|
+
linha = arquivo[++i];
|
|
1984
|
+
segmento = linha.substring(13, 14);
|
|
1985
|
+
if (segmento === "U") {
|
|
1986
|
+
const valorAbatimentoString = linha.substring(47, 62);
|
|
1987
|
+
const valorAbatimento = Number(valorAbatimentoString) / 100;
|
|
1988
|
+
const valorDescontoString = linha.substring(32, 47);
|
|
1989
|
+
const valorDesconto = Number(valorDescontoString) / 100;
|
|
1990
|
+
const valorPagoString = linha.substring(77, 92);
|
|
1991
|
+
const valorPago = Number(valorPagoString) / 100;
|
|
1992
|
+
const valorJurosString = linha.substring(17, 32);
|
|
1993
|
+
const valorJuros = Number(valorJurosString) / 100;
|
|
1994
|
+
const valorMulta = 0;
|
|
1995
|
+
const descontos = valorAbatimento + valorDesconto;
|
|
1996
|
+
const valorTotal = valorPago - valorJuros + descontos;
|
|
1997
|
+
const documento = {
|
|
1998
|
+
id_documento,
|
|
1999
|
+
especie,
|
|
2000
|
+
valor: valorPago,
|
|
2001
|
+
valor_multa: valorMulta,
|
|
2002
|
+
valor_juros: valorJuros,
|
|
2003
|
+
valor_desconto: valorDesconto,
|
|
2004
|
+
valor_total: valorTotal
|
|
2005
|
+
};
|
|
2006
|
+
documentos.push(documento);
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
return documentos;
|
|
2011
|
+
} catch (error) {
|
|
2012
|
+
console.log(error);
|
|
2013
|
+
return null;
|
|
2014
|
+
}
|
|
1986
2015
|
}
|
|
1987
2016
|
|
|
1988
2017
|
// src/banks/sicoob/index.ts
|
|
1989
2018
|
var sicoob = {
|
|
1990
2019
|
gerarDadosBoleto: gerarDadosBoleto4,
|
|
1991
2020
|
gerarRemessa: gerarRemessa4,
|
|
1992
|
-
gerarPDF: gerarPDF4
|
|
2021
|
+
gerarPDF: gerarPDF4,
|
|
2022
|
+
gerarRetorno: gerarRetorno4
|
|
1993
2023
|
};
|
|
1994
2024
|
|
|
1995
2025
|
// src/banks/banco-brasil/gerarDadosBoleto.ts
|
|
@@ -2449,7 +2479,7 @@ function gerarRemessa5({ dados }) {
|
|
|
2449
2479
|
}
|
|
2450
2480
|
|
|
2451
2481
|
// src/banks/banco-brasil/gerarRetorno.ts
|
|
2452
|
-
function
|
|
2482
|
+
function gerarRetorno5({ dados }) {
|
|
2453
2483
|
try {
|
|
2454
2484
|
const { arquivo } = dados;
|
|
2455
2485
|
const documentos = [];
|
|
@@ -2513,7 +2543,7 @@ var bancoBrasil = {
|
|
|
2513
2543
|
gerarDadosBoleto: gerarDadosBoleto5,
|
|
2514
2544
|
gerarPDF: gerarPDF5,
|
|
2515
2545
|
gerarRemessa: gerarRemessa5,
|
|
2516
|
-
gerarRetorno:
|
|
2546
|
+
gerarRetorno: gerarRetorno5
|
|
2517
2547
|
};
|
|
2518
2548
|
|
|
2519
2549
|
// src/gerar.ts
|
|
@@ -2587,6 +2617,9 @@ function retorno({ banco, dados }) {
|
|
|
2587
2617
|
if (banco === "001" /* BANCO_BRASIL */) {
|
|
2588
2618
|
return bancoBrasil.gerarRetorno({ banco, dados });
|
|
2589
2619
|
}
|
|
2620
|
+
if (banco === "756" /* SICOOB */) {
|
|
2621
|
+
return sicoob.gerarRetorno({ banco, dados });
|
|
2622
|
+
}
|
|
2590
2623
|
}
|
|
2591
2624
|
|
|
2592
2625
|
// src/config/index.ts
|