@plasoft/boletos 1.0.50 → 1.0.52
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 +4 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +117 -40
- package/build/index.js.map +1 -1
- package/build/index.mjs +117 -40
- package/build/index.mjs.map +1 -1
- package/build/teste.html +329 -329
- package/package.json +1 -1
package/build/index.d.mts
CHANGED
|
@@ -125,6 +125,7 @@ interface IDadosRemessa$4 {
|
|
|
125
125
|
jurosMes: number;
|
|
126
126
|
multaAtraso: number;
|
|
127
127
|
descontoPagamento: number;
|
|
128
|
+
tipo_protesto: 'Nenhum' | 'Protestar' | 'Negativar';
|
|
128
129
|
diasProtesto: number;
|
|
129
130
|
};
|
|
130
131
|
boletos: {
|
|
@@ -440,6 +441,7 @@ interface IDadosRemessa$2 {
|
|
|
440
441
|
jurosMes: number;
|
|
441
442
|
multaAtraso: number;
|
|
442
443
|
descontoPagamento: number;
|
|
444
|
+
tipo_protesto: 'Nenhum' | 'Protestar' | 'Negativar';
|
|
443
445
|
diasProtesto: number;
|
|
444
446
|
};
|
|
445
447
|
boletos: {
|
|
@@ -575,6 +577,7 @@ interface IDadosRemessa$1 {
|
|
|
575
577
|
numeroRemessa: string;
|
|
576
578
|
jurosMes: number;
|
|
577
579
|
multaAtraso: number;
|
|
580
|
+
tipo_protesto: 'Nenhum' | 'Protestar' | 'Negativar';
|
|
578
581
|
diasProtesto: number;
|
|
579
582
|
modalidade: string;
|
|
580
583
|
};
|
|
@@ -732,6 +735,7 @@ interface IDadosRemessa {
|
|
|
732
735
|
jurosMes: number;
|
|
733
736
|
multaAtraso: number;
|
|
734
737
|
descontoPagamento: number;
|
|
738
|
+
tipo_protesto: 'Nenhum' | 'Protestar' | 'Negativar';
|
|
735
739
|
diasProtesto: number;
|
|
736
740
|
};
|
|
737
741
|
boletos: {
|
package/build/index.d.ts
CHANGED
|
@@ -125,6 +125,7 @@ interface IDadosRemessa$4 {
|
|
|
125
125
|
jurosMes: number;
|
|
126
126
|
multaAtraso: number;
|
|
127
127
|
descontoPagamento: number;
|
|
128
|
+
tipo_protesto: 'Nenhum' | 'Protestar' | 'Negativar';
|
|
128
129
|
diasProtesto: number;
|
|
129
130
|
};
|
|
130
131
|
boletos: {
|
|
@@ -440,6 +441,7 @@ interface IDadosRemessa$2 {
|
|
|
440
441
|
jurosMes: number;
|
|
441
442
|
multaAtraso: number;
|
|
442
443
|
descontoPagamento: number;
|
|
444
|
+
tipo_protesto: 'Nenhum' | 'Protestar' | 'Negativar';
|
|
443
445
|
diasProtesto: number;
|
|
444
446
|
};
|
|
445
447
|
boletos: {
|
|
@@ -575,6 +577,7 @@ interface IDadosRemessa$1 {
|
|
|
575
577
|
numeroRemessa: string;
|
|
576
578
|
jurosMes: number;
|
|
577
579
|
multaAtraso: number;
|
|
580
|
+
tipo_protesto: 'Nenhum' | 'Protestar' | 'Negativar';
|
|
578
581
|
diasProtesto: number;
|
|
579
582
|
modalidade: string;
|
|
580
583
|
};
|
|
@@ -732,6 +735,7 @@ interface IDadosRemessa {
|
|
|
732
735
|
jurosMes: number;
|
|
733
736
|
multaAtraso: number;
|
|
734
737
|
descontoPagamento: number;
|
|
738
|
+
tipo_protesto: 'Nenhum' | 'Protestar' | 'Negativar';
|
|
735
739
|
diasProtesto: number;
|
|
736
740
|
};
|
|
737
741
|
boletos: {
|
package/build/index.js
CHANGED
|
@@ -393,9 +393,25 @@ var Arquivo = class {
|
|
|
393
393
|
}
|
|
394
394
|
};
|
|
395
395
|
|
|
396
|
-
// src/utils/
|
|
397
|
-
function
|
|
398
|
-
|
|
396
|
+
// src/utils/removerCaracterEspecial.ts
|
|
397
|
+
function removerCaracterEspecial(texto) {
|
|
398
|
+
if (!texto)
|
|
399
|
+
return "";
|
|
400
|
+
let textoFormatado = texto.replace(/[`~!@#$°%^&*()_+=?;'"<>{}[\]\\]/gi, "");
|
|
401
|
+
textoFormatado = textoFormatado.replace(/[áàãâä]/g, "a");
|
|
402
|
+
textoFormatado = textoFormatado.replace(/[ÁÀÃÂÄ]/g, "A");
|
|
403
|
+
textoFormatado = textoFormatado.replace(/[éèêë]/g, "e");
|
|
404
|
+
textoFormatado = textoFormatado.replace(/[ÉÈÊË]/g, "E");
|
|
405
|
+
textoFormatado = textoFormatado.replace(/[íìîï]/g, "i");
|
|
406
|
+
textoFormatado = textoFormatado.replace(/[ÍÌÎÏ]/g, "I");
|
|
407
|
+
textoFormatado = textoFormatado.replace(/[óòõôö]/g, "o");
|
|
408
|
+
textoFormatado = textoFormatado.replace(/[ÓÒÔÕÖ]/g, "O");
|
|
409
|
+
textoFormatado = textoFormatado.replace(/[úùûü]/g, "u");
|
|
410
|
+
textoFormatado = textoFormatado.replace(/[ÚÙÛÜ]/g, "U");
|
|
411
|
+
textoFormatado = textoFormatado.replace(/ç/g, "c");
|
|
412
|
+
textoFormatado = textoFormatado.replace(/Ç/g, "C");
|
|
413
|
+
textoFormatado = textoFormatado.replace(/[^a-zA-Z0-9|/,-]/g, " ");
|
|
414
|
+
return textoFormatado;
|
|
399
415
|
}
|
|
400
416
|
|
|
401
417
|
// src/banks/ailos/gerarRemessa.ts
|
|
@@ -421,7 +437,7 @@ function gerarRemessa({ dados }) {
|
|
|
421
437
|
arquivo.add(dadosBancario.conta.padStart(12, "0"));
|
|
422
438
|
arquivo.add(dadosBancario.contaDigito);
|
|
423
439
|
arquivo.add(" ");
|
|
424
|
-
arquivo.add(
|
|
440
|
+
arquivo.add(removerCaracterEspecial(beneficiario.nome).substring(0, 30).padEnd(30, " "));
|
|
425
441
|
arquivo.add("AILOS".padEnd(30, " "));
|
|
426
442
|
arquivo.add(" ");
|
|
427
443
|
arquivo.add("1");
|
|
@@ -450,7 +466,7 @@ function gerarRemessa({ dados }) {
|
|
|
450
466
|
arquivo.add(dadosBancario.conta.padStart(12, "0"));
|
|
451
467
|
arquivo.add(dadosBancario.contaDigito);
|
|
452
468
|
arquivo.add(" ");
|
|
453
|
-
arquivo.add(
|
|
469
|
+
arquivo.add(removerCaracterEspecial(beneficiario.nome).substring(0, 30).padEnd(30, " "));
|
|
454
470
|
arquivo.add(" ".padEnd(40, " "));
|
|
455
471
|
arquivo.add(" ".padEnd(40, " "));
|
|
456
472
|
arquivo.add(dadosBancario.numeroRemessa.padStart(8, "0"));
|
|
@@ -473,10 +489,25 @@ function gerarRemessa({ dados }) {
|
|
|
473
489
|
);
|
|
474
490
|
const codigoDesconto = dadosBancario.descontoPagamento > 0 ? "2" : "0";
|
|
475
491
|
const desconto = dadosBancario.descontoPagamento > 0 ? dadosBancario.descontoPagamento.toFixed(2) : "000000000000000";
|
|
476
|
-
const protesto = dadosBancario.diasProtesto > 0 ? "1" : "3";
|
|
477
492
|
let diasProtesto = "00";
|
|
478
|
-
|
|
479
|
-
|
|
493
|
+
let protesto = "3";
|
|
494
|
+
switch (dadosBancario.tipo_protesto) {
|
|
495
|
+
case "Nenhum":
|
|
496
|
+
protesto = "3";
|
|
497
|
+
diasProtesto = "00";
|
|
498
|
+
break;
|
|
499
|
+
case "Protestar":
|
|
500
|
+
protesto = "1";
|
|
501
|
+
diasProtesto = dadosBancario.diasProtesto.toString().padStart(2, "0");
|
|
502
|
+
break;
|
|
503
|
+
case "Negativar":
|
|
504
|
+
protesto = "2";
|
|
505
|
+
diasProtesto = dadosBancario.diasProtesto.toString().padStart(2, "0");
|
|
506
|
+
break;
|
|
507
|
+
default:
|
|
508
|
+
protesto = "3";
|
|
509
|
+
diasProtesto = "00";
|
|
510
|
+
break;
|
|
480
511
|
}
|
|
481
512
|
arquivo.add("085");
|
|
482
513
|
arquivo.add("0001");
|
|
@@ -529,7 +560,7 @@ function gerarRemessa({ dados }) {
|
|
|
529
560
|
} else {
|
|
530
561
|
tipoInscricao = "2";
|
|
531
562
|
}
|
|
532
|
-
pagador.endereco.logradouro = `${
|
|
563
|
+
pagador.endereco.logradouro = `${removerCaracterEspecial(pagador.endereco.logradouro).substring(0, 32).padEnd(32, " ")}${pagador.endereco.numero.padEnd(8, " ")}`;
|
|
533
564
|
arquivo.add("085");
|
|
534
565
|
arquivo.add("0001");
|
|
535
566
|
arquivo.add("3");
|
|
@@ -539,13 +570,13 @@ function gerarRemessa({ dados }) {
|
|
|
539
570
|
arquivo.add("01");
|
|
540
571
|
arquivo.add(tipoInscricao);
|
|
541
572
|
arquivo.add(pagador.cpfCnpj.padStart(15, "0"));
|
|
542
|
-
arquivo.add(
|
|
543
|
-
arquivo.add(
|
|
544
|
-
arquivo.add(
|
|
573
|
+
arquivo.add(removerCaracterEspecial(pagador.nome).substring(0, 40).padEnd(40, " "));
|
|
574
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.logradouro).substring(0, 40).padEnd(40, " "));
|
|
575
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.bairro).substring(0, 15).padEnd(15, " "));
|
|
545
576
|
arquivo.add(pagador.endereco.cep.substring(0, 5).padStart(5, "0"));
|
|
546
577
|
arquivo.add(pagador.endereco.cep.substring(5, 7).padStart(3, "0"));
|
|
547
|
-
arquivo.add(
|
|
548
|
-
arquivo.add(
|
|
578
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.municipio).substring(0, 15).padEnd(15, " "));
|
|
579
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.uf).padEnd(2, " "));
|
|
549
580
|
arquivo.add("0");
|
|
550
581
|
arquivo.add("000000000000000");
|
|
551
582
|
arquivo.add(" ".padEnd(40, " "));
|
|
@@ -1397,8 +1428,23 @@ function gerarRemessa3({ dados }) {
|
|
|
1397
1428
|
const data = /* @__PURE__ */ new Date();
|
|
1398
1429
|
let protestar = "00";
|
|
1399
1430
|
let negativar = "0000";
|
|
1400
|
-
|
|
1401
|
-
|
|
1431
|
+
switch (dadosBancario.tipo_protesto) {
|
|
1432
|
+
case "Nenhum":
|
|
1433
|
+
protestar = "00";
|
|
1434
|
+
negativar = "0000";
|
|
1435
|
+
break;
|
|
1436
|
+
case "Protestar":
|
|
1437
|
+
protestar = "06";
|
|
1438
|
+
negativar = "0000";
|
|
1439
|
+
break;
|
|
1440
|
+
case "Negativar":
|
|
1441
|
+
protestar = "00";
|
|
1442
|
+
negativar = "06" + String(dadosBancario.diasProtesto).padStart(2, "0");
|
|
1443
|
+
break;
|
|
1444
|
+
default:
|
|
1445
|
+
protestar = "00";
|
|
1446
|
+
negativar = "0000";
|
|
1447
|
+
break;
|
|
1402
1448
|
}
|
|
1403
1449
|
arquivo.add("01REMESSA");
|
|
1404
1450
|
arquivo.add("01");
|
|
@@ -1464,8 +1510,8 @@ function gerarRemessa3({ dados }) {
|
|
|
1464
1510
|
arquivo.add(tipoInscricao);
|
|
1465
1511
|
arquivo.add("0");
|
|
1466
1512
|
arquivo.add(pagador.cpfCnpj.padStart(14, "0"));
|
|
1467
|
-
arquivo.add(
|
|
1468
|
-
arquivo.add(
|
|
1513
|
+
arquivo.add(removerCaracterEspecial(pagador.nome).substring(0, 40).padEnd(40, " "));
|
|
1514
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.logradouro).substring(0, 40).padEnd(40, " "));
|
|
1469
1515
|
arquivo.add("0".padEnd(11, "0"));
|
|
1470
1516
|
arquivo.add(" ");
|
|
1471
1517
|
arquivo.add(pagador.endereco.cep.padEnd(8, " "));
|
|
@@ -1699,7 +1745,7 @@ function gerarRemessa4({ dados }) {
|
|
|
1699
1745
|
arquivo.add(dadosBancario.conta.padStart(12, "0"));
|
|
1700
1746
|
arquivo.add(dadosBancario.contaDigito);
|
|
1701
1747
|
arquivo.add("0");
|
|
1702
|
-
arquivo.add(
|
|
1748
|
+
arquivo.add(removerCaracterEspecial(beneficiario.nome).substring(0, 30).padEnd(30, " "));
|
|
1703
1749
|
arquivo.add("SICOOB".padEnd(30, " "));
|
|
1704
1750
|
arquivo.add(" ".padEnd(10, " "));
|
|
1705
1751
|
arquivo.add("1");
|
|
@@ -1726,7 +1772,7 @@ function gerarRemessa4({ dados }) {
|
|
|
1726
1772
|
arquivo.add(dadosBancario.conta.padStart(12, "0"));
|
|
1727
1773
|
arquivo.add(dadosBancario.contaDigito);
|
|
1728
1774
|
arquivo.add(" ");
|
|
1729
|
-
arquivo.add(
|
|
1775
|
+
arquivo.add(removerCaracterEspecial(beneficiario.nome).substring(0, 30).padEnd(30, " "));
|
|
1730
1776
|
arquivo.add(" ".padEnd(80, " "));
|
|
1731
1777
|
arquivo.add(dadosBancario.numeroRemessa.padStart(8, "0"));
|
|
1732
1778
|
arquivo.add(data);
|
|
@@ -1740,7 +1786,18 @@ function gerarRemessa4({ dados }) {
|
|
|
1740
1786
|
const { pagador } = boleto;
|
|
1741
1787
|
const vencimento = (0, import_date_fns5.format)(new Date(boleto.vencimento), "ddMMyyyy");
|
|
1742
1788
|
const valor_juros_dia = Number(boleto.valor) * dadosBancario.jurosMes / 100 / 30;
|
|
1743
|
-
|
|
1789
|
+
let protesto = "3";
|
|
1790
|
+
switch (dadosBancario.tipo_protesto) {
|
|
1791
|
+
case "Nenhum":
|
|
1792
|
+
protesto = "3";
|
|
1793
|
+
break;
|
|
1794
|
+
case "Protestar":
|
|
1795
|
+
protesto = "1";
|
|
1796
|
+
break;
|
|
1797
|
+
case "Negativar":
|
|
1798
|
+
protesto = "8";
|
|
1799
|
+
break;
|
|
1800
|
+
}
|
|
1744
1801
|
const diasProtesto = dadosBancario.diasProtesto.toString().padStart(2, "0");
|
|
1745
1802
|
total += Number(boleto.valor);
|
|
1746
1803
|
arquivo.add("756");
|
|
@@ -1793,7 +1850,7 @@ function gerarRemessa4({ dados }) {
|
|
|
1793
1850
|
} else {
|
|
1794
1851
|
tipoInscricao = "2";
|
|
1795
1852
|
}
|
|
1796
|
-
pagador.endereco.logradouro = `${
|
|
1853
|
+
pagador.endereco.logradouro = `${removerCaracterEspecial(pagador.endereco.logradouro).substring(0, 32).padEnd(32, " ")}${pagador.endereco.numero.padEnd(8, " ")}`;
|
|
1797
1854
|
arquivo.add("756");
|
|
1798
1855
|
arquivo.add("0001");
|
|
1799
1856
|
arquivo.add("3");
|
|
@@ -1803,12 +1860,12 @@ function gerarRemessa4({ dados }) {
|
|
|
1803
1860
|
arquivo.add("01");
|
|
1804
1861
|
arquivo.add(tipoInscricao);
|
|
1805
1862
|
arquivo.add(pagador.cpfCnpj.padStart(15, "0"));
|
|
1806
|
-
arquivo.add(
|
|
1807
|
-
arquivo.add(
|
|
1808
|
-
arquivo.add(
|
|
1863
|
+
arquivo.add(removerCaracterEspecial(pagador.nome).substring(0, 40).padEnd(40, " "));
|
|
1864
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.logradouro).substring(0, 40).padEnd(40, " "));
|
|
1865
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.bairro).substring(0, 15).padEnd(15, " "));
|
|
1809
1866
|
arquivo.add(pagador.endereco.cep.padEnd(8, " "));
|
|
1810
|
-
arquivo.add(
|
|
1811
|
-
arquivo.add(
|
|
1867
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.municipio).substring(0, 15).padEnd(15, " "));
|
|
1868
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.uf).padEnd(2, " "));
|
|
1812
1869
|
arquivo.add("0");
|
|
1813
1870
|
arquivo.add("000000000000000");
|
|
1814
1871
|
arquivo.add(" ".padEnd(40, " "));
|
|
@@ -2314,7 +2371,7 @@ function gerarRemessa5({ dados }) {
|
|
|
2314
2371
|
arquivo.add("00000");
|
|
2315
2372
|
arquivo.add(`${dadosBancario.conta}${dadosBancario.contaDigito}`.padStart(8, "0"));
|
|
2316
2373
|
arquivo.add(" ");
|
|
2317
|
-
arquivo.add(
|
|
2374
|
+
arquivo.add(removerCaracterEspecial(beneficiario.nome).substring(0, 30).padEnd(30, " "));
|
|
2318
2375
|
arquivo.add("BANCO DO BRASIL S.A.".padEnd(30, " "));
|
|
2319
2376
|
arquivo.add(" ".padEnd(10, " "));
|
|
2320
2377
|
arquivo.add("1");
|
|
@@ -2349,7 +2406,7 @@ function gerarRemessa5({ dados }) {
|
|
|
2349
2406
|
arquivo.add("00000");
|
|
2350
2407
|
arquivo.add(`${dadosBancario.conta}${dadosBancario.contaDigito}`.padStart(8, "0"));
|
|
2351
2408
|
arquivo.add(" ");
|
|
2352
|
-
arquivo.add(
|
|
2409
|
+
arquivo.add(removerCaracterEspecial(beneficiario.nome).substring(0, 30).padEnd(30, " "));
|
|
2353
2410
|
arquivo.add(" ".padEnd(80, " "));
|
|
2354
2411
|
arquivo.add(dadosBancario.numeroRemessa.padStart(8, "0"));
|
|
2355
2412
|
arquivo.add(data);
|
|
@@ -2402,11 +2459,31 @@ function gerarRemessa5({ dados }) {
|
|
|
2402
2459
|
let diasProtesto = "00";
|
|
2403
2460
|
let baixarDevolver = "1";
|
|
2404
2461
|
let diasBaixa = "000";
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2462
|
+
switch (dadosBancario.tipo_protesto) {
|
|
2463
|
+
case "Nenhum":
|
|
2464
|
+
protesto = "3";
|
|
2465
|
+
diasProtesto = "00";
|
|
2466
|
+
baixarDevolver = "1";
|
|
2467
|
+
diasBaixa = "000";
|
|
2468
|
+
break;
|
|
2469
|
+
case "Protestar":
|
|
2470
|
+
protesto = "1";
|
|
2471
|
+
diasProtesto = dadosBancario.diasProtesto.toString().padStart(2, "0");
|
|
2472
|
+
baixarDevolver = "2";
|
|
2473
|
+
diasBaixa = "060";
|
|
2474
|
+
break;
|
|
2475
|
+
case "Negativar":
|
|
2476
|
+
protesto = "8";
|
|
2477
|
+
diasProtesto = dadosBancario.diasProtesto.toString().padStart(2, "0");
|
|
2478
|
+
baixarDevolver = "1";
|
|
2479
|
+
diasBaixa = "000";
|
|
2480
|
+
break;
|
|
2481
|
+
default:
|
|
2482
|
+
protesto = "3";
|
|
2483
|
+
diasProtesto = "00";
|
|
2484
|
+
baixarDevolver = "1";
|
|
2485
|
+
diasBaixa = "000";
|
|
2486
|
+
break;
|
|
2410
2487
|
}
|
|
2411
2488
|
arquivo.add("001");
|
|
2412
2489
|
arquivo.add("0001");
|
|
@@ -2449,7 +2526,7 @@ function gerarRemessa5({ dados }) {
|
|
|
2449
2526
|
arquivo.add("0000000000");
|
|
2450
2527
|
arquivo.add(" ");
|
|
2451
2528
|
arquivo.addLine();
|
|
2452
|
-
pagador.endereco.logradouro = `${
|
|
2529
|
+
pagador.endereco.logradouro = `${removerCaracterEspecial(pagador.endereco.logradouro).substring(0, 32).padEnd(32, " ")}${pagador.endereco.numero.padEnd(8, " ")}`;
|
|
2453
2530
|
arquivo.add("001");
|
|
2454
2531
|
arquivo.add("0001");
|
|
2455
2532
|
arquivo.add("3");
|
|
@@ -2459,12 +2536,12 @@ function gerarRemessa5({ dados }) {
|
|
|
2459
2536
|
arquivo.add("01");
|
|
2460
2537
|
arquivo.add(tipoInscricao);
|
|
2461
2538
|
arquivo.add(pagador.cpfCnpj.padStart(15, "0"));
|
|
2462
|
-
arquivo.add(
|
|
2463
|
-
arquivo.add(
|
|
2464
|
-
arquivo.add(
|
|
2539
|
+
arquivo.add(removerCaracterEspecial(pagador.nome).substring(0, 40).padEnd(40, " "));
|
|
2540
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.logradouro).substring(0, 40).padEnd(40, " "));
|
|
2541
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.bairro).substring(0, 15).padEnd(15, " "));
|
|
2465
2542
|
arquivo.add(pagador.endereco.cep);
|
|
2466
|
-
arquivo.add(
|
|
2467
|
-
arquivo.add(
|
|
2543
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.municipio).substring(0, 15).padEnd(15, " "));
|
|
2544
|
+
arquivo.add(removerCaracterEspecial(pagador.endereco.uf).padEnd(2, " "));
|
|
2468
2545
|
arquivo.add("0");
|
|
2469
2546
|
arquivo.add("000000000000000");
|
|
2470
2547
|
arquivo.add(" ".padEnd(40, " "));
|