node-sped-nfe 1.0.6 → 1.0.7

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/LICENSE.md ADDED
@@ -0,0 +1,188 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
166
+
167
+ ============================================================
168
+ MIT LICENCE
169
+ ============================================================
170
+ Copyright (c) 2016 NFePHP
171
+
172
+ Permission is hereby granted, free of charge, to any person obtaining a copy
173
+ of this software and associated documentation files (the "Software"), to deal
174
+ in the Software without restriction, including without limitation the rights
175
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
176
+ copies of the Software, and to permit persons to whom the Software is
177
+ furnished to do so, subject to the following conditions:
178
+
179
+ The above copyright notice and this permission notice shall be included in
180
+ all copies or substantial portions of the Software.
181
+
182
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
183
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
184
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
185
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
186
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
187
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
188
+ THE SOFTWARE.
@@ -16,7 +16,7 @@ declare class Make {
16
16
  tagAutXML(obj: any): void;
17
17
  tagProd(obj: any): void;
18
18
  tagCreditoPresumidoProd(obj: any): void;
19
- taginfAdProd(obj: any): void;
19
+ taginfAdProd(index: any, obj: any): void;
20
20
  tagCEST(obj: any): void;
21
21
  tagRECOPI(obj: any): void;
22
22
  tagAdi(obj: any): void;
@@ -63,19 +63,34 @@ class Make {
63
63
  });
64
64
  }
65
65
  tagRefNFe(obj) {
66
- throw "Não implementado!";
66
+ if (typeof __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref == "undefined") {
67
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref = new Array();
68
+ }
69
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref.push({ refNFe: obj });
67
70
  }
68
71
  tagRefNF(obj) {
69
- throw "Não implementado!";
72
+ if (typeof __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref == "undefined") {
73
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref = new Array();
74
+ }
75
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref.push({ refNF: obj });
70
76
  }
71
77
  tagRefNFP(obj) {
72
- throw "Não implementado!";
78
+ if (typeof __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref == "undefined") {
79
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref = new Array();
80
+ }
81
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref.push({ refNFP: obj });
73
82
  }
74
83
  tagRefCTe(obj) {
75
- throw "Não implementado!";
84
+ if (typeof __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref == "undefined") {
85
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref = new Array();
86
+ }
87
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref.push({ refCTe: obj });
76
88
  }
77
89
  tagRefECF(obj) {
78
- throw "Não implementado!";
90
+ if (typeof __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref == "undefined") {
91
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref = new Array();
92
+ }
93
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.NFref.push({ refECF: obj });
79
94
  }
80
95
  tagEmit(obj) {
81
96
  __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.emit = new Object();
@@ -111,10 +126,16 @@ class Make {
111
126
  });
112
127
  }
113
128
  tagRetirada(obj) {
114
- throw "não implementado!";
129
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.retirada = {};
130
+ Object.keys(obj).forEach(key => {
131
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.retirada[key] = obj[key];
132
+ });
115
133
  }
116
134
  tagAutXML(obj) {
117
- throw "não implementado!";
135
+ if (typeof __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.autXML == "undefined") {
136
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.autXML = new Array();
137
+ }
138
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.autXML.push(obj);
118
139
  }
119
140
  //tagprod
120
141
  tagProd(obj) {
@@ -145,8 +166,8 @@ class Make {
145
166
  tagCreditoPresumidoProd(obj) {
146
167
  throw "não implementado!";
147
168
  }
148
- taginfAdProd(obj) {
149
- throw "não implementado!";
169
+ taginfAdProd(index, obj) {
170
+ __classPrivateFieldGet(this, _Make_NFe, "f").infNFe.det[index].infAdProd = obj;
150
171
  }
151
172
  tagCEST(obj) {
152
173
  throw "não implementado!";
@@ -517,10 +538,10 @@ class Make {
517
538
  __classPrivateFieldGet(this, _Make_NFe, "f").infNFe[`@Id`] = `NFe${__classPrivateFieldGet(this, _Make_instances, "m", _Make_gerarChaveNFe).call(this)}`;
518
539
  //Adicionar QrCode
519
540
  if (__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.mod == 65) {
520
- //Como ja temos cUF, usamo dados do extras para convere em UF e achar os dados de url!
541
+ //Como ja temos cUF, vamos usar o extras.cUF2UF
521
542
  let tempUF = urlEventos(cUF2UF[__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.cUF], __classPrivateFieldGet(this, _Make_NFe, "f").infNFe['@versao']);
522
543
  __classPrivateFieldGet(this, _Make_NFe, "f").infNFeSupl = {
523
- qrCode: tempUF.mod65[__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.tpAmb == 1 ? 'producao' : 'homologacao'].NFeConsultaQR,
544
+ qrCode: tempUF.mod65[__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.tpAmb == 1 ? 'producao' : 'homologacao'].NFeConsultaQR, //Este não e o valor final, vamos utilizar apenas para carregar os dados que vão ser utlizados no make
524
545
  urlChave: tempUF.mod65[__classPrivateFieldGet(this, _Make_NFe, "f").infNFe.ide.tpAmb == 1 ? 'producao' : 'homologacao'].urlChave
525
546
  };
526
547
  }
@@ -16,7 +16,7 @@ declare class Tools {
16
16
  xmlSign(xmlJSON: string, data?: any): Promise<string>;
17
17
  xml2json(xml: string): Promise<object>;
18
18
  json2xml(obj: object): Promise<string>;
19
- getCertificado(): Promise<unknown>;
19
+ getCertificado(): Promise<object>;
20
20
  consultarNFe(chNFe: string): Promise<string>;
21
21
  sefazStatus(): Promise<string>;
22
22
  }
@@ -166,7 +166,7 @@ class Tools {
166
166
  xml.NFe.infNFeSupl.qrCode = __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_gerarQRCodeNFCe).call(this, xml.NFe, "2", __classPrivateFieldGet(this, _Tools_config, "f").CSCid, __classPrivateFieldGet(this, _Tools_config, "f").CSC);
167
167
  }
168
168
  this.json2xml(xml).then(async (res) => {
169
- __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, res, 'nfe_v4.00');
169
+ __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, res, `nfe_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`);
170
170
  resvol(res);
171
171
  }).catch(err => {
172
172
  reject(err);
@@ -183,11 +183,13 @@ class Tools {
183
183
  resvol(__classPrivateFieldGet(this, _Tools_xmlTools, "f").XMLBuilder.build(obj));
184
184
  });
185
185
  }
186
+ //Obter certificado
186
187
  async getCertificado() {
187
188
  return new Promise(async (resvol, reject) => {
188
189
  __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_certTools).call(this).then(resvol).catch(reject);
189
190
  });
190
191
  }
192
+ //Consulta NFe
191
193
  consultarNFe(chNFe) {
192
194
  return new Promise(async (resolve, reject) => {
193
195
  if (!chNFe || chNFe.length !== 44) {
@@ -223,7 +225,7 @@ class Tools {
223
225
  attributeNamePrefix: "@"
224
226
  });
225
227
  // Validação do XML interno (opcional)
226
- __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, builder.build({ consSitNFe }), 'consSitNFe_v4.00');
228
+ __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, builder.build({ consSitNFe }), `consSitNFe_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`);
227
229
  const xml = builder.build(xmlObj);
228
230
  let tempUF = urlEventos(__classPrivateFieldGet(this, _Tools_config, "f").UF, __classPrivateFieldGet(this, _Tools_config, "f").versao);
229
231
  const url = tempUF[`mod${__classPrivateFieldGet(this, _Tools_config, "f").mod}`][(__classPrivateFieldGet(this, _Tools_config, "f").tpAmb == 1 ? "producao" : "homologacao")].NFeConsultaProtocolo;
@@ -284,7 +286,7 @@ class Tools {
284
286
  attributeNamePrefix: "@"
285
287
  });
286
288
  //Validação
287
- __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, tempBuild.build({ consStatServ }), 'consStatServ_v4.00');
289
+ __classPrivateFieldGet(this, _Tools_instances, "m", _Tools_xmlValido).call(this, tempBuild.build({ consStatServ }), `consStatServ_v${__classPrivateFieldGet(this, _Tools_config, "f").versao}`);
288
290
  let tempUF = urlEventos(__classPrivateFieldGet(this, _Tools_config, "f").UF, __classPrivateFieldGet(this, _Tools_config, "f").versao);
289
291
  let xml = tempBuild.build(xmlObj);
290
292
  const req = https.request(tempUF[`mod${__classPrivateFieldGet(this, _Tools_config, "f").mod}`][(__classPrivateFieldGet(this, _Tools_config, "f").tpAmb == 1 ? "producao" : "homologacao")].NFeStatusServico, {
package/docs/xml.md CHANGED
@@ -83,7 +83,7 @@ nfe.taginfNFe(std);
83
83
 
84
84
  ```
85
85
 
86
- ### 🟢 function tagide(std)
86
+ ### 🟢 function tagIde(std)
87
87
  Node de identificação da NFe
88
88
 
89
89
  | Parâmetro | Tipo | Descrição |
@@ -119,11 +119,11 @@ std.verProc = '3.10.31';
119
119
  std.dhCont = null;
120
120
  std.xJust = null;
121
121
 
122
- nfe.tagide(std);
122
+ nfe.tagIde(std);
123
123
  ```
124
124
 
125
125
 
126
- ### 🔴 function tagrefNFe(std)
126
+ ### 🟢 function tagrefNFe(std)
127
127
  Node referente a NFe referenciada
128
128
 
129
129
  | Parâmetro | Tipo | Descrição |
@@ -137,7 +137,7 @@ std.refNFe = '35150271780456000160550010000253101000253101';
137
137
  nfe.tagrefNFe(std);
138
138
  ```
139
139
 
140
- ### 🔴 function tagrefNF(std)
140
+ ### 🟢 function tagrefNF(std)
141
141
  Node referente a Nota Fiscal referenciada modelo 1 ou 2
142
142
 
143
143
  | Parâmetro | Tipo | Descrição |
@@ -156,7 +156,7 @@ std.nNF = 587878;
156
156
  nfe.tagrefNF(std);
157
157
  ```
158
158
 
159
- ### 🔴 function tagrefNFP(std)
159
+ ### 🟢 function tagrefNFP(std)
160
160
  Node referente a Nota Fiscal referenciada de produtor rural
161
161
 
162
162
  | Parâmetro | Tipo | Descrição |
@@ -173,10 +173,11 @@ std.IE = 'ISENTO';
173
173
  std.mod = '04';
174
174
  std.serie = 0;
175
175
  std.nNF = 5578;
176
+ std.refCTe = '35150271780456000160550010000253101000253101'
176
177
 
177
178
  nfe.tagrefNFP(std);
178
179
  ```
179
- ### 🔴 function tagrefCTe(std)
180
+ ### 🟢 function tagrefCTe(std)
180
181
  Node referente aos CTe referenciados
181
182
 
182
183
  | Parâmetro | Tipo | Descrição |
@@ -189,7 +190,7 @@ std.refCTe = '35150268252816000146570010000016161002008472';
189
190
  nfe.tagrefCTe(std);
190
191
  ```
191
192
 
192
- ### 🔴 function tagrefECF(std)
193
+ ### 🟢 function tagrefECF(std)
193
194
  Node referente aos ECF referenciados
194
195
 
195
196
  | Parâmetro | Tipo | Descrição |
@@ -296,7 +297,7 @@ std.fone;
296
297
  nfe.tagenderDest(std);
297
298
  ```
298
299
 
299
- ### 🔴 function tagretirada(std)
300
+ ### 🟢 function tagretirada(std)
300
301
  > NOTA: Ajustado para NT 2018.005
301
302
  Node indicativo de local de retirada diferente do endereço do emitente
302
303
 
@@ -356,7 +357,7 @@ std.email = 'contato@beltrano.com.br';
356
357
  nfe.tagentrega(std);
357
358
  ```
358
359
 
359
- ### 🔴 function tagautXML(std)
360
+ ### 🟢 function tagautXML(std)
360
361
  Node de registro de pessoas autorizadas a acessar a NFe
361
362
 
362
363
  | Parâmetro | Tipo | Descrição |
@@ -365,7 +366,7 @@ Node de registro de pessoas autorizadas a acessar a NFe
365
366
  ```javascript
366
367
  let std = new Object();
367
368
  std.CNPJ = '12345678901234'; //indicar um CNPJ ou CPF
368
- std.CPF = null;
369
+ //std.CPF = null; //indicar um CNPJ ou CPF
369
370
  nfe.tagautXML(std);
370
371
  ```
371
372
 
@@ -377,7 +378,6 @@ Node de dados do produto/serviço
377
378
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
378
379
  ```javascript
379
380
  let std = new Object();
380
- std.item = 1; //item da NFe
381
381
  std.cProd;
382
382
  std.cEAN;
383
383
  std.cBarra;
@@ -404,7 +404,7 @@ std.xPed;
404
404
  std.nItemPed;
405
405
  std.nFCI;
406
406
 
407
- nfe.tagprod(std);
407
+ nfe.tagProd([std]);
408
408
  ```
409
409
 
410
410
  ### 🔴 function tagCreditoPresumidoProd(std): void
@@ -419,12 +419,12 @@ Node opcional com dados de Crédito Presumido, são permitidos até 4 registros
419
419
 
420
420
  ```javascript
421
421
  let std = new \Object();
422
- std.item = 1;
422
+ let indexProd = 1;
423
423
  std.cCredPresumido = '2222211234';
424
424
  std.pCredPresumido = '4';
425
425
  std.vCredPresumido = '4';
426
426
 
427
- $make.tagCreditoPresumidoProd(std);
427
+ $make.tagCreditoPresumidoProd(indexProd ,std);
428
428
  ```
429
429
 
430
430
  ### 🔴 function taginfAdProd(std)
@@ -435,14 +435,14 @@ Node de informações adicionais do produto
435
435
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
436
436
  ```javascript
437
437
  let std = new Object();
438
- std.item = 1; //item da NFe
438
+ let indexProd = 1; //item da NFe
439
439
 
440
440
  std.infAdProd = 'informacao adicional do item';
441
441
 
442
- nfe.taginfAdProd(std);
442
+ nfe.taginfAdProd(indexProd, std);
443
443
  ```
444
444
 
445
- ### 🔴 function tagNVE(std)
445
+ ### 🔴 function tagNVE(std) !! Pode ser declarado no tagProd({...NCM, NVE:[]})
446
446
  Node com a Nomenclatura de Valor Aduaneiro e Estatística do item da NFe
447
447
 
448
448
  | Parâmetro | Tipo | Descrição |
@@ -450,13 +450,13 @@ Node com a Nomenclatura de Valor Aduaneiro e Estatística do item da NFe
450
450
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
451
451
  ```javascript
452
452
  let std = new Object();
453
- std.item = 1; //item da NFe
453
+ let indexProd = 1; //item da NFe
454
454
  std.NVE = 'AA0001';
455
455
 
456
- nfe.tagNVE(std);
456
+ nfe.tagNVE(indexProd, std);
457
457
  ```
458
458
 
459
- ### 🔴 function tagCEST(std)
459
+ ### 🔴 function tagCEST(std) !! Pode ser declarado no tagProd({...NCM, CEST, indEscala, CNPJFab})
460
460
  Node de detalhamento do Especificador da Substituição Tributária do item da NFe
461
461
 
462
462
  | Parâmetro | Tipo | Descrição |
@@ -464,15 +464,15 @@ Node de detalhamento do Especificador da Substituição Tributária do item da N
464
464
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
465
465
  ```javascript
466
466
  let std = new Object();
467
- std.item = 1; //item da NFe
467
+ let indexProd = 1; //item da NFe
468
468
  std.CEST = '0200100';
469
469
  std.indEscala = 'N'; //incluido no layout 4.00
470
470
  std.CNPJFab = '12345678901234'; //incluido no layout 4.00
471
471
 
472
- nfe.tagCEST(std);
472
+ nfe.tagCEST(indexProd, std);
473
473
  ```
474
474
 
475
- ### 🔴 function tagRECOPI(std)
475
+ ### 🔴 function tagRECOPI(std) !! Pode ser declarado no tagProd({...NCM, nRECOPI})
476
476
  Node com o número do RECOPI
477
477
 
478
478
  | Parâmetro | Tipo | Descrição |
@@ -480,13 +480,13 @@ Node com o número do RECOPI
480
480
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
481
481
  ```javascript
482
482
  let std = new Object();
483
- std.item = 1; //item da NFe
483
+ let indexProd = 1; //item da NFe
484
484
  std.nRECOPI = '12345678901234567890';
485
485
 
486
- nfe.tagRECOPI(std);
486
+ nfe.tagRECOPI(indexProd, std);
487
487
  ```
488
488
 
489
- ### 🔴 function tagDI(std)
489
+ ### 🟢 function tagDI(std) !! Pode ser declarado no tagProd({..., DI:{...}})
490
490
  Node com informações da Declaração de Importação do item da NFe
491
491
 
492
492
  | Parâmetro | Tipo | Descrição |
@@ -494,7 +494,7 @@ Node com informações da Declaração de Importação do item da NFe
494
494
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
495
495
  ```javascript
496
496
  let std = new Object();
497
- std.item = 1; //item da NFe
497
+ let indexProd = 1; //item da NFe
498
498
  std.nDI;
499
499
  std.dDI;
500
500
  std.xLocDesemb;
@@ -508,10 +508,10 @@ std.CPF; //NT 2023.004 v1.00
508
508
  std.UFTerceiro;
509
509
  std.cExportador;
510
510
 
511
- nfe.tagDI(std);
511
+ nfe.tagDI(indexProd, std);
512
512
  ```
513
513
 
514
- ### 🔴 function tagadi(std)
514
+ ### 🟢 function tagadi(std) !! Pode ser declarado no tagProd({..., DI:{...,adi:{...}}})
515
515
  Node de Adições relativas as DI do item
516
516
 
517
517
  | Parâmetro | Tipo | Descrição |
@@ -519,7 +519,7 @@ Node de Adições relativas as DI do item
519
519
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
520
520
  ```javascript
521
521
  let std = new Object();
522
- std.item = 1; //item da NFe
522
+ let indexProd = 1; //item da NFe
523
523
  std.nDI; //número da DI
524
524
  std.nAdicao;
525
525
  std.nSeqAdic;
@@ -527,7 +527,7 @@ std.cFabricante;
527
527
  std.vDescDI;
528
528
  std.nDraw;
529
529
 
530
- nfe.tagadi(std);
530
+ nfe.tagadi(indexProd, std);
531
531
  ```
532
532
 
533
533
  ### 🔴 function tagdetExport(std)
@@ -538,10 +538,10 @@ Node com informações de exportação para o item
538
538
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
539
539
  ```javascript
540
540
  let std = new Object();
541
- std.item = 1; //item da NFe
541
+ let indexProd = 1; //item da NFe
542
542
  std.nDraw = '82828';
543
543
 
544
- nfe.tagdetExport(std);
544
+ nfe.tagdetExport(indexProd, std);
545
545
  ```
546
546
 
547
547
  ### 🔴 function tagdetExportInd(std)
@@ -553,12 +553,12 @@ nfe.tagdetExport(std) pois pertence a essa tag
553
553
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
554
554
  ```javascript
555
555
  let std = new Object();
556
- std.item = 1; //item da NFe
556
+ let indexProd = 1; //item da NFe
557
557
  std.nRE = '123456789012';
558
558
  std.chNFe = '53170924915365000295550550000001951000001952';
559
559
  std.qExport = 1234.123;
560
560
 
561
- nfe.tagdetExportInd(std);
561
+ nfe.tagdetExportInd(indexProd, std);
562
562
  ```
563
563
  ### 🔴 function tagRastro(std)
564
564
  Node com os dados de rastreabilidade do item da NFe
@@ -570,14 +570,14 @@ Node com os dados de rastreabilidade do item da NFe
570
570
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
571
571
  ```javascript
572
572
  let std = new Object();
573
- std.item = 1; //item da NFe
573
+ let indexProd = 1; //item da NFe
574
574
  std.nLote = '11111';
575
575
  std.qLote = 200;
576
576
  std.dFab = '2018-01-01';
577
577
  std.dVal = '2020-01-01';
578
578
  std.cAgreg = '1234';
579
579
 
580
- nfe.tagRastro(std);
580
+ nfe.tagRastro(indexProd, std);
581
581
  ```
582
582
 
583
583
  ### 🔴 function tagveicProd(std)
@@ -588,7 +588,7 @@ Node com o detalhamento de Veículos novos do item da NFe
588
588
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
589
589
  ```javascript
590
590
  let std = new Object();
591
- std.item = 1; //item da NFe
591
+ let indexProd = 1; //item da NFe
592
592
  std.tpOp;
593
593
  std.chassi;
594
594
  std.cCor;
@@ -614,7 +614,7 @@ std.cCorDENATRAN;
614
614
  std.lota;
615
615
  std.tpRest;
616
616
 
617
- nfe.tagveicProd(std);
617
+ nfe.tagveicProd(indexProd, std);
618
618
  ```
619
619
 
620
620
  ### 🔴 function tagmed(std)
@@ -626,12 +626,12 @@ Node com o detalhamento de Medicamentos e de matérias-primas farmacêuticas
626
626
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
627
627
  ```javascript
628
628
  let std = new Object();
629
- std.item = 1; //item da NFe
629
+ let indexProd = 1; //item da NFe
630
630
  std.cProdANVISA = '1234567890123'; //incluido no layout 4.00
631
631
  std.xMotivoIsencao = 'RDC 238';
632
632
  std.vPMC = 102.22;
633
633
 
634
- nfe.tagmed(std);
634
+ nfe.tagmed(indexProd, std);
635
635
  ```
636
636
 
637
637
  ### 🔴 function tagarma(std)
@@ -642,14 +642,14 @@ Node com informações e detalhamento de Armamento do item da NFe
642
642
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
643
643
  ```javascript
644
644
  let std = new Object();
645
- std.item = 1; //item da NFe
645
+ let indexProd = 1; //item da NFe
646
646
  std.nAR; //Indicativo de número da arma
647
647
  std.tpArma;
648
648
  std.nSerie;
649
649
  std.nCano;
650
650
  std.descr;
651
651
 
652
- nfe.tagarma(std);
652
+ nfe.tagarma(indexProd, std);
653
653
  ```
654
654
 
655
655
  ### 🔴 function tagcomb(std)
@@ -660,7 +660,7 @@ Node das informações específicas para combustíveis líquidos e lubrificantes
660
660
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
661
661
  ```javascript
662
662
  let std = new Object();
663
- std.item = 1; //item da NFe
663
+ let indexProd = 1; //item da NFe
664
664
  std.cProdANP;
665
665
 
666
666
  std.pMixGN; //removido no layout 4.00
@@ -678,7 +678,7 @@ std.qBCProd;
678
678
  std.vAliqProd;
679
679
  std.vCIDE;
680
680
 
681
- nfe.tagcomb(std);
681
+ nfe.tagcomb(indexProd, std);
682
682
  ```
683
683
 
684
684
  ### 🔴 function tagencerrante(std)
@@ -690,7 +690,7 @@ Referente ao item da NFe
690
690
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
691
691
  ```javascript
692
692
  let std = new Object();
693
- std.item = 1; //item da NFe
693
+ let indexProd = 1; //item da NFe
694
694
  std.nBico;
695
695
  std.nBomba;
696
696
  std.nTanque;
@@ -699,7 +699,7 @@ std.vEncFin;
699
699
  std.pBio; //NT 2022.001 v1.10
700
700
 
701
701
 
702
- nfe.tagencerrante(std);
702
+ nfe.tagencerrante(indexProd, std);
703
703
  ```
704
704
 
705
705
  ### 🔴 function tagorigComb(std)
@@ -710,12 +710,12 @@ Parte do grupo encerrante, podem haver de 0 até 30 tags desse tipo
710
710
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
711
711
  ```javascript
712
712
  let std = new Object();
713
- std.item = 1; //item da NFe
713
+ let indexProd = 1; //item da NFe
714
714
  std.indImport= 0; //NT 2023.001 v1.00
715
715
  std.cUFOrig = 35; //NT 2023.001 v1.00
716
716
  std.Orig = 100; //NT 2023.001 v1.00
717
717
 
718
- nfe.tagOrigComb(std);
718
+ nfe.tagOrigComb(indexProd, std);
719
719
  ```
720
720
 
721
721
 
@@ -727,10 +727,10 @@ Node inicial dos Tributos incidentes no Produto ou Serviço do item da NFe
727
727
  | std | stcClass | contêm os dados dos campos, nomeados conforme manual |
728
728
  ```javascript
729
729
  let std = new Object();
730
- std.item = 1; //item da NFe
730
+ let indexProd = 1; //item da NFe
731
731
  std.vTotTrib = 1000.00;
732
732
 
733
- nfe.tagimposto(std);
733
+ nfe.tagimposto(indexProd, std);
734
734
  ```
735
735
 
736
736
  ### 🔴 function tagICMS(std)
@@ -742,7 +742,7 @@ Node com informações do ICMS do item da NFe
742
742
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
743
743
  ```javascript
744
744
  let std = new Object();
745
- std.item = 1; //item da NFe
745
+ let indexProd = 1; //item da NFe
746
746
  std.orig;
747
747
  std.CST;
748
748
  std.modBC;
@@ -792,7 +792,7 @@ std.vICMSMonoRet; //NT 2023.001-v1.10
792
792
  std.vICMSMonoDif; //NT 2023.001-v1.10
793
793
  std.cBenefRBC; //NT 2019.001 v1.61
794
794
  std.indDeduzDeson; //NT 2023.004 v1.00
795
- nfe.tagICMS(std);
795
+ nfe.tagICMS(indexProd, std);
796
796
  ```
797
797
 
798
798
  ### 🔴 function tagICMSPart(std)
@@ -803,7 +803,7 @@ Node com informações da partilha do ICMS entre a UF de origem e UF de destino
803
803
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
804
804
  ```javascript
805
805
  let std = new Object();
806
- std.item = 1; //item da NFe
806
+ let indexProd = 1; //item da NFe
807
807
  std.orig = 0;
808
808
  std.CST = '90';
809
809
  std.modBC = 0;
@@ -820,7 +820,7 @@ std.vICMSST = 140.00;
820
820
  std.pBCOp = 10.00;
821
821
  std.UFST = 'RJ';
822
822
 
823
- nfe.tagICMSPart(std);
823
+ nfe.tagICMSPart(indexProd, std);
824
824
  ```
825
825
 
826
826
  ### 🔴 function tagICMSST(std)
@@ -832,7 +832,7 @@ Node Repasse de ICMS ST retido anteriormente em operações interestaduais com r
832
832
  | std | stcClass | contêm os dados dos campos, nomeados conforme manual |
833
833
  ```javascript
834
834
  let std = new Object();
835
- std.item = 1; //item da NFe
835
+ let indexProd = 1; //item da NFe
836
836
  std.orig = 0;
837
837
  std.CST = '60';
838
838
  std.vBCSTRet = 1000.00;
@@ -849,7 +849,7 @@ std.vBCEfet = null;
849
849
  std.pICMSEfet = null;
850
850
  std.vICMSEfet = null;
851
851
 
852
- nfe.tagICMSST(std);
852
+ nfe.tagICMSST(indexProd, std);
853
853
  ```
854
854
 
855
855
  ### 🟢 function tagProdICMSSN(std)
@@ -861,7 +861,7 @@ Node referente Tributação ICMS pelo Simples Nacional do item da NFe
861
861
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
862
862
  ```javascript
863
863
  let std = new Object();
864
- std.item = 1; //item da NFe
864
+ let indexProd = 1; //item da NFe
865
865
  std.orig = 0;
866
866
  std.CSOSN = '101';
867
867
  std.pCredSN = 2.00;
@@ -892,7 +892,7 @@ std.pICMSEfet = null;
892
892
  std.vICMSEfet = null;
893
893
  std.vICMSSubstituto = null;
894
894
 
895
- nfe.tagICMSSN(std);
895
+ nfe.tagICMSSN(indexProd, std);
896
896
  ```
897
897
 
898
898
  ### 🔴 function tagICMSUFDest(std)
@@ -903,7 +903,7 @@ Node de informação do ICMS Interestadual do item na NFe
903
903
  | std | stcClass | contêm os dados dos campos, nomeados conforme manual |
904
904
  ```javascript
905
905
  let std = new Object();
906
- std.item = 1; //item da NFe
906
+ let indexProd = 1; //item da NFe
907
907
  std.vBCUFDest = 100.00;
908
908
  std.vBCFCPUFDest = 100.00;
909
909
  std.pFCPUFDest = 1.00;
@@ -914,7 +914,7 @@ std.vFCPUFDest = 1.00;
914
914
  std.vICMSUFDest = 14.44;
915
915
  std.vICMSUFRemet = 3.56;
916
916
 
917
- nfe.tagICMSUFDest(std);
917
+ nfe.tagICMSUFDest(indexProd, std);
918
918
  ```
919
919
 
920
920
  ### 🔴 function tagIPI(std)
@@ -927,7 +927,7 @@ Node referente ao IPI do item da NFe
927
927
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
928
928
  ```javascript
929
929
  let std = new Object();
930
- std.item = 1; //item da NFe
930
+ let indexProd = 1; //item da NFe
931
931
  std.clEnq = null;
932
932
  std.CNPJProd = null;
933
933
  std.cSelo = null;
@@ -940,7 +940,7 @@ std.pIPI = 15.00;
940
940
  std.qUnid = null;
941
941
  std.vUnid = null;
942
942
 
943
- nfe.tagIPI(std);
943
+ nfe.tagIPI(indexProd, std);
944
944
  ```
945
945
 
946
946
  ### 🔴 function tagII(std)
@@ -951,13 +951,13 @@ Node Imposto de Importação do item da NFe
951
951
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
952
952
  ```javascript
953
953
  let std = new Object();
954
- std.item = 1; //item da NFe
954
+ let indexProd = 1; //item da NFe
955
955
  std.vBC = 1000.00;
956
956
  std.vDespAdu = 100.00;
957
957
  std.vII = 220.00;
958
958
  std.vIOF = null;
959
959
 
960
- nfe.tagII(std);
960
+ nfe.tagII(indexProd, std);
961
961
  ```
962
962
 
963
963
  ### 🟢 function tagProdPIS(std)
@@ -968,7 +968,7 @@ Node PIS do item da NFe
968
968
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
969
969
  ```javascript
970
970
  let std = new Object();
971
- std.item = 1; //item da NFe
971
+ let indexProd = 1; //item da NFe
972
972
  std.CST = '07';
973
973
  std.vBC = null;
974
974
  std.pPIS = null;
@@ -976,7 +976,7 @@ std.vPIS = null;
976
976
  std.qBCProd = null;
977
977
  std.vAliqProd = null;
978
978
 
979
- nfe.tagPIS(std);
979
+ nfe.tagPIS(indexProd, std);
980
980
  ```
981
981
 
982
982
  ### 🔴 function tagPISST(std)
@@ -987,7 +987,7 @@ Node PIS Substituição Tributária do item da NFe
987
987
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
988
988
  ```javascript
989
989
  let std = new Object();
990
- std.item = 1; //item da NFe
990
+ let indexProd = 1; //item da NFe
991
991
  std.vPIS = 16.00;
992
992
  std.vBC = 1000.00
993
993
  std.pPIS = 1.60;
@@ -996,7 +996,7 @@ std.vAliqProd = null;
996
996
  std.indSomaPISST = 0; //0=Valor do PISST não compõe o valor total da NF-e
997
997
  //1=Valor do PISST compõe o valor total da NF-e
998
998
 
999
- nfe.tagPISST(std);
999
+ nfe.tagPISST(indexProd, std);
1000
1000
  ```
1001
1001
 
1002
1002
  ### 🟢 function tagProdCOFINS(std)
@@ -1007,7 +1007,7 @@ Node COFINS do item da NFe
1007
1007
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
1008
1008
  ```javascript
1009
1009
  let std = new Object();
1010
- std.item = 1; //item da NFe
1010
+ let indexProd = 1; //item da NFe
1011
1011
  std.CST = '07';
1012
1012
  std.vBC = null;
1013
1013
  std.pCOFINS = null;
@@ -1015,7 +1015,7 @@ std.vCOFINS = null;
1015
1015
  std.qBCProd = null;
1016
1016
  std.vAliqProd = null;
1017
1017
 
1018
- nfe.tagCOFINS(std);
1018
+ nfe.tagCOFINS(indexProd, std);
1019
1019
  ```
1020
1020
 
1021
1021
  ### 🔴 function tagCOFINSST(std)
@@ -1026,7 +1026,7 @@ Node COFINS Substituição Tributária do item da NFe
1026
1026
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
1027
1027
  ```javascript
1028
1028
  let std = new Object();
1029
- std.item = 1; //item da NFe
1029
+ let indexProd = 1; //item da NFe
1030
1030
  std.vCOFINS = 289.30;
1031
1031
  std.vBC = 2893.00;
1032
1032
  std.pCOFINS = 10.00;
@@ -1035,7 +1035,7 @@ std.vAliqProd = null;
1035
1035
  std.indSomaCOFINSST = 0; //0=Valor do COFINS ST não compõe o valor total da NF-e
1036
1036
  //1=Valor do COFINS ST compõe o valor total da NF-e
1037
1037
 
1038
- nfe.tagCOFINSST(std);
1038
+ nfe.tagCOFINSST(indexProd, std);
1039
1039
  ```
1040
1040
 
1041
1041
  ### 🔴 function tagISSQN(std)
@@ -1046,7 +1046,7 @@ Node ISSQN do item da NFe
1046
1046
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
1047
1047
  ```javascript
1048
1048
  let std = new Object();
1049
- std.item = 1; //item da NFe
1049
+ let indexProd = 1; //item da NFe
1050
1050
  std.vBC = 1000.00;
1051
1051
  std.vAliq = 5.00;
1052
1052
  std.vISSQN = 50.00;
@@ -1064,7 +1064,7 @@ std.cPais = '1058';
1064
1064
  std.nProcesso = null;
1065
1065
  std.indIncentivo = 2;
1066
1066
 
1067
- nfe.tagISSQN(std);
1067
+ nfe.tagISSQN(indexProd, std);
1068
1068
  ```
1069
1069
 
1070
1070
  ### 🔴 function tagimpostoDevol(std)
@@ -1077,11 +1077,11 @@ Node referente a informação do Imposto devolvido
1077
1077
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
1078
1078
  ```javascript
1079
1079
  let std = new Object();
1080
- std.item = 1; //item da NFe
1080
+ let indexProd = 1; //item da NFe
1081
1081
  std.pDevol = 2.00;
1082
1082
  std.vIPIDevol = 123.36;
1083
1083
 
1084
- nfe.tagimpostoDevol(std);
1084
+ nfe.tagimpostoDevol(indexProd, std);
1085
1085
  ```
1086
1086
 
1087
1087
  ### 🟢 function tagICMSTot(std)
@@ -1299,7 +1299,7 @@ Node com as informações dos volumes transportados
1299
1299
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
1300
1300
  ```javascript
1301
1301
  let std = new Object();
1302
- std.item = 1; //indicativo do numero do volume
1302
+ let indexProd = 1; //indicativo do numero do volume
1303
1303
  std.qVol = 2;
1304
1304
  std.esp = 'caixa';
1305
1305
  std.marca = 'OLX';
@@ -1307,7 +1307,7 @@ std.nVol = '11111';
1307
1307
  std.pesoL = 10.50;
1308
1308
  std.pesoB = 11.00;
1309
1309
 
1310
- nfe.tagvol(std);
1310
+ nfe.tagvol(indexProd, std);
1311
1311
  ```
1312
1312
 
1313
1313
  ### 🔴 function taglacres(std)
@@ -1318,10 +1318,10 @@ Node com a identificação dos lacres, referentes ao volume
1318
1318
  | std | Object | contêm os dados dos campos, nomeados conforme manual |
1319
1319
  ```javascript
1320
1320
  let std = new Object();
1321
- std.item = 1; //indicativo do numero do volume
1321
+ let indexProd = 1; //indicativo do numero do volume
1322
1322
  std.nLacre = 'ZZEX425365';
1323
1323
 
1324
- nfe.taglacres(std);
1324
+ nfe.taglacres(indexProd, std);
1325
1325
  ```
1326
1326
 
1327
1327
  ### 🔴 function tagfat(std)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-sped-nfe",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "author": "Kalmon V. Tavares",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,8 +29,9 @@
29
29
  "t:status": "node exemplos/status.js",
30
30
  "t:nfe": "node exemplos/nfe.js",
31
31
  "t:nfce": "node exemplos/nfce.js",
32
+ "t:cons": "node exemplos/consulta.js",
32
33
 
33
- "t:consult": "node testes/consulta.js"
34
+ "teste": "node testes/teste.js"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@types/axios": "^0.9.36",
package/src/utils/make.ts CHANGED
@@ -63,23 +63,38 @@ class Make {
63
63
  }
64
64
 
65
65
  tagRefNFe(obj: any) {
66
- throw "Não implementado!";
66
+ if (typeof this.#NFe.infNFe.ide.NFref == "undefined") {
67
+ this.#NFe.infNFe.ide.NFref = new Array();
68
+ }
69
+ this.#NFe.infNFe.ide.NFref.push({ refNFe: obj });
67
70
  }
68
71
 
69
72
  tagRefNF(obj: any) {
70
- throw "Não implementado!";
73
+ if (typeof this.#NFe.infNFe.ide.NFref == "undefined") {
74
+ this.#NFe.infNFe.ide.NFref = new Array();
75
+ }
76
+ this.#NFe.infNFe.ide.NFref.push({ refNF: obj });
71
77
  }
72
78
 
73
79
  tagRefNFP(obj: any) {
74
- throw "Não implementado!";
80
+ if (typeof this.#NFe.infNFe.ide.NFref == "undefined") {
81
+ this.#NFe.infNFe.ide.NFref = new Array();
82
+ }
83
+ this.#NFe.infNFe.ide.NFref.push({ refNFP: obj });
75
84
  }
76
85
 
77
86
  tagRefCTe(obj: any) {
78
- throw "Não implementado!";
87
+ if (typeof this.#NFe.infNFe.ide.NFref == "undefined") {
88
+ this.#NFe.infNFe.ide.NFref = new Array();
89
+ }
90
+ this.#NFe.infNFe.ide.NFref.push({ refCTe: obj });
79
91
  }
80
92
 
81
93
  tagRefECF(obj: any) {
82
- throw "Não implementado!";
94
+ if (typeof this.#NFe.infNFe.ide.NFref == "undefined") {
95
+ this.#NFe.infNFe.ide.NFref = new Array();
96
+ }
97
+ this.#NFe.infNFe.ide.NFref.push({ refECF: obj });
83
98
  }
84
99
 
85
100
  tagEmit(obj: any) {
@@ -119,11 +134,17 @@ class Make {
119
134
  }
120
135
 
121
136
  tagRetirada(obj: any) {
122
- throw "não implementado!";
137
+ this.#NFe.infNFe.retirada = {};
138
+ Object.keys(obj).forEach(key => {
139
+ this.#NFe.infNFe.retirada[key] = obj[key];
140
+ });
123
141
  }
124
142
 
125
143
  tagAutXML(obj: any) {
126
- throw "não implementado!";
144
+ if (typeof this.#NFe.infNFe.autXML == "undefined") {
145
+ this.#NFe.infNFe.autXML = new Array();
146
+ }
147
+ this.#NFe.infNFe.autXML.push(obj);
127
148
  }
128
149
 
129
150
  //tagprod
@@ -159,8 +180,10 @@ class Make {
159
180
  throw "não implementado!";
160
181
  }
161
182
 
162
- taginfAdProd(obj: any) {
163
- throw "não implementado!";
183
+ taginfAdProd(index: any, obj: any) {
184
+ Object.keys(obj).forEach(key => {
185
+ this.#NFe.infNFe.det[index][key] = obj[key];
186
+ });
164
187
  }
165
188
 
166
189
  tagCEST(obj: any) {
@@ -171,8 +194,26 @@ class Make {
171
194
  throw "não implementado!";
172
195
  }
173
196
 
174
- tagAdi(obj: any) {
175
- throw "não implementado!";
197
+ tagDI(index: any, obj: any) {
198
+ if (this.#NFe.infNFe.det[index].DI === undefined) this.#NFe.infNFe.det[index].DI = {};
199
+ Object.keys(obj).forEach(key => {
200
+ this.#NFe.infNFe.det[index].DI[key] = obj[key];
201
+ });
202
+
203
+ //Adicionar ao imposto global
204
+ this.#calICMSTot(obj);
205
+ }
206
+
207
+ tagAdi(index: any, obj: any) {
208
+ if (this.#NFe.infNFe.det[index].DI === undefined) this.#NFe.infNFe.det[index].DI = {};
209
+ if (this.#NFe.infNFe.det[index].DI.adi === undefined) this.#NFe.infNFe.det[index].DI.adi = {};
210
+
211
+ Object.keys(obj).forEach(key => {
212
+ this.#NFe.infNFe.det[index].DI.adi[key] = obj[key];
213
+ });
214
+
215
+ //Adicionar ao imposto global
216
+ this.#calICMSTot(obj);
176
217
  }
177
218
 
178
219
  tagDetExport(obj: any) {
@@ -594,9 +635,8 @@ class Make {
594
635
  throw "Ainda não configurado!";
595
636
  }
596
637
 
597
-
638
+ //Sistema gera a chave da nota fiscal
598
639
  #gerarChaveNFe() {
599
-
600
640
  const chaveSemDV =
601
641
  this.#NFe.infNFe.ide.cUF.padStart(2, '0') + // Código da UF (2 dígitos)
602
642
  this.#NFe.infNFe.ide.dhEmi.substring(2, 4) + this.#NFe.infNFe.ide.dhEmi.substring(5, 7) + // Ano e Mês da emissão (AAMM, 4 dígitos)
@@ -641,10 +681,10 @@ class Make {
641
681
 
642
682
  //Adicionar QrCode
643
683
  if (this.#NFe.infNFe.ide.mod == 65) {
644
- //Como ja temos cUF, usamo dados do extras para convere em UF e achar os dados de url!
684
+ //Como ja temos cUF, vamos usar o extras.cUF2UF
645
685
  let tempUF = urlEventos(cUF2UF[this.#NFe.infNFe.ide.cUF], this.#NFe.infNFe['@versao']);
646
686
  this.#NFe.infNFeSupl = {
647
- qrCode: tempUF.mod65[this.#NFe.infNFe.ide.tpAmb == 1 ? 'producao' : 'homologacao'].NFeConsultaQR,
687
+ qrCode: tempUF.mod65[this.#NFe.infNFe.ide.tpAmb == 1 ? 'producao' : 'homologacao'].NFeConsultaQR, //Este não e o valor final, vamos utilizar apenas para carregar os dados que vão ser utlizados no make
648
688
  urlChave: tempUF.mod65[this.#NFe.infNFe.ide.tpAmb == 1 ? 'producao' : 'homologacao'].urlChave
649
689
  }
650
690
  }
@@ -656,6 +696,7 @@ class Make {
656
696
  return tempBuild.build({ NFe: this.#NFe });
657
697
  }
658
698
 
699
+ //Obtem os dados de importo e soma no total, utlizado sempre que for setado algum imposto.
659
700
  #calICMSTot(obj: any) {
660
701
  Object.keys(obj).map(key => {
661
702
  if (this.#ICMSTot[key] !== undefined) {
@@ -183,7 +183,7 @@ class Tools {
183
183
  }
184
184
 
185
185
  this.json2xml(xml).then(async res => {
186
- this.#xmlValido(res, `nfe_${this.#config.versao}`);
186
+ this.#xmlValido(res, `nfe_v${this.#config.versao}`);
187
187
  resvol(res);
188
188
  }).catch(err => {
189
189
  reject(err)
@@ -191,7 +191,8 @@ class Tools {
191
191
  })
192
192
  }
193
193
 
194
- #gerarQRCodeNFCe(NFe: any, versaoQRCode: string = "2", idCSC: string, CSC: string) {
194
+ //Gerar QRCode da NFCe
195
+ #gerarQRCodeNFCe(NFe: any, versaoQRCode: string = "2", idCSC: string, CSC: string): string {
195
196
  let s = '|',
196
197
  concat,
197
198
  hash;
@@ -217,12 +218,14 @@ class Tools {
217
218
  })
218
219
  }
219
220
 
220
- async getCertificado() {
221
+ //Obter certificado
222
+ async getCertificado(): Promise<object> {
221
223
  return new Promise(async (resvol, reject) => {
222
224
  this.#certTools().then(resvol).catch(reject)
223
225
  })
224
226
  }
225
227
 
228
+ //Consulta NFe
226
229
  consultarNFe(chNFe: string): Promise<string> {
227
230
  return new Promise(async (resolve, reject) => {
228
231
  if (!chNFe || chNFe.length !== 44) {