intifact 1.0.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 ADDED
@@ -0,0 +1,148 @@
1
+ # intifact
2
+
3
+ SDK TypeScript para la API de Facturación Electrónica SUNAT de [Intifact](https://intifact.com).
4
+
5
+ Emite facturas, boletas, notas de crédito/débito y guías de remisión electrónicas directamente desde tu aplicación.
6
+
7
+ ## Instalación
8
+
9
+ ```bash
10
+ npm install intifact
11
+ ```
12
+
13
+ ## Uso rápido
14
+
15
+ ```typescript
16
+ import { Intifact } from "intifact";
17
+
18
+ const client = new Intifact({
19
+ apiKey: "tu-api-key",
20
+ });
21
+
22
+ // Emitir una factura
23
+ const { data, error } = await client.sendInvoice({
24
+ tipoDoc: "01",
25
+ serie: "F001",
26
+ correlativo: "123",
27
+ fechaEmision: "2025-01-15T00:00:00-05:00",
28
+ client: {
29
+ tipoDoc: "6",
30
+ numDoc: "20000000001",
31
+ rznSocial: "Empresa SAC",
32
+ },
33
+ company: {
34
+ ruc: "20000000001",
35
+ },
36
+ details: [
37
+ {
38
+ codProducto: "P001",
39
+ unidad: "NIU",
40
+ cantidad: 2,
41
+ descripcion: "Producto de ejemplo",
42
+ mtoValorUnitario: 100,
43
+ },
44
+ ],
45
+ });
46
+
47
+ if (error) {
48
+ console.error("Error:", error);
49
+ } else {
50
+ console.log("Factura enviada:", data);
51
+ }
52
+ ```
53
+
54
+ ## Métodos disponibles
55
+
56
+ ### Facturas y Boletas
57
+
58
+ | Método | Descripción |
59
+ |--------|-------------|
60
+ | `sendInvoice(body)` | Enviar factura (01) o boleta (03) a SUNAT |
61
+ | `getInvoicePdf(id)` | Obtener PDF del comprobante |
62
+ | `getInvoiceXml(id)` | Obtener XML firmado |
63
+ | `getInvoiceCdr(id)` | Obtener CDR de SUNAT |
64
+ | `cancelInvoice(body)` | Comunicar baja de factura |
65
+ | `cancelBoleta(body)` | Comunicar baja de boleta |
66
+
67
+ ### Notas de Crédito / Débito
68
+
69
+ | Método | Descripción |
70
+ |--------|-------------|
71
+ | `sendNote(body)` | Enviar nota de crédito o débito |
72
+ | `getNotePdf(id)` | Obtener PDF de la nota |
73
+ | `getNoteXml(id)` | Obtener XML firmado |
74
+
75
+ ### Guías de Remisión
76
+
77
+ | Método | Descripción |
78
+ |--------|-------------|
79
+ | `sendDespatch(body)` | Enviar guía de remisión |
80
+ | `getDespatchPdf(id)` | Obtener PDF de la guía |
81
+ | `getDespatchXml(id)` | Obtener XML de la guía |
82
+
83
+ ### Resúmenes y Anulaciones
84
+
85
+ | Método | Descripción |
86
+ |--------|-------------|
87
+ | `sendSummary(body)` | Enviar resumen diario de boletas |
88
+ | `sendVoided(body)` | Enviar comunicación de baja |
89
+ | `getTicketStatus(ticket)` | Consultar estado de un ticket |
90
+
91
+ ### Documentos
92
+
93
+ | Método | Descripción |
94
+ |--------|-------------|
95
+ | `listDocuments(query?)` | Listar documentos emitidos |
96
+ | `getDocument(id)` | Obtener documento por ID |
97
+ | `retryDocument(id)` | Reintentar envío de documento fallido |
98
+ | `getNextCorrelativo(query)` | Obtener siguiente correlativo |
99
+
100
+ ### Empresas
101
+
102
+ | Método | Descripción |
103
+ |--------|-------------|
104
+ | `listCompanies()` | Listar empresas registradas |
105
+ | `createCompany(body)` | Registrar nueva empresa |
106
+ | `getCompany(id)` | Obtener datos de empresa |
107
+ | `updateCompany(id, body)` | Actualizar empresa |
108
+ | `uploadCertificate(id, body)` | Subir certificado digital |
109
+ | `uploadLogo(id, body)` | Subir logo (aparece en PDFs) |
110
+ | `getLogo(id)` | Obtener logo |
111
+ | `deleteLogo(id)` | Eliminar logo |
112
+
113
+ ### Webhooks
114
+
115
+ | Método | Descripción |
116
+ |--------|-------------|
117
+ | `listWebhooks()` | Listar webhooks |
118
+ | `createWebhook(body)` | Crear webhook |
119
+ | `getWebhook(id)` | Obtener webhook |
120
+ | `updateWebhook(id, body)` | Actualizar webhook |
121
+ | `deleteWebhook(id)` | Eliminar webhook |
122
+ | `listWebhookDeliveries(id)` | Listar entregas |
123
+ | `redeliverWebhook(endpointId, deliveryId)` | Re-enviar entrega |
124
+ | `testWebhook(id)` | Enviar evento de prueba |
125
+
126
+ ### Otros
127
+
128
+ | Método | Descripción |
129
+ |--------|-------------|
130
+ | `getUsage()` | Consumo actual del plan |
131
+ | `getQueueStats()` | Estado de las colas |
132
+ | `health()` | Verificar disponibilidad |
133
+ | `consultarDocumento(ruc, tipoDoc, serie, numero)` | Consulta pública de documento |
134
+ | `consultarDocumentoPdf(...)` | PDF de consulta pública |
135
+ | `consultarDocumentoXml(...)` | XML de consulta pública |
136
+
137
+ ## Configuración
138
+
139
+ ```typescript
140
+ const client = new Intifact({
141
+ apiKey: "tu-api-key",
142
+ baseUrl: "https://api.intifact.com", // opcional, default
143
+ });
144
+ ```
145
+
146
+ ## Licencia
147
+
148
+ MIT