keycae-ts 1.2.0 → 1.3.1
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 +27 -7
- package/dist/index.d.ts +10 -0
- package/package.json +1 -1
- package/src/index.ts +10 -0
package/README.md
CHANGED
|
@@ -27,17 +27,17 @@ const client = new KeyCaeClient('sk_test_public_sandbox_cuit_20999999999');
|
|
|
27
27
|
// O para producción: const client = new KeyCaeClient('sk_live_tu_api_key');
|
|
28
28
|
|
|
29
29
|
// Consultar contribuyente
|
|
30
|
-
const taxpayer = await client.getTaxpayer('
|
|
30
|
+
const taxpayer = await client.getTaxpayer('20999999999');
|
|
31
31
|
console.log(`${taxpayer.nombre} | ${taxpayer.estado}`);
|
|
32
32
|
|
|
33
33
|
// Verificar qué tipos de factura puede emitir
|
|
34
|
-
const capability = await client.checkEmissionCapability('
|
|
34
|
+
const capability = await client.checkEmissionCapability('20999999999');
|
|
35
35
|
console.log(`Tipos compatibles: ${capability.compatible_types.join(', ')}`);
|
|
36
36
|
console.log(capability.recommendation);
|
|
37
37
|
|
|
38
38
|
// Emitir factura
|
|
39
39
|
const invoice = await client.emitInvoice({
|
|
40
|
-
cuit_emisor: '
|
|
40
|
+
cuit_emisor: '20999999999',
|
|
41
41
|
punto_de_venta: 1,
|
|
42
42
|
tipo_comprobante: 'B',
|
|
43
43
|
receptor: { tipo_doc: 'CUIT', nro_doc: '20333444555' },
|
|
@@ -54,7 +54,7 @@ Por defecto `conceptos[].precio` se envía con IVA incluido. Si tu sistema manej
|
|
|
54
54
|
|
|
55
55
|
```typescript
|
|
56
56
|
const invoice = await client.emitInvoice({
|
|
57
|
-
cuit_emisor: '
|
|
57
|
+
cuit_emisor: '20999999999',
|
|
58
58
|
punto_de_venta: 1,
|
|
59
59
|
tipo_comprobante: 'A',
|
|
60
60
|
iva_incluido: false, // conceptos[].precio son netos
|
|
@@ -64,6 +64,26 @@ const invoice = await client.emitInvoice({
|
|
|
64
64
|
// → Neto $1.000 | IVA 21% $210 | Total $1.210
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
### Datos fiscales del emisor en el PDF
|
|
68
|
+
|
|
69
|
+
Los datos del emisor que se imprimen en el PDF (razón social, domicilio, Ingresos Brutos, inicio de actividades) se pueden enviar **por comprobante**. Tienen prioridad sobre la configuración de la cuenta y **no requieren cuenta ni login** (funcionan también en sandbox):
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
const invoice = await client.emitInvoice({
|
|
73
|
+
cuit_emisor: '20999999999',
|
|
74
|
+
punto_de_venta: 1,
|
|
75
|
+
tipo_comprobante: 'B',
|
|
76
|
+
emisor_razon_social: 'Mi Empresa S.A.',
|
|
77
|
+
emisor_ingresos_brutos: '901-999999-9',
|
|
78
|
+
emisor_direccion: 'Av. Corrientes 1500, CABA',
|
|
79
|
+
emisor_inicio_actividades: '01/03/2021',
|
|
80
|
+
receptor: { tipo_doc: 'SIN_IDENTIFICAR', nro_doc: '0' },
|
|
81
|
+
conceptos: [{ descripcion: 'Producto', precio: 1210 }]
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Los cuatro campos `emisor_*` son opcionales; enviá sólo los que quieras que aparezcan.
|
|
86
|
+
|
|
67
87
|
## Modelos de Conexión
|
|
68
88
|
|
|
69
89
|
### Modalidad A: Delegación Directa (Recomendada)
|
|
@@ -71,7 +91,7 @@ Sin certificados, sin llaves privadas. En minutos facturás.
|
|
|
71
91
|
|
|
72
92
|
```typescript
|
|
73
93
|
const delegation = await client.createDelegation({
|
|
74
|
-
cuit: '
|
|
94
|
+
cuit: '20999999999',
|
|
75
95
|
organization: 'Tu Empresa'
|
|
76
96
|
});
|
|
77
97
|
```
|
|
@@ -81,7 +101,7 @@ Generación segura de claves RSA y CSR.
|
|
|
81
101
|
|
|
82
102
|
```typescript
|
|
83
103
|
const credential = await client.createCredential({
|
|
84
|
-
cuit: '
|
|
104
|
+
cuit: '20999999999',
|
|
85
105
|
organization: 'Tu Empresa'
|
|
86
106
|
});
|
|
87
107
|
```
|
|
@@ -91,7 +111,7 @@ Subida directa de certificados (.crt) y llaves (.key).
|
|
|
91
111
|
|
|
92
112
|
```typescript
|
|
93
113
|
await client.importCredential({
|
|
94
|
-
cuit: '
|
|
114
|
+
cuit: '20999999999',
|
|
95
115
|
organization: 'Tu Empresa',
|
|
96
116
|
certificate: certificatePem,
|
|
97
117
|
private_key: privateKeyPem
|
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,16 @@ export interface InvoiceInput {
|
|
|
68
68
|
opcionales?: Opcional[];
|
|
69
69
|
brand_logo_url?: string;
|
|
70
70
|
brand_color?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Datos fiscales del emisor a imprimir en el PDF. Override por comprobante:
|
|
73
|
+
* tienen prioridad sobre la configuración de la cuenta (Personalizar PDF) y
|
|
74
|
+
* no requieren cuenta ni login, por lo que funcionan también desde sandbox.
|
|
75
|
+
* Cada campo se resuelve de forma independiente.
|
|
76
|
+
*/
|
|
77
|
+
emisor_razon_social?: string;
|
|
78
|
+
emisor_direccion?: string;
|
|
79
|
+
emisor_ingresos_brutos?: string;
|
|
80
|
+
emisor_inicio_actividades?: string;
|
|
71
81
|
cbtes_asociados?: {
|
|
72
82
|
tipo: string | number;
|
|
73
83
|
punto_de_venta: number;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -83,6 +83,16 @@ export interface InvoiceInput {
|
|
|
83
83
|
opcionales?: Opcional[];
|
|
84
84
|
brand_logo_url?: string;
|
|
85
85
|
brand_color?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Datos fiscales del emisor a imprimir en el PDF. Override por comprobante:
|
|
88
|
+
* tienen prioridad sobre la configuración de la cuenta (Personalizar PDF) y
|
|
89
|
+
* no requieren cuenta ni login, por lo que funcionan también desde sandbox.
|
|
90
|
+
* Cada campo se resuelve de forma independiente.
|
|
91
|
+
*/
|
|
92
|
+
emisor_razon_social?: string;
|
|
93
|
+
emisor_direccion?: string;
|
|
94
|
+
emisor_ingresos_brutos?: string;
|
|
95
|
+
emisor_inicio_actividades?: string;
|
|
86
96
|
cbtes_asociados?: {
|
|
87
97
|
tipo: string | number;
|
|
88
98
|
punto_de_venta: number;
|