@devlas/dte-sii 2.5.10 → 2.5.11
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 +34 -0
- package/SiiPortalAuth.js +12 -6
- package/cert/MuestrasImpresas.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,6 +78,40 @@ console.log(resultado.trackId)
|
|
|
78
78
|
|
|
79
79
|
Soporta `'certificacion'` y `'produccion'`. Pasarlo al instanciar `EnviadorSII`.
|
|
80
80
|
|
|
81
|
+
## Estados SII — Interpretación de respuestas
|
|
82
|
+
|
|
83
|
+
`EnviadorSII` interpreta automáticamente los códigos del SII en tres categorías:
|
|
84
|
+
|
|
85
|
+
### QueryEstUp — Estado del sobre de envío
|
|
86
|
+
|
|
87
|
+
| Código | Descripción | `esExitoso` | `esIntermedio` | `esRechazado` |
|
|
88
|
+
|--------|-------------|:-----------:|:--------------:|:-------------:|
|
|
89
|
+
| `EPR` | Envío Procesado | ✅ | | |
|
|
90
|
+
| `RPR` | Procesado con Reparos | ✅ | | |
|
|
91
|
+
| `REC` / `SOK` / `FOK` / `CRT` / `PRD` / `PDR` | En proceso de validación | | ✅ | |
|
|
92
|
+
| `RSC` | Error en Schema XML | | | ✅ |
|
|
93
|
+
| `RFR` | Error en Firma Digital | | | ✅ |
|
|
94
|
+
| `RCT` | Error en Carátula | | | ✅ |
|
|
95
|
+
|
|
96
|
+
### QueryEstDte — Estado del DTE individual
|
|
97
|
+
|
|
98
|
+
| Código | Descripción | Clasificación |
|
|
99
|
+
|--------|-------------|---------------|
|
|
100
|
+
| `DOK` | Datos coinciden | ✅ Exitoso |
|
|
101
|
+
| `DNK` | Datos no coinciden | ⏳ Intermedio |
|
|
102
|
+
| `FAU` | Folio no autorizado | ❌ Rechazado |
|
|
103
|
+
| `FNA` | Emisor no habilitado | ❌ Rechazado |
|
|
104
|
+
| `FAN` / `AND` / `ANC` | Anulado | ❌ Rechazado |
|
|
105
|
+
| `EMP` | Empresa sin autorización | ❌ Rechazado |
|
|
106
|
+
|
|
107
|
+
### Códigos negativos (errores de consulta)
|
|
108
|
+
|
|
109
|
+
Los códigos `-1` a `-14` son **errores del servidor de consulta SII**, no implican rechazo del documento. Todos resultan en `esIntermedio = true` y se pueden reintentar.
|
|
110
|
+
|
|
111
|
+
> Ver `docs/README.md` en el repositorio para la tabla completa de estados con descripción detallada.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
81
115
|
## Licencia
|
|
82
116
|
|
|
83
117
|
MIT — Copyright (c) 2026 [Devlas SpA](https://devlas.cl)
|
package/SiiPortalAuth.js
CHANGED
|
@@ -326,7 +326,7 @@ class SiiPortalAuth {
|
|
|
326
326
|
* @param {string} rutEmpresa - RUT sin DV (ej: "78206276")
|
|
327
327
|
* @param {string} dvEmpresa - DV (ej: "K")
|
|
328
328
|
* @param {Object} [cookieJar] - Sesión autenticada (si omite, autenticará)
|
|
329
|
-
* @returns {Promise<Object>} { rut, razonSocial, direccion, comuna, acteco, glosa }
|
|
329
|
+
* @returns {Promise<Object>} { rut, razonSocial, direccion, comuna, dirReg, acteco, glosa }
|
|
330
330
|
*/
|
|
331
331
|
async obtenerDatosContribuyente(rutEmpresa, dvEmpresa, cookieJar = null) {
|
|
332
332
|
const jar = cookieJar || await this.autenticar();
|
|
@@ -395,14 +395,20 @@ class SiiPortalAuth {
|
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
+
const dirReg = datos['DIRECCIÓN REGIONAL DEL CONTRIBUYENTE'] || datos['DIRECCION REGIONAL DEL CONTRIBUYENTE'] || null;
|
|
399
|
+
const glosa = datos['GLOSA DESCRIPTIVA'] || null;
|
|
400
|
+
|
|
398
401
|
return {
|
|
399
|
-
rut:
|
|
400
|
-
razonSocial:
|
|
402
|
+
rut: datos['DATOS DEL CONTRIBUYENTE RUT'] || null,
|
|
403
|
+
razonSocial: datos['NOMBRE O RAZÓN SOCIAL'] || datos['NOMBRE O RAZON SOCIAL'] || null,
|
|
404
|
+
giro: actividades[0]?.descripcion || null, // descripción de la primera actividad económica
|
|
401
405
|
direccion,
|
|
402
406
|
comuna,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
407
|
+
dirReg,
|
|
408
|
+
sucursal_sii: dirReg ? `S.I.I. - ${dirReg}` : null,
|
|
409
|
+
acteco: actividades[0]?.codigo || null,
|
|
410
|
+
actividades: actividades.length ? actividades : null,
|
|
411
|
+
glosa,
|
|
406
412
|
};
|
|
407
413
|
}
|
|
408
414
|
|
package/cert/MuestrasImpresas.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Copyright (c) 2026 Devlas SpA — https://devlas.cl
|
|
2
|
-
// Licencia MIT. Ver archivo LICENSE para mas detalles.
|
|
1
|
+
// Copyright (c) 2026 Devlas SpA — https://devlas.cl
|
|
2
|
+
// Licencia MIT. Ver archivo LICENSE para mas detalles.
|
|
3
3
|
/**
|
|
4
4
|
* MuestrasImpresas.js
|
|
5
5
|
*
|
|
@@ -208,7 +208,7 @@ class MuestrasImpresas {
|
|
|
208
208
|
* @param {string} tedXml - XML del TED
|
|
209
209
|
* @returns {Promise<string>} Data URI de la imagen PNG
|
|
210
210
|
*/
|
|
211
|
-
async generarPdf417(tedXml) {
|
|
211
|
+
async generarPdf417(tedXml, height = 12) {
|
|
212
212
|
if (!tedXml || !tedXml.includes('<TED')) {
|
|
213
213
|
throw new Error('No se encontró TED para generar PDF417');
|
|
214
214
|
}
|
|
@@ -223,7 +223,7 @@ class MuestrasImpresas {
|
|
|
223
223
|
bcid: 'pdf417',
|
|
224
224
|
text: binaryString,
|
|
225
225
|
scale: 3,
|
|
226
|
-
height
|
|
226
|
+
height,
|
|
227
227
|
padding: 6,
|
|
228
228
|
includetext: false,
|
|
229
229
|
// CRÍTICO: Indicar a bwip-js que el texto ya está en formato binario 8-bit
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devlas/dte-sii",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.11",
|
|
4
4
|
"description": "Facturación y boletas electrónicas para el SII de Chile. Genera, timbra, firma y envía DTEs, libros electrónicos y automatiza la certificación.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "dte-sii.d.ts",
|