@plasoft/boletos 1.0.52 → 1.0.53

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 CHANGED
@@ -629,6 +629,7 @@ interface IParcela {
629
629
  id_boleto: number;
630
630
  vencimento: string | Date;
631
631
  valor: number | string;
632
+ tipoDocumento: 'NFE' | 'FIN' | 'FAT';
632
633
  }
633
634
  interface IGerarPDFBancoBrasil {
634
635
  banco: Banco.BANCO_BRASIL;
package/build/index.d.ts CHANGED
@@ -629,6 +629,7 @@ interface IParcela {
629
629
  id_boleto: number;
630
630
  vencimento: string | Date;
631
631
  valor: number | string;
632
+ tipoDocumento: 'NFE' | 'FIN' | 'FAT';
632
633
  }
633
634
  interface IGerarPDFBancoBrasil {
634
635
  banco: Banco.BANCO_BRASIL;
package/build/index.js CHANGED
@@ -2143,11 +2143,31 @@ function gerarDadosBoleto5({ dados }) {
2143
2143
  let numeroDocumento = "";
2144
2144
  let campoLivre = "";
2145
2145
  if (convenio.length === 6) {
2146
- numeroDocumento = padLeft(`${parcela.id_boleto}2`, 5);
2147
- nossoNumero = getNossoNumero3(`${convenio}${numeroDocumento}2`);
2146
+ switch (parcela.tipoDocumento) {
2147
+ case "NFE":
2148
+ numeroDocumento = padLeft(`${parcela.id_boleto}2`, 5);
2149
+ break;
2150
+ case "FAT":
2151
+ numeroDocumento = padLeft(`${parcela.id_boleto}4`, 5);
2152
+ break;
2153
+ case "FIN":
2154
+ numeroDocumento = padLeft(`${parcela.id_boleto}5`, 5);
2155
+ break;
2156
+ }
2157
+ nossoNumero = getNossoNumero3(`${convenio}${numeroDocumento}`);
2148
2158
  campoLivre = copy(nossoNumero, 1, 11) + padLeft(bancario.agencia, 4) + padLeft(`${bancario.numero}${bancario.numero_dv}`, 8) + padLeft(bancario.carteira, 2);
2149
2159
  } else if (convenio.length === 7) {
2150
- numeroDocumento = padLeft(`${parcela.id_boleto}2`, 10);
2160
+ switch (parcela.tipoDocumento) {
2161
+ case "NFE":
2162
+ numeroDocumento = padLeft(`${parcela.id_boleto}2`, 10);
2163
+ break;
2164
+ case "FAT":
2165
+ numeroDocumento = padLeft(`${parcela.id_boleto}4`, 10);
2166
+ break;
2167
+ case "FIN":
2168
+ numeroDocumento = padLeft(`${parcela.id_boleto}5`, 10);
2169
+ break;
2170
+ }
2151
2171
  nossoNumero = `${convenio}${numeroDocumento}`;
2152
2172
  campoLivre = `000000${nossoNumero}${padLeft(bancario.carteira, 2)}`;
2153
2173
  }