node-sped-nfe 1.1.8 → 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 +1 -0
- package/dist/utils/tools.d.ts +2 -1
- package/dist/utils/tools.js +9 -7
- package/package.json +1 -1
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) | ✅ |
|
package/dist/utils/tools.d.ts
CHANGED
@@ -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>;
|
package/dist/utils/tools.js
CHANGED
@@ -307,7 +307,6 @@ class Tools {
|
|
307
307
|
};
|
308
308
|
let xmlSing = await json2xml(evento);
|
309
309
|
xmlSing = await this.xmlSign(xmlSing, { tag: "infEvento" }); //Assinado
|
310
|
-
fs.writeFileSync("testes/xmlEvento.xml", xmlSing, "utf8");
|
311
310
|
await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, xmlSing, `envEvento_v1.00`).catch(reject); //Validar corpo
|
312
311
|
xmlSing = await json2xml({
|
313
312
|
"soap:Envelope": {
|
@@ -360,9 +359,11 @@ class Tools {
|
|
360
359
|
}
|
361
360
|
});
|
362
361
|
}
|
363
|
-
async sefazDistDFe({ ultNSU =
|
362
|
+
async sefazDistDFe({ ultNSU = undefined, chNFe = undefined }) {
|
364
363
|
return new Promise(async (resolve, reject) => {
|
365
364
|
try {
|
365
|
+
if (!chNFe && !ultNSU)
|
366
|
+
throw "sefazDistDFe({chNFe|ultNSU})";
|
366
367
|
if (!__classPrivateFieldGet(this, _Tools_config, "f").CNPJ)
|
367
368
|
throw "CNPJ não definido!";
|
368
369
|
if (__classPrivateFieldGet(this, _Tools_config, "f").CNPJ.length !== 14)
|
@@ -376,9 +377,12 @@ class Tools {
|
|
376
377
|
"tpAmb": 1, // 1 = produção, 2 = homologação
|
377
378
|
"cUFAutor": UF2cUF[__classPrivateFieldGet(this, _Tools_config, "f").UF], // "AN" - Ambiente Nacional
|
378
379
|
"CNPJ": __classPrivateFieldGet(this, _Tools_config, "f").CNPJ,
|
379
|
-
"
|
380
|
-
"ultNSU": `${ultNSU}`.padStart(15, '0')
|
381
|
-
|
380
|
+
...(typeof ultNSU != "undefined" ?
|
381
|
+
{ "distNSU": { "ultNSU": `${ultNSU}`.padStart(15, '0') } } :
|
382
|
+
{}),
|
383
|
+
...(typeof chNFe != "undefined" ?
|
384
|
+
{ "consChNFe": { "chNFe": chNFe } } :
|
385
|
+
{})
|
382
386
|
}
|
383
387
|
});
|
384
388
|
await __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, xmlSing, `distDFeInt_v1.01`).catch(reject); //Validar corpo
|
@@ -431,8 +435,6 @@ class Tools {
|
|
431
435
|
});
|
432
436
|
req.write(xmlSing);
|
433
437
|
req.end();
|
434
|
-
// Opcional: salvar a requisição para análise
|
435
|
-
fs.writeFileSync("testes/consultaDistribuicao.xml", xmlSing, "utf8");
|
436
438
|
}
|
437
439
|
catch (erro) {
|
438
440
|
reject(erro);
|