node-sped-nfe 1.0.4 → 1.0.6
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 +2 -0
- package/dist/utils/eventos.d.ts +5 -1
- package/dist/utils/eventos.js +1459 -9
- package/dist/utils/extras.d.ts +2 -0
- package/dist/utils/extras.js +58 -0
- package/dist/utils/make.js +13 -123
- package/dist/utils/tools.d.ts +6 -3
- package/dist/utils/tools.js +103 -26
- package/exemplos/consulta.js +19 -0
- package/exemplos/nfce.js +165 -0
- package/{testes → exemplos}/nfe.js +11 -5
- package/exemplos/status.js +19 -0
- package/package.json +10 -6
- package/schemas/leiauteNFe_v4.00.xsd +5 -5
- package/src/utils/eventos.ts +1466 -11
- package/src/utils/extras.ts +59 -0
- package/src/utils/make.ts +13 -124
- package/src/utils/tools.ts +125 -33
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utils/sefaz.d.ts +0 -1
- package/dist/utils/sefaz.js +0 -64
- package/dist/utils/xmllint.d.ts +0 -4
- package/dist/utils/xmllint.js +0 -234520
- package/saida.txt +0 -0
- package/src/utils/schemas/consReciNFe_v4.00.xsd +0 -9
- package/src/utils/schemas/consSitNFe_v4.00.xsd +0 -9
- package/src/utils/schemas/consStatServ_v4.00.xsd +0 -9
- package/src/utils/schemas/enviNFe_v4.00.xsd +0 -9
- package/src/utils/schemas/inutNFe_v4.00.xsd +0 -9
- package/src/utils/schemas/leiauteConsSitNFe_v4.00.xsd +0 -502
- package/src/utils/schemas/leiauteConsStatServ_v4.00.xsd +0 -98
- package/src/utils/schemas/leiauteInutNFe_v4.00.xsd +0 -193
- package/src/utils/schemas/leiauteNFe_v4.00.xsd +0 -7412
- package/src/utils/schemas/nfe_v4.00.xsd +0 -9
- package/src/utils/schemas/procInutNFe_v4.00.xsd +0 -9
- package/src/utils/schemas/procNFe_v4.00.xsd +0 -9
- package/src/utils/schemas/retConsReciNFe_v4.00.xsd +0 -9
- package/src/utils/schemas/retConsSitNFe_v4.00.xsd +0 -9
- package/src/utils/schemas/retConsStatServ_v4.00.xsd +0 -9
- package/src/utils/schemas/retEnviNFe_v4.00.xsd +0 -9
- package/src/utils/schemas/retInutNFe_v4.00.xsd +0 -9
- package/src/utils/schemas/tiposBasico_v4.00.xsd +0 -598
- package/src/utils/schemas/xmldsig-core-schema_v1.01.xsd +0 -98
- package/testes/assinar.js +0 -16
- package/testes/nfe.json +0 -194
- package/testes/nfe_teste.json +0 -45
@@ -1,12 +1,13 @@
|
|
1
1
|
import { Make, Tools } from "../dist/index.js"
|
2
2
|
import fs from "fs";
|
3
|
-
//let xml = fs.readFileSync("./nfe.xml", { encoding: "utf-8" });
|
4
|
-
//fs.writeFileSync("./nfe.json", JSON.stringify(convert(xml, { format: 'object' })), { encoding: "utf-8" });
|
5
3
|
|
6
4
|
let myTools = new Tools({ //Configuração de habiente e sistema
|
7
5
|
mod: '55',
|
8
6
|
tpAmb: 2,
|
9
|
-
|
7
|
+
UF: 'MT',
|
8
|
+
versao: '4.00',
|
9
|
+
|
10
|
+
//Optativo: Leia sobre Requisitos.
|
10
11
|
xmllint: `../libxml2-2.9.3-win32-x86_64/bin/xmllint.exe`
|
11
12
|
}, { //Certificado digital
|
12
13
|
pfx: '../certificado.pfx',
|
@@ -139,6 +140,8 @@ NFe.tagProd([
|
|
139
140
|
"indTot": 1
|
140
141
|
}
|
141
142
|
]);
|
143
|
+
|
144
|
+
//Setor o imposto de cada produto.
|
142
145
|
[0, 1, 2, 3].map((value, index) => {
|
143
146
|
NFe.tagProdICMSSN(index, { orig: "0", CSOSN: "400" })
|
144
147
|
NFe.tagProdPIS(index, { CST: "49", qBCProd: "0.0000", vAliqProd: "0.0000", vPIS: "0.00" })
|
@@ -149,9 +152,12 @@ NFe.tagTransp({ modFrete: 9 });
|
|
149
152
|
NFe.tagDetPag([{ indPag: 0, tPag: 17, vPag: "1200.00" }]);
|
150
153
|
NFe.tagTroco("0.00");
|
151
154
|
NFe.tagInfRespTec({ CNPJ: "47506306000188", xContato: "Guara Dev", email: "admin@guaradev.com", fone: "5566999638922" })
|
152
|
-
fs.writeFileSync("nfe.xml", NFe.xml(), { encoding: "utf-8" });
|
155
|
+
fs.writeFileSync("testes/nfe.xml", NFe.xml(), { encoding: "utf-8" });
|
156
|
+
|
157
|
+
//NFe.xml() = retorna o XML gerado ate o momento.
|
158
|
+
// myTools.xmlSign(..) = Assina o xml utlizando o certificado declarado em new Tools.
|
153
159
|
myTools.xmlSign(NFe.xml()).then(async xmlSign => {
|
154
|
-
fs.writeFileSync("nfe_sign.xml", xmlSign, { encoding: "utf-8" });
|
160
|
+
fs.writeFileSync("testes/nfe_sign.xml", xmlSign, { encoding: "utf-8" });
|
155
161
|
myTools.sefazEnviaLote(xmlSign, { indSinc: 1 }).then(res => {
|
156
162
|
console.log(res)
|
157
163
|
})
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Tools } from "../dist/index.js"
|
2
|
+
import fs from "fs";
|
3
|
+
|
4
|
+
let myTools = new Tools({ //Configuração de habiente e sistema
|
5
|
+
mod: '65',
|
6
|
+
tpAmb: 2,
|
7
|
+
UF: 'MT',
|
8
|
+
versao: "4.00",
|
9
|
+
|
10
|
+
//Optativo: Leia sobre Requisitos.
|
11
|
+
xmllint: `../libxml2-2.9.3-win32-x86_64/bin/xmllint.exe`
|
12
|
+
}, { //Certificado digital
|
13
|
+
pfx: '../certificado.pfx',
|
14
|
+
senha: fs.readFileSync('../senha.txt', { encoding: "utf8" }),
|
15
|
+
});
|
16
|
+
|
17
|
+
myTools.sefazStatus().then(res=>{
|
18
|
+
console.log(res)
|
19
|
+
})
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "node-sped-nfe",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.6",
|
4
4
|
"author": "Kalmon V. Tavares",
|
5
5
|
"type": "module",
|
6
6
|
"main": "dist/index.js",
|
@@ -25,7 +25,12 @@
|
|
25
25
|
},
|
26
26
|
"scripts": {
|
27
27
|
"build": "tsc > saida.txt",
|
28
|
-
|
28
|
+
|
29
|
+
"t:status": "node exemplos/status.js",
|
30
|
+
"t:nfe": "node exemplos/nfe.js",
|
31
|
+
"t:nfce": "node exemplos/nfce.js",
|
32
|
+
|
33
|
+
"t:consult": "node testes/consulta.js"
|
29
34
|
},
|
30
35
|
"devDependencies": {
|
31
36
|
"@types/axios": "^0.9.36",
|
@@ -33,18 +38,17 @@
|
|
33
38
|
"@types/node-forge": "^1.3.11",
|
34
39
|
"@types/pem": "^1.14.4",
|
35
40
|
"@types/tmp": "^0.2.6",
|
41
|
+
"@types/xmldom": "^0.1.34",
|
36
42
|
"typescript": "^5.0.0"
|
37
43
|
},
|
38
44
|
"dependencies": {
|
39
45
|
"crypto": "^1.0.1",
|
40
46
|
"fast-xml-parser": "^4.5.1",
|
41
|
-
"node-forge": "^1.3.1",
|
42
47
|
"pem": "^1.14.8",
|
43
|
-
"tmp": "^0.2.3"
|
44
|
-
"xml-crypto": "^6.0.0"
|
48
|
+
"tmp": "^0.2.3"
|
45
49
|
},
|
46
50
|
"repository": {
|
47
51
|
"type": "git",
|
48
52
|
"url": "https://github.com/kalmonv/node-sped-nfe.git"
|
49
53
|
}
|
50
|
-
}
|
54
|
+
}
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<!-- PL_009l_NT2023_002_v100 - Alteração de Schema para evitar caracteres inválidos -->
|
18
18
|
<!-- PL_009m_NT2019_001_v155 - Inclusão de campos para Crédito Presumido e Redução da base de cálculo -->
|
19
19
|
<!-- PL_009m_NT2023_004_v101 - Informações de Pagamentos e Outros -->
|
20
|
-
<!--
|
20
|
+
<!-- PL_009p_NT2024_003_v103 - Produtos agropecuários -->
|
21
21
|
<xs:schema xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:editix="http://www.portalfiscal.inf.br/nfe" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
22
22
|
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema_v1.01.xsd"/>
|
23
23
|
<xs:include schemaLocation="tiposBasico_v4.00.xsd"/>
|
@@ -6292,7 +6292,7 @@ tipo de ato concessório:
|
|
6292
6292
|
</xs:annotation>
|
6293
6293
|
<xs:complexType>
|
6294
6294
|
<xs:choice>
|
6295
|
-
<xs:element name="defensivo">
|
6295
|
+
<xs:element name="defensivo" maxOccurs="20">
|
6296
6296
|
<xs:annotation>
|
6297
6297
|
<xs:documentation>Defensivo Agrícola / Agrotóxico</xs:documentation>
|
6298
6298
|
</xs:annotation>
|
@@ -6303,8 +6303,8 @@ tipo de ato concessório:
|
|
6303
6303
|
<xs:documentation>Número do Receituário ou Receita do Defensivo / Agrotóxico</xs:documentation>
|
6304
6304
|
</xs:annotation>
|
6305
6305
|
<xs:simpleType>
|
6306
|
-
<xs:restriction base="
|
6307
|
-
<xs:maxLength value="
|
6306
|
+
<xs:restriction base="TString">
|
6307
|
+
<xs:maxLength value="30"/>
|
6308
6308
|
<xs:minLength value="1"/>
|
6309
6309
|
</xs:restriction>
|
6310
6310
|
</xs:simpleType>
|
@@ -6340,7 +6340,7 @@ tipo de ato concessório:
|
|
6340
6340
|
</xs:restriction>
|
6341
6341
|
</xs:simpleType>
|
6342
6342
|
</xs:element>
|
6343
|
-
<xs:element name="UFGuia" type="TUfEmi"
|
6343
|
+
<xs:element name="UFGuia" type="TUfEmi"/>
|
6344
6344
|
<xs:element name="serieGuia" minOccurs="0">
|
6345
6345
|
<xs:annotation>
|
6346
6346
|
<xs:documentation>Série da Guia</xs:documentation>
|