arca-sdk 1.0.4 → 1.1.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/dist/index.d.cts CHANGED
@@ -152,8 +152,17 @@ interface WsfeConfig extends ArcaConfig {
152
152
  */
153
153
  declare enum InvoiceType {
154
154
  FACTURA_A = 1,
155
+ NOTA_DEBITO_A = 2,
156
+ NOTA_CREDITO_A = 3,
157
+ RECIBO_A = 4,
155
158
  FACTURA_B = 6,
159
+ NOTA_DEBITO_B = 7,
160
+ NOTA_CREDITO_B = 8,
161
+ RECIBO_B = 9,
156
162
  FACTURA_C = 11,
163
+ NOTA_DEBITO_C = 12,
164
+ NOTA_CREDITO_C = 13,
165
+ RECIBO_C = 15,
157
166
  TICKET_A = 81,
158
167
  TICKET_B = 82,
159
168
  TICKET_C = 83
@@ -208,6 +217,30 @@ interface Buyer {
208
217
  /** Número de documento (sin guiones) */
209
218
  docNumber: string;
210
219
  }
220
+ /**
221
+ * Comprobante asociado (Requerido al emitir Notas de Crédito/Débito)
222
+ */
223
+ interface AssociatedInvoice {
224
+ /** Tipo de comprobante original (ej. FACTURA_C) */
225
+ type: InvoiceType;
226
+ /** Punto de venta original */
227
+ pointOfSale: number;
228
+ /** Número de comprobante original */
229
+ invoiceNumber: number;
230
+ /** CUIT emisor (requerido a veces en MiPyME, opcional para resto) */
231
+ cuit?: string;
232
+ /** Fecha de emisión del comprobante original */
233
+ date?: Date;
234
+ }
235
+ /**
236
+ * Campo opcional de AFIP (ej. Condición IVA Receptor RG 5616)
237
+ */
238
+ interface InvoiceOptional {
239
+ /** ID del dato opcional (ej. 1010) */
240
+ id: string | number;
241
+ /** Valor del dato opcional */
242
+ value: string;
243
+ }
211
244
  /**
212
245
  * Request para emitir comprobante
213
246
  */
@@ -220,6 +253,8 @@ interface IssueInvoiceRequest {
220
253
  buyer?: Buyer;
221
254
  /** Items de la factura */
222
255
  items?: InvoiceItem[];
256
+ /** Comprobantes asociados (Obligatorio para Nota de Crédito/Débito) */
257
+ associatedInvoices?: AssociatedInvoice[];
223
258
  /** Monto total (requerido si no hay items) */
224
259
  total?: number;
225
260
  /** Desglose de IVA (requerido para Factura A/B) */
@@ -232,6 +267,8 @@ interface IssueInvoiceRequest {
232
267
  includesVAT?: boolean;
233
268
  /** Fecha del comprobante (default: hoy) */
234
269
  date?: Date;
270
+ /** Campos opcionales adjuntos (ej: Condición IVA receptor ID 1010) */
271
+ optionals?: InvoiceOptional[];
235
272
  }
236
273
  /**
237
274
  * Respuesta CAE (Código de Autorización Electrónico)
@@ -294,6 +331,8 @@ interface InvoiceDetails {
294
331
  caeExpiry: string;
295
332
  /** Resultado */
296
333
  result: 'A' | 'R';
334
+ /** Campos opcionales adjuntos */
335
+ optionals?: InvoiceOptional[];
297
336
  }
298
337
  /**
299
338
  * Punto de venta habilitado en ARCA
@@ -368,6 +407,7 @@ declare class WsfeService {
368
407
  total: number;
369
408
  concept?: BillingConcept;
370
409
  date?: Date;
410
+ optionals?: InvoiceOptional[];
371
411
  }): Promise<CAEResponse>;
372
412
  /**
373
413
  * Emite un Ticket C con detalle de items.
@@ -377,14 +417,19 @@ declare class WsfeService {
377
417
  items: InvoiceItem[];
378
418
  concept?: BillingConcept;
379
419
  date?: Date;
420
+ optionals?: InvoiceOptional[];
380
421
  }): Promise<CAEResponse>;
381
422
  /**
382
- * Emite una Factura C (consumidor final, sin discriminación de IVA).
423
+ * Emite una Factura A (Responsable Inscripto a Responsable Inscripto, con IVA discriminado).
424
+ * REQUIERE `vatRate` en todos los items.
383
425
  */
384
- issueInvoiceC(params: {
426
+ issueInvoiceA(params: {
385
427
  items: InvoiceItem[];
428
+ buyer: Buyer;
386
429
  concept?: BillingConcept;
387
430
  date?: Date;
431
+ includesVAT?: boolean;
432
+ optionals?: InvoiceOptional[];
388
433
  }): Promise<CAEResponse>;
389
434
  /**
390
435
  * Emite una Factura B (con IVA discriminado).
@@ -396,17 +441,125 @@ declare class WsfeService {
396
441
  concept?: BillingConcept;
397
442
  date?: Date;
398
443
  includesVAT?: boolean;
444
+ optionals?: InvoiceOptional[];
399
445
  }): Promise<CAEResponse>;
400
446
  /**
401
- * Emite una Factura A (Responsable Inscripto a Responsable Inscripto, con IVA discriminado).
402
- * REQUIERE `vatRate` en todos los items.
447
+ * Emite una Factura C (consumidor final, sin discriminación de IVA).
403
448
  */
404
- issueInvoiceA(params: {
449
+ issueInvoiceC(params: {
450
+ items: InvoiceItem[];
451
+ concept?: BillingConcept;
452
+ date?: Date;
453
+ buyer?: Buyer;
454
+ optionals?: InvoiceOptional[];
455
+ }): Promise<CAEResponse>;
456
+ /**
457
+ * Emite un Recibo A (con IVA discriminado).
458
+ */
459
+ issueReceiptA(params: {
460
+ items: InvoiceItem[];
461
+ buyer: Buyer;
462
+ concept?: BillingConcept;
463
+ date?: Date;
464
+ includesVAT?: boolean;
465
+ optionals?: InvoiceOptional[];
466
+ }): Promise<CAEResponse>;
467
+ /**
468
+ * Emite un Recibo B (con IVA discriminado).
469
+ */
470
+ issueReceiptB(params: {
471
+ items: InvoiceItem[];
472
+ buyer: Buyer;
473
+ concept?: BillingConcept;
474
+ date?: Date;
475
+ includesVAT?: boolean;
476
+ optionals?: InvoiceOptional[];
477
+ }): Promise<CAEResponse>;
478
+ /**
479
+ * Emite un Recibo C (sin discriminación de IVA).
480
+ */
481
+ issueReceiptC(params: {
482
+ items: InvoiceItem[];
483
+ concept?: BillingConcept;
484
+ date?: Date;
485
+ buyer?: Buyer;
486
+ optionals?: InvoiceOptional[];
487
+ }): Promise<CAEResponse>;
488
+ /**
489
+ * Emite una Nota de Crédito A.
490
+ * REQUIERE especificar la Factura A original en `associatedInvoices`.
491
+ */
492
+ issueCreditNoteA(params: {
493
+ items: InvoiceItem[];
494
+ buyer: Buyer;
495
+ associatedInvoices: AssociatedInvoice[];
496
+ concept?: BillingConcept;
497
+ date?: Date;
498
+ includesVAT?: boolean;
499
+ optionals?: InvoiceOptional[];
500
+ }): Promise<CAEResponse>;
501
+ /**
502
+ * Emite una Nota de Crédito B.
503
+ * REQUIERE especificar la Factura B original en `associatedInvoices`.
504
+ */
505
+ issueCreditNoteB(params: {
506
+ items: InvoiceItem[];
507
+ buyer: Buyer;
508
+ associatedInvoices: AssociatedInvoice[];
509
+ concept?: BillingConcept;
510
+ date?: Date;
511
+ includesVAT?: boolean;
512
+ optionals?: InvoiceOptional[];
513
+ }): Promise<CAEResponse>;
514
+ /**
515
+ * Emite una Nota de Crédito C.
516
+ * REQUIERE especificar la Factura C original en `associatedInvoices`.
517
+ */
518
+ issueCreditNoteC(params: {
519
+ items: InvoiceItem[];
520
+ associatedInvoices: AssociatedInvoice[];
521
+ concept?: BillingConcept;
522
+ date?: Date;
523
+ buyer?: Buyer;
524
+ optionals?: InvoiceOptional[];
525
+ }): Promise<CAEResponse>;
526
+ /**
527
+ * Emite una Nota de Débito A.
528
+ * REQUIERE especificar la Factura A original en `associatedInvoices`.
529
+ */
530
+ issueDebitNoteA(params: {
531
+ items: InvoiceItem[];
532
+ buyer: Buyer;
533
+ associatedInvoices: AssociatedInvoice[];
534
+ concept?: BillingConcept;
535
+ date?: Date;
536
+ includesVAT?: boolean;
537
+ optionals?: InvoiceOptional[];
538
+ }): Promise<CAEResponse>;
539
+ /**
540
+ * Emite una Nota de Débito B.
541
+ * REQUIERE especificar la Factura B original en `associatedInvoices`.
542
+ */
543
+ issueDebitNoteB(params: {
405
544
  items: InvoiceItem[];
406
545
  buyer: Buyer;
546
+ associatedInvoices: AssociatedInvoice[];
407
547
  concept?: BillingConcept;
408
548
  date?: Date;
409
549
  includesVAT?: boolean;
550
+ optionals?: InvoiceOptional[];
551
+ }): Promise<CAEResponse>;
552
+ /**
553
+ * Emite una Nota de Débito C.
554
+ * REQUIERE especificar la Factura C original en `associatedInvoices`.
555
+ */
556
+ issueDebitNoteC(params: {
557
+ items: InvoiceItem[];
558
+ associatedInvoices: AssociatedInvoice[];
559
+ concept?: BillingConcept;
560
+ date?: Date;
561
+ buyer?: Buyer;
562
+ optionals?: InvoiceOptional[];
410
563
  }): Promise<CAEResponse>;
411
564
  /**
412
565
  * Consulta un comprobante ya emitido (FECompConsultar).
@@ -419,6 +572,18 @@ declare class WsfeService {
419
572
  * Lista los puntos de venta habilitados para el CUIT autenticado (FEParamGetPtosVenta).
420
573
  */
421
574
  getPointsOfSale(): Promise<PointOfSale[]>;
575
+ /**
576
+ * Helper para emitir comprobantes tipo A/B que requieren IVA
577
+ */
578
+ private issueInvoiceWithVAT;
579
+ /**
580
+ * Helper para emitir comprobantes tipo C que no discriminan IVA
581
+ */
582
+ private issueInvoiceWithoutVAT;
583
+ /**
584
+ * Validación obligatoria para NC/ND
585
+ */
586
+ private validateAssociatedInvoices;
422
587
  /**
423
588
  * Método genérico interno para emitir cualquier tipo de comprobante.
424
589
  */
package/dist/index.d.ts CHANGED
@@ -152,8 +152,17 @@ interface WsfeConfig extends ArcaConfig {
152
152
  */
153
153
  declare enum InvoiceType {
154
154
  FACTURA_A = 1,
155
+ NOTA_DEBITO_A = 2,
156
+ NOTA_CREDITO_A = 3,
157
+ RECIBO_A = 4,
155
158
  FACTURA_B = 6,
159
+ NOTA_DEBITO_B = 7,
160
+ NOTA_CREDITO_B = 8,
161
+ RECIBO_B = 9,
156
162
  FACTURA_C = 11,
163
+ NOTA_DEBITO_C = 12,
164
+ NOTA_CREDITO_C = 13,
165
+ RECIBO_C = 15,
157
166
  TICKET_A = 81,
158
167
  TICKET_B = 82,
159
168
  TICKET_C = 83
@@ -208,6 +217,30 @@ interface Buyer {
208
217
  /** Número de documento (sin guiones) */
209
218
  docNumber: string;
210
219
  }
220
+ /**
221
+ * Comprobante asociado (Requerido al emitir Notas de Crédito/Débito)
222
+ */
223
+ interface AssociatedInvoice {
224
+ /** Tipo de comprobante original (ej. FACTURA_C) */
225
+ type: InvoiceType;
226
+ /** Punto de venta original */
227
+ pointOfSale: number;
228
+ /** Número de comprobante original */
229
+ invoiceNumber: number;
230
+ /** CUIT emisor (requerido a veces en MiPyME, opcional para resto) */
231
+ cuit?: string;
232
+ /** Fecha de emisión del comprobante original */
233
+ date?: Date;
234
+ }
235
+ /**
236
+ * Campo opcional de AFIP (ej. Condición IVA Receptor RG 5616)
237
+ */
238
+ interface InvoiceOptional {
239
+ /** ID del dato opcional (ej. 1010) */
240
+ id: string | number;
241
+ /** Valor del dato opcional */
242
+ value: string;
243
+ }
211
244
  /**
212
245
  * Request para emitir comprobante
213
246
  */
@@ -220,6 +253,8 @@ interface IssueInvoiceRequest {
220
253
  buyer?: Buyer;
221
254
  /** Items de la factura */
222
255
  items?: InvoiceItem[];
256
+ /** Comprobantes asociados (Obligatorio para Nota de Crédito/Débito) */
257
+ associatedInvoices?: AssociatedInvoice[];
223
258
  /** Monto total (requerido si no hay items) */
224
259
  total?: number;
225
260
  /** Desglose de IVA (requerido para Factura A/B) */
@@ -232,6 +267,8 @@ interface IssueInvoiceRequest {
232
267
  includesVAT?: boolean;
233
268
  /** Fecha del comprobante (default: hoy) */
234
269
  date?: Date;
270
+ /** Campos opcionales adjuntos (ej: Condición IVA receptor ID 1010) */
271
+ optionals?: InvoiceOptional[];
235
272
  }
236
273
  /**
237
274
  * Respuesta CAE (Código de Autorización Electrónico)
@@ -294,6 +331,8 @@ interface InvoiceDetails {
294
331
  caeExpiry: string;
295
332
  /** Resultado */
296
333
  result: 'A' | 'R';
334
+ /** Campos opcionales adjuntos */
335
+ optionals?: InvoiceOptional[];
297
336
  }
298
337
  /**
299
338
  * Punto de venta habilitado en ARCA
@@ -368,6 +407,7 @@ declare class WsfeService {
368
407
  total: number;
369
408
  concept?: BillingConcept;
370
409
  date?: Date;
410
+ optionals?: InvoiceOptional[];
371
411
  }): Promise<CAEResponse>;
372
412
  /**
373
413
  * Emite un Ticket C con detalle de items.
@@ -377,14 +417,19 @@ declare class WsfeService {
377
417
  items: InvoiceItem[];
378
418
  concept?: BillingConcept;
379
419
  date?: Date;
420
+ optionals?: InvoiceOptional[];
380
421
  }): Promise<CAEResponse>;
381
422
  /**
382
- * Emite una Factura C (consumidor final, sin discriminación de IVA).
423
+ * Emite una Factura A (Responsable Inscripto a Responsable Inscripto, con IVA discriminado).
424
+ * REQUIERE `vatRate` en todos los items.
383
425
  */
384
- issueInvoiceC(params: {
426
+ issueInvoiceA(params: {
385
427
  items: InvoiceItem[];
428
+ buyer: Buyer;
386
429
  concept?: BillingConcept;
387
430
  date?: Date;
431
+ includesVAT?: boolean;
432
+ optionals?: InvoiceOptional[];
388
433
  }): Promise<CAEResponse>;
389
434
  /**
390
435
  * Emite una Factura B (con IVA discriminado).
@@ -396,17 +441,125 @@ declare class WsfeService {
396
441
  concept?: BillingConcept;
397
442
  date?: Date;
398
443
  includesVAT?: boolean;
444
+ optionals?: InvoiceOptional[];
399
445
  }): Promise<CAEResponse>;
400
446
  /**
401
- * Emite una Factura A (Responsable Inscripto a Responsable Inscripto, con IVA discriminado).
402
- * REQUIERE `vatRate` en todos los items.
447
+ * Emite una Factura C (consumidor final, sin discriminación de IVA).
403
448
  */
404
- issueInvoiceA(params: {
449
+ issueInvoiceC(params: {
450
+ items: InvoiceItem[];
451
+ concept?: BillingConcept;
452
+ date?: Date;
453
+ buyer?: Buyer;
454
+ optionals?: InvoiceOptional[];
455
+ }): Promise<CAEResponse>;
456
+ /**
457
+ * Emite un Recibo A (con IVA discriminado).
458
+ */
459
+ issueReceiptA(params: {
460
+ items: InvoiceItem[];
461
+ buyer: Buyer;
462
+ concept?: BillingConcept;
463
+ date?: Date;
464
+ includesVAT?: boolean;
465
+ optionals?: InvoiceOptional[];
466
+ }): Promise<CAEResponse>;
467
+ /**
468
+ * Emite un Recibo B (con IVA discriminado).
469
+ */
470
+ issueReceiptB(params: {
471
+ items: InvoiceItem[];
472
+ buyer: Buyer;
473
+ concept?: BillingConcept;
474
+ date?: Date;
475
+ includesVAT?: boolean;
476
+ optionals?: InvoiceOptional[];
477
+ }): Promise<CAEResponse>;
478
+ /**
479
+ * Emite un Recibo C (sin discriminación de IVA).
480
+ */
481
+ issueReceiptC(params: {
482
+ items: InvoiceItem[];
483
+ concept?: BillingConcept;
484
+ date?: Date;
485
+ buyer?: Buyer;
486
+ optionals?: InvoiceOptional[];
487
+ }): Promise<CAEResponse>;
488
+ /**
489
+ * Emite una Nota de Crédito A.
490
+ * REQUIERE especificar la Factura A original en `associatedInvoices`.
491
+ */
492
+ issueCreditNoteA(params: {
493
+ items: InvoiceItem[];
494
+ buyer: Buyer;
495
+ associatedInvoices: AssociatedInvoice[];
496
+ concept?: BillingConcept;
497
+ date?: Date;
498
+ includesVAT?: boolean;
499
+ optionals?: InvoiceOptional[];
500
+ }): Promise<CAEResponse>;
501
+ /**
502
+ * Emite una Nota de Crédito B.
503
+ * REQUIERE especificar la Factura B original en `associatedInvoices`.
504
+ */
505
+ issueCreditNoteB(params: {
506
+ items: InvoiceItem[];
507
+ buyer: Buyer;
508
+ associatedInvoices: AssociatedInvoice[];
509
+ concept?: BillingConcept;
510
+ date?: Date;
511
+ includesVAT?: boolean;
512
+ optionals?: InvoiceOptional[];
513
+ }): Promise<CAEResponse>;
514
+ /**
515
+ * Emite una Nota de Crédito C.
516
+ * REQUIERE especificar la Factura C original en `associatedInvoices`.
517
+ */
518
+ issueCreditNoteC(params: {
519
+ items: InvoiceItem[];
520
+ associatedInvoices: AssociatedInvoice[];
521
+ concept?: BillingConcept;
522
+ date?: Date;
523
+ buyer?: Buyer;
524
+ optionals?: InvoiceOptional[];
525
+ }): Promise<CAEResponse>;
526
+ /**
527
+ * Emite una Nota de Débito A.
528
+ * REQUIERE especificar la Factura A original en `associatedInvoices`.
529
+ */
530
+ issueDebitNoteA(params: {
531
+ items: InvoiceItem[];
532
+ buyer: Buyer;
533
+ associatedInvoices: AssociatedInvoice[];
534
+ concept?: BillingConcept;
535
+ date?: Date;
536
+ includesVAT?: boolean;
537
+ optionals?: InvoiceOptional[];
538
+ }): Promise<CAEResponse>;
539
+ /**
540
+ * Emite una Nota de Débito B.
541
+ * REQUIERE especificar la Factura B original en `associatedInvoices`.
542
+ */
543
+ issueDebitNoteB(params: {
405
544
  items: InvoiceItem[];
406
545
  buyer: Buyer;
546
+ associatedInvoices: AssociatedInvoice[];
407
547
  concept?: BillingConcept;
408
548
  date?: Date;
409
549
  includesVAT?: boolean;
550
+ optionals?: InvoiceOptional[];
551
+ }): Promise<CAEResponse>;
552
+ /**
553
+ * Emite una Nota de Débito C.
554
+ * REQUIERE especificar la Factura C original en `associatedInvoices`.
555
+ */
556
+ issueDebitNoteC(params: {
557
+ items: InvoiceItem[];
558
+ associatedInvoices: AssociatedInvoice[];
559
+ concept?: BillingConcept;
560
+ date?: Date;
561
+ buyer?: Buyer;
562
+ optionals?: InvoiceOptional[];
410
563
  }): Promise<CAEResponse>;
411
564
  /**
412
565
  * Consulta un comprobante ya emitido (FECompConsultar).
@@ -419,6 +572,18 @@ declare class WsfeService {
419
572
  * Lista los puntos de venta habilitados para el CUIT autenticado (FEParamGetPtosVenta).
420
573
  */
421
574
  getPointsOfSale(): Promise<PointOfSale[]>;
575
+ /**
576
+ * Helper para emitir comprobantes tipo A/B que requieren IVA
577
+ */
578
+ private issueInvoiceWithVAT;
579
+ /**
580
+ * Helper para emitir comprobantes tipo C que no discriminan IVA
581
+ */
582
+ private issueInvoiceWithoutVAT;
583
+ /**
584
+ * Validación obligatoria para NC/ND
585
+ */
586
+ private validateAssociatedInvoices;
422
587
  /**
423
588
  * Método genérico interno para emitir cualquier tipo de comprobante.
424
589
  */