node-sped-nfe 1.1.9 → 1.2.0

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/README.md CHANGED
@@ -50,6 +50,7 @@ Toda a documentação completa com guias, exemplos, status SEFAZ e muito mais es
50
50
  | Consulta Status do Serviço SEFAZ | ✅ |
51
51
  | Consulta Situação de NF-e/NFC-e | ✅ |
52
52
  | Consulta NF-e/NFC-e emitidas contra (DistNFe) | ✅ |
53
+ | Download NF-e/NFC-e emitidas contra (DistNFe) | ✅ |
53
54
  | Cancelamento de NFe/NFCe emitida (110111) | ✅ |
54
55
  | Carta correção de NFe/NFCe emitida (110110) | ✅ |
55
56
  | Manifestação de Destinatário - Ciência da Operação (210210) | ✅ |
@@ -30,8 +30,9 @@ declare class Tools {
30
30
  textoCorrecao?: string | undefined;
31
31
  sequencial?: number | undefined;
32
32
  }): Promise<string>;
33
- sefazDistDFe({ ultNSU }: {
33
+ sefazDistDFe({ ultNSU, chNFe }: {
34
34
  ultNSU?: string;
35
+ chNFe?: string;
35
36
  }): Promise<string>;
36
37
  sefazStatus(): Promise<string>;
37
38
  validarNFe(xml: string): Promise<any>;
@@ -359,9 +359,11 @@ class Tools {
359
359
  }
360
360
  });
361
361
  }
362
- async sefazDistDFe({ ultNSU = "000000000000000" }) {
362
+ async sefazDistDFe({ ultNSU = undefined, chNFe = undefined }) {
363
363
  return new Promise(async (resolve, reject) => {
364
364
  try {
365
+ if (!chNFe && !ultNSU)
366
+ throw "sefazDistDFe({chNFe|ultNSU})";
365
367
  if (!__classPrivateFieldGet(this, _Tools_config, "f").CNPJ)
366
368
  throw "CNPJ não definido!";
367
369
  if (__classPrivateFieldGet(this, _Tools_config, "f").CNPJ.length !== 14)
@@ -375,9 +377,12 @@ class Tools {
375
377
  "tpAmb": 1, // 1 = produção, 2 = homologação
376
378
  "cUFAutor": UF2cUF[__classPrivateFieldGet(this, _Tools_config, "f").UF], // "AN" - Ambiente Nacional
377
379
  "CNPJ": __classPrivateFieldGet(this, _Tools_config, "f").CNPJ,
378
- "distNSU": {
379
- "ultNSU": `${ultNSU}`.padStart(15, '0')
380
- }
380
+ ...(typeof ultNSU != "undefined" ?
381
+ { "distNSU": { "ultNSU": `${ultNSU}`.padStart(15, '0') } } :
382
+ {}),
383
+ ...(typeof chNFe != "undefined" ?
384
+ { "consChNFe": { "chNFe": chNFe } } :
385
+ {})
381
386
  }
382
387
  });
383
388
  await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, xmlSing, `distDFeInt_v1.01`).catch(reject); //Validar corpo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-sped-nfe",
3
- "version": "1.1.9",
3
+ "version": "1.2.0",
4
4
  "author": "Kalmon V. Tavares",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",