@scell/sdk 1.2.0 → 1.5.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.
Files changed (46) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +61 -2
  3. package/dist/index.d.mts +2353 -236
  4. package/dist/index.d.ts +2353 -236
  5. package/dist/index.js +1308 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +1308 -2
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/src/client.ts +3 -1
  11. package/src/errors.ts +0 -0
  12. package/src/index.ts +42 -2
  13. package/src/resources/api-keys.ts +0 -0
  14. package/src/resources/auth.ts +0 -0
  15. package/src/resources/balance.ts +0 -0
  16. package/src/resources/billing.ts +49 -0
  17. package/src/resources/companies.ts +0 -0
  18. package/src/resources/fiscal.ts +128 -0
  19. package/src/resources/invoices.ts +0 -0
  20. package/src/resources/signatures.ts +33 -0
  21. package/src/resources/stats.ts +29 -0
  22. package/src/resources/sub-tenants.ts +41 -0
  23. package/src/resources/tenant-credit-notes.ts +301 -0
  24. package/src/resources/tenant-direct-credit-notes.ts +360 -0
  25. package/src/resources/tenant-direct-invoices.ts +424 -0
  26. package/src/resources/tenant-incoming-invoices.ts +429 -0
  27. package/src/resources/webhooks.ts +0 -0
  28. package/src/tenant-client.ts +105 -0
  29. package/src/types/api-keys.ts +0 -0
  30. package/src/types/auth.ts +0 -0
  31. package/src/types/balance.ts +0 -0
  32. package/src/types/billing.ts +73 -0
  33. package/src/types/common.ts +0 -0
  34. package/src/types/companies.ts +0 -0
  35. package/src/types/fiscal.ts +251 -0
  36. package/src/types/index.ts +103 -0
  37. package/src/types/invoices.ts +0 -0
  38. package/src/types/signatures.ts +0 -0
  39. package/src/types/stats.ts +37 -0
  40. package/src/types/sub-tenants.ts +57 -0
  41. package/src/types/tenant-credit-notes.ts +128 -0
  42. package/src/types/tenant-invoices.ts +390 -0
  43. package/src/types/tenant-profile.ts +51 -0
  44. package/src/types/webhooks.ts +0 -0
  45. package/src/utils/retry.ts +0 -0
  46. package/src/utils/webhook-verify.ts +0 -0
package/dist/index.d.mts CHANGED
@@ -54,7 +54,7 @@ declare function createRetryWrapper(defaultOptions?: RetryOptions): <T>(fn: () =
54
54
  /**
55
55
  * Authentication mode
56
56
  */
57
- type AuthMode = 'bearer' | 'api-key';
57
+ type AuthMode = 'bearer' | 'api-key' | 'tenant-key';
58
58
  /**
59
59
  * Client configuration options
60
60
  */
@@ -243,6 +243,2313 @@ interface ApiErrorResponse {
243
243
  code?: string | undefined;
244
244
  }
245
245
 
246
+ /**
247
+ * Invoice direction
248
+ */
249
+ type InvoiceDirection = 'outgoing' | 'incoming';
250
+ /**
251
+ * Invoice output format
252
+ */
253
+ type InvoiceFormat = 'facturx' | 'ubl' | 'cii';
254
+ /**
255
+ * Invoice status
256
+ */
257
+ type InvoiceStatus = 'draft' | 'pending' | 'validated' | 'converted' | 'transmitted' | 'accepted' | 'rejected' | 'paid' | 'disputed' | 'cancelled' | 'error';
258
+ /**
259
+ * Invoice download file type
260
+ */
261
+ type InvoiceDownloadType = 'original' | 'converted' | 'pdf';
262
+ /**
263
+ * Invoice line item
264
+ */
265
+ interface InvoiceLine {
266
+ line_number: number;
267
+ description: string;
268
+ quantity: number;
269
+ unit_price: number;
270
+ tax_rate: number;
271
+ total_ht: number;
272
+ total_tax: number;
273
+ total_ttc: number;
274
+ }
275
+ /**
276
+ * Invoice party (seller or buyer)
277
+ */
278
+ interface InvoiceParty {
279
+ siret: Siret;
280
+ name: string;
281
+ address: Address;
282
+ }
283
+ /**
284
+ * Invoice entity
285
+ */
286
+ interface Invoice {
287
+ id: UUID;
288
+ external_id: string | null;
289
+ invoice_number: string;
290
+ direction: InvoiceDirection;
291
+ output_format: InvoiceFormat;
292
+ issue_date: DateString;
293
+ due_date: DateString | null;
294
+ currency: CurrencyCode;
295
+ total_ht: number;
296
+ total_tax: number;
297
+ total_ttc: number;
298
+ seller: InvoiceParty;
299
+ buyer: InvoiceParty;
300
+ lines: InvoiceLine[] | null;
301
+ status: InvoiceStatus;
302
+ status_message: string | null;
303
+ environment: Environment;
304
+ archive_enabled: boolean;
305
+ amount_charged: number | null;
306
+ created_at: DateTimeString;
307
+ validated_at: DateTimeString | null;
308
+ transmitted_at: DateTimeString | null;
309
+ completed_at: DateTimeString | null;
310
+ /** Date when the invoice was marked as paid (ISO 8601) */
311
+ paid_at: DateTimeString | null;
312
+ /** Payment reference (bank transfer ID, check number, etc.) */
313
+ payment_reference: string | null;
314
+ /** Optional note about the payment */
315
+ payment_note: string | null;
316
+ }
317
+ /**
318
+ * Invoice line input for creation
319
+ */
320
+ interface InvoiceLineInput {
321
+ description: string;
322
+ quantity: number;
323
+ unit_price: number;
324
+ tax_rate: number;
325
+ total_ht: number;
326
+ total_tax: number;
327
+ total_ttc: number;
328
+ }
329
+ /**
330
+ * Invoice creation input
331
+ */
332
+ interface CreateInvoiceInput {
333
+ /** Your external reference ID */
334
+ external_id?: string | undefined;
335
+ /** Invoice number (required) */
336
+ invoice_number: string;
337
+ /** Direction: outgoing (sale) or incoming (purchase) */
338
+ direction: InvoiceDirection;
339
+ /** Output format for electronic invoice */
340
+ output_format: InvoiceFormat;
341
+ /** Issue date (YYYY-MM-DD) */
342
+ issue_date: DateString;
343
+ /** Due date (YYYY-MM-DD) */
344
+ due_date?: DateString | undefined;
345
+ /** Currency code (default: EUR) */
346
+ currency?: CurrencyCode | undefined;
347
+ /** Total excluding tax */
348
+ total_ht: number;
349
+ /** Total tax amount */
350
+ total_tax: number;
351
+ /** Total including tax */
352
+ total_ttc: number;
353
+ /** Seller SIRET (14 digits) */
354
+ seller_siret: Siret;
355
+ /** Seller company name */
356
+ seller_name: string;
357
+ /** Seller address */
358
+ seller_address: Address;
359
+ /** Buyer SIRET (14 digits) */
360
+ buyer_siret: Siret;
361
+ /** Buyer company name */
362
+ buyer_name: string;
363
+ /** Buyer address */
364
+ buyer_address: Address;
365
+ /** Invoice line items */
366
+ lines: InvoiceLineInput[];
367
+ /** Enable 10-year archiving */
368
+ archive_enabled?: boolean | undefined;
369
+ }
370
+ /**
371
+ * Invoice list filter options
372
+ */
373
+ interface InvoiceListOptions {
374
+ company_id?: UUID | undefined;
375
+ direction?: InvoiceDirection | undefined;
376
+ status?: InvoiceStatus | undefined;
377
+ environment?: Environment | undefined;
378
+ from?: DateString | undefined;
379
+ to?: DateString | undefined;
380
+ per_page?: number | undefined;
381
+ }
382
+ /**
383
+ * Invoice conversion input
384
+ */
385
+ interface ConvertInvoiceInput {
386
+ invoice_id: UUID;
387
+ target_format: InvoiceFormat;
388
+ }
389
+ /**
390
+ * Invoice download response
391
+ */
392
+ interface InvoiceDownloadResponse {
393
+ url: string;
394
+ expires_at: DateTimeString;
395
+ }
396
+ /**
397
+ * Audit trail entry
398
+ */
399
+ interface AuditTrailEntry {
400
+ action: string;
401
+ details: string;
402
+ actor_ip: string | null;
403
+ created_at: DateTimeString;
404
+ }
405
+ /**
406
+ * Audit trail response
407
+ */
408
+ interface AuditTrailResponse {
409
+ data: AuditTrailEntry[];
410
+ integrity_valid: boolean;
411
+ }
412
+ /**
413
+ * Incoming invoice list filter options
414
+ */
415
+ interface IncomingInvoiceParams {
416
+ status?: InvoiceStatus | undefined;
417
+ seller_siret?: Siret | undefined;
418
+ from?: DateString | undefined;
419
+ to?: DateString | undefined;
420
+ min_amount?: number | undefined;
421
+ max_amount?: number | undefined;
422
+ page?: number | undefined;
423
+ per_page?: number | undefined;
424
+ }
425
+ /**
426
+ * Rejection reason code for incoming invoices
427
+ */
428
+ type RejectionCode = 'incorrect_amount' | 'duplicate' | 'unknown_order' | 'incorrect_vat' | 'other';
429
+ /**
430
+ * Dispute type for incoming invoices
431
+ */
432
+ type DisputeType = 'amount_dispute' | 'quality_dispute' | 'delivery_dispute' | 'other';
433
+ /**
434
+ * Input for accepting an incoming invoice
435
+ */
436
+ interface AcceptInvoiceInput {
437
+ /** Expected payment date (YYYY-MM-DD) */
438
+ payment_date?: DateString | undefined;
439
+ /** Optional note about the acceptance */
440
+ note?: string | undefined;
441
+ }
442
+ /**
443
+ * Input for rejecting an incoming invoice
444
+ */
445
+ interface RejectInvoiceInput {
446
+ /** Reason for rejection */
447
+ reason: string;
448
+ /** Standardized rejection code */
449
+ reason_code: RejectionCode;
450
+ }
451
+ /**
452
+ * Input for disputing an incoming invoice
453
+ */
454
+ interface DisputeInvoiceInput {
455
+ /** Reason for the dispute */
456
+ reason: string;
457
+ /** Type of dispute */
458
+ dispute_type: DisputeType;
459
+ /** Expected correct amount (if amount dispute) */
460
+ expected_amount?: number | undefined;
461
+ }
462
+ /**
463
+ * Input for marking an incoming invoice as paid
464
+ */
465
+ interface MarkPaidInput {
466
+ /** Payment reference (bank transfer ID, check number, etc.) */
467
+ payment_reference?: string | undefined;
468
+ /** Payment date (ISO 8601) - defaults to current date/time if not provided */
469
+ paid_at?: DateTimeString | undefined;
470
+ /** Optional note about the payment */
471
+ note?: string | undefined;
472
+ }
473
+ /**
474
+ * Invoice file download format
475
+ */
476
+ type InvoiceFileFormat = 'pdf' | 'xml';
477
+
478
+ /**
479
+ * Tenant Invoices types
480
+ *
481
+ * Types for multi-tenant invoice operations including direct invoices,
482
+ * incoming invoices, and credit notes.
483
+ *
484
+ * @packageDocumentation
485
+ */
486
+
487
+ /**
488
+ * Invoice direction for tenant operations
489
+ */
490
+ type TenantInvoiceDirection = 'outgoing' | 'incoming';
491
+ /**
492
+ * Buyer information for direct invoice creation
493
+ */
494
+ interface TenantInvoiceBuyer {
495
+ /** Buyer company name */
496
+ company_name: string;
497
+ /** SIREN number (9 digits) - optional */
498
+ siren?: Siren | undefined;
499
+ /** SIRET number (14 digits) - optional */
500
+ siret?: Siret | undefined;
501
+ /** VAT number - optional */
502
+ vat_number?: string | undefined;
503
+ /** Buyer address */
504
+ address: Address;
505
+ /** Buyer email for notifications */
506
+ email: string;
507
+ }
508
+ /**
509
+ * Seller information for incoming invoice creation
510
+ */
511
+ interface TenantInvoiceSeller {
512
+ /** Seller company name */
513
+ company_name: string;
514
+ /** SIREN number (9 digits) - required, validated with Luhn algorithm */
515
+ siren: Siren;
516
+ /** SIRET number (14 digits) - optional */
517
+ siret?: Siret | undefined;
518
+ /** VAT number - optional */
519
+ vat_number?: string | undefined;
520
+ /** Seller address */
521
+ address: Address;
522
+ /** Seller email */
523
+ email: string;
524
+ }
525
+ /**
526
+ * Input for creating a tenant direct invoice
527
+ *
528
+ * Direct invoices are outgoing invoices created by a tenant
529
+ * that are billed directly to an external buyer (not a sub-tenant).
530
+ *
531
+ * @example
532
+ * ```typescript
533
+ * const params: CreateTenantDirectInvoiceParams = {
534
+ * company_id: 'company-uuid',
535
+ * buyer: {
536
+ * company_name: 'Client SARL',
537
+ * siret: '12345678901234',
538
+ * address: {
539
+ * line1: '123 Rue Example',
540
+ * postal_code: '75001',
541
+ * city: 'Paris',
542
+ * country: 'FR'
543
+ * },
544
+ * email: 'contact@client.com'
545
+ * },
546
+ * lines: [{
547
+ * description: 'Consulting services',
548
+ * quantity: 10,
549
+ * unit_price: 100,
550
+ * tax_rate: 20,
551
+ * total_ht: 1000,
552
+ * total_tax: 200,
553
+ * total_ttc: 1200
554
+ * }],
555
+ * issue_date: '2026-01-26'
556
+ * };
557
+ * ```
558
+ */
559
+ interface CreateTenantDirectInvoiceParams {
560
+ /** Company UUID issuing the invoice */
561
+ company_id: UUID;
562
+ /** Buyer information */
563
+ buyer: TenantInvoiceBuyer;
564
+ /** Invoice line items */
565
+ lines: InvoiceLineInput[];
566
+ /** Issue date (YYYY-MM-DD) - defaults to today */
567
+ issue_date?: DateString | undefined;
568
+ /** Due date (YYYY-MM-DD) */
569
+ due_date?: DateString | undefined;
570
+ /** Currency code (ISO 4217) - defaults to EUR */
571
+ currency?: CurrencyCode | undefined;
572
+ /** Notes or comments on the invoice */
573
+ notes?: string | undefined;
574
+ /** Custom metadata */
575
+ metadata?: Record<string, unknown> | undefined;
576
+ /** Output format for the invoice */
577
+ output_format?: InvoiceFormat | undefined;
578
+ /** External reference ID */
579
+ external_id?: string | undefined;
580
+ }
581
+ /**
582
+ * Input for creating a tenant direct credit note
583
+ *
584
+ * Direct credit notes are linked to direct invoices and allow
585
+ * partial or total refunds.
586
+ *
587
+ * @example
588
+ * ```typescript
589
+ * const params: CreateTenantDirectCreditNoteParams = {
590
+ * invoice_id: 'invoice-uuid',
591
+ * reason: 'Product returned - damaged item',
592
+ * type: 'partial',
593
+ * items: [{ invoice_line_id: 'line-uuid', quantity: 2 }]
594
+ * };
595
+ * ```
596
+ */
597
+ interface CreateTenantDirectCreditNoteParams {
598
+ /** Invoice UUID to credit */
599
+ invoice_id: UUID;
600
+ /** Reason for the credit note */
601
+ reason: string;
602
+ /** Type: 'partial' or 'total' */
603
+ type: 'partial' | 'total';
604
+ /** Items to credit (required for partial credit notes) */
605
+ items?: TenantCreditNoteItemInput$1[] | undefined;
606
+ /** Custom metadata */
607
+ metadata?: Record<string, unknown> | undefined;
608
+ }
609
+ /**
610
+ * Credit note item input
611
+ */
612
+ interface TenantCreditNoteItemInput$1 {
613
+ /** Invoice line ID to credit */
614
+ invoice_line_id: UUID;
615
+ /** Quantity to credit (defaults to full line quantity) */
616
+ quantity?: number | undefined;
617
+ }
618
+ /**
619
+ * Input for creating an incoming invoice for a sub-tenant
620
+ *
621
+ * Incoming invoices represent invoices received by a sub-tenant
622
+ * from an external supplier.
623
+ *
624
+ * @example
625
+ * ```typescript
626
+ * const params: CreateIncomingInvoiceParams = {
627
+ * invoice_number: 'SUPP-2026-001',
628
+ * company_id: 'company-uuid',
629
+ * seller: {
630
+ * company_name: 'Supplier Corp',
631
+ * siren: '123456789',
632
+ * address: {
633
+ * line1: '456 Avenue Fournisseur',
634
+ * postal_code: '69001',
635
+ * city: 'Lyon',
636
+ * country: 'FR'
637
+ * },
638
+ * email: 'invoices@supplier.com'
639
+ * },
640
+ * lines: [{
641
+ * description: 'Raw materials',
642
+ * quantity: 100,
643
+ * unit_price: 5,
644
+ * tax_rate: 20,
645
+ * total_ht: 500,
646
+ * total_tax: 100,
647
+ * total_ttc: 600
648
+ * }],
649
+ * issue_date: '2026-01-20',
650
+ * total_ht: 500,
651
+ * total_ttc: 600
652
+ * };
653
+ * ```
654
+ */
655
+ interface CreateIncomingInvoiceParams {
656
+ /** Supplier's invoice number */
657
+ invoice_number: string;
658
+ /** Company UUID receiving the invoice */
659
+ company_id: UUID;
660
+ /** Seller (supplier) information */
661
+ seller: TenantInvoiceSeller;
662
+ /** Invoice line items */
663
+ lines: InvoiceLineInput[];
664
+ /** Issue date (YYYY-MM-DD) */
665
+ issue_date: DateString;
666
+ /** Due date (YYYY-MM-DD) */
667
+ due_date?: DateString | undefined;
668
+ /** Total excluding tax */
669
+ total_ht: number;
670
+ /** Total including tax */
671
+ total_ttc: number;
672
+ /** Currency code (ISO 4217) - defaults to EUR */
673
+ currency?: CurrencyCode | undefined;
674
+ /** External reference ID */
675
+ external_id?: string | undefined;
676
+ }
677
+ /**
678
+ * Input for updating a tenant invoice
679
+ *
680
+ * Only invoices in 'draft' status can be updated.
681
+ */
682
+ interface UpdateTenantInvoiceParams {
683
+ /** Updated buyer information */
684
+ buyer?: Partial<TenantInvoiceBuyer> | undefined;
685
+ /** Updated line items (replaces all existing lines) */
686
+ lines?: InvoiceLineInput[] | undefined;
687
+ /** Updated due date */
688
+ due_date?: DateString | undefined;
689
+ /** Updated notes */
690
+ notes?: string | undefined;
691
+ /** Updated metadata */
692
+ metadata?: Record<string, unknown> | undefined;
693
+ }
694
+ /**
695
+ * Input for updating a tenant credit note
696
+ *
697
+ * Only credit notes in 'draft' status can be updated.
698
+ */
699
+ interface UpdateTenantCreditNoteParams {
700
+ /** Updated reason */
701
+ reason?: string | undefined;
702
+ /** Updated items (for partial credit notes) */
703
+ items?: TenantCreditNoteItemInput$1[] | undefined;
704
+ /** Updated metadata */
705
+ metadata?: Record<string, unknown> | undefined;
706
+ }
707
+ /**
708
+ * Filter options for tenant invoice listing
709
+ *
710
+ * @example
711
+ * ```typescript
712
+ * const filters: TenantInvoiceFilters = {
713
+ * status: 'validated',
714
+ * direction: 'outgoing',
715
+ * date_from: '2026-01-01',
716
+ * date_to: '2026-01-31',
717
+ * per_page: 50
718
+ * };
719
+ * ```
720
+ */
721
+ interface TenantInvoiceFilters extends PaginationOptions {
722
+ /** Search in invoice number, buyer/seller name */
723
+ search?: string | undefined;
724
+ /** Filter by status (single or multiple) */
725
+ status?: InvoiceStatus | InvoiceStatus[] | undefined;
726
+ /** Filter by direction */
727
+ direction?: TenantInvoiceDirection | undefined;
728
+ /** Filter invoices from this date (YYYY-MM-DD) */
729
+ date_from?: DateString | undefined;
730
+ /** Filter invoices to this date (YYYY-MM-DD) */
731
+ date_to?: DateString | undefined;
732
+ /** Filter by buyer SIRET */
733
+ buyer_siret?: Siret | undefined;
734
+ /** Filter by seller SIRET */
735
+ seller_siret?: Siret | undefined;
736
+ /** Minimum total amount (TTC) */
737
+ min_amount?: number | undefined;
738
+ /** Maximum total amount (TTC) */
739
+ max_amount?: number | undefined;
740
+ /** Sort field */
741
+ sort?: string | undefined;
742
+ /** Sort order */
743
+ order?: 'asc' | 'desc' | undefined;
744
+ }
745
+ /**
746
+ * Filter options for tenant credit note listing
747
+ */
748
+ interface TenantCreditNoteFilters extends PaginationOptions {
749
+ /** Filter by status */
750
+ status?: 'draft' | 'sent' | 'cancelled' | undefined;
751
+ /** Filter credit notes from this date (YYYY-MM-DD) */
752
+ date_from?: DateString | undefined;
753
+ /** Filter credit notes to this date (YYYY-MM-DD) */
754
+ date_to?: DateString | undefined;
755
+ /** Sort field */
756
+ sort?: string | undefined;
757
+ /** Sort order */
758
+ order?: 'asc' | 'desc' | undefined;
759
+ }
760
+ /**
761
+ * Tenant Invoice entity
762
+ *
763
+ * Extended invoice entity with tenant-specific fields.
764
+ */
765
+ interface TenantInvoice {
766
+ id: UUID;
767
+ external_id: string | null;
768
+ invoice_number: string;
769
+ direction: TenantInvoiceDirection;
770
+ output_format: InvoiceFormat;
771
+ issue_date: DateString;
772
+ due_date: DateString | null;
773
+ currency: CurrencyCode;
774
+ total_ht: number;
775
+ total_tax: number;
776
+ total_ttc: number;
777
+ seller: {
778
+ siret: Siret | null;
779
+ siren: Siren | null;
780
+ name: string;
781
+ address: Address;
782
+ email?: string | undefined;
783
+ };
784
+ buyer: {
785
+ siret: Siret | null;
786
+ siren: Siren | null;
787
+ name: string;
788
+ address: Address;
789
+ email?: string | undefined;
790
+ };
791
+ lines: InvoiceLine[] | null;
792
+ status: InvoiceStatus;
793
+ status_message: string | null;
794
+ notes: string | null;
795
+ metadata: Record<string, unknown> | null;
796
+ tenant_id: UUID;
797
+ sub_tenant_id: UUID | null;
798
+ company_id: UUID;
799
+ created_at: DateTimeString;
800
+ updated_at: DateTimeString;
801
+ validated_at: DateTimeString | null;
802
+ paid_at: DateTimeString | null;
803
+ payment_reference: string | null;
804
+ }
805
+ /**
806
+ * Tenant Credit Note entity
807
+ */
808
+ interface TenantCreditNote$1 {
809
+ id: UUID;
810
+ credit_note_number: string;
811
+ invoice_id: UUID;
812
+ tenant_id: UUID;
813
+ sub_tenant_id: UUID | null;
814
+ status: 'draft' | 'sent' | 'cancelled';
815
+ type: 'partial' | 'total';
816
+ reason: string;
817
+ subtotal: number;
818
+ tax_amount: number;
819
+ total: number;
820
+ currency: CurrencyCode;
821
+ buyer_name: string | null;
822
+ buyer_siret: Siret | null;
823
+ seller_name: string | null;
824
+ seller_siret: Siret | null;
825
+ issue_date: DateString;
826
+ metadata: Record<string, unknown> | null;
827
+ created_at: DateTimeString;
828
+ updated_at: DateTimeString;
829
+ items: TenantCreditNoteItem$1[] | null;
830
+ }
831
+ /**
832
+ * Tenant Credit Note Item
833
+ */
834
+ interface TenantCreditNoteItem$1 {
835
+ id: UUID;
836
+ invoice_line_id: UUID | null;
837
+ description: string;
838
+ quantity: number;
839
+ unit_price: number;
840
+ tax_rate: number;
841
+ total: number;
842
+ }
843
+
844
+ /**
845
+ * Tenant Direct Invoices Resource
846
+ *
847
+ * Manage direct invoices issued by a tenant to external buyers.
848
+ * Direct invoices are outgoing invoices that are not part of
849
+ * sub-tenant billing but billed directly to third-party clients.
850
+ *
851
+ * @packageDocumentation
852
+ */
853
+
854
+ /**
855
+ * Tenant Direct Invoices API resource
856
+ *
857
+ * Provides operations for managing direct invoices created by tenants
858
+ * for external buyers (not sub-tenants).
859
+ *
860
+ * @example
861
+ * ```typescript
862
+ * import { ScellTenantClient } from '@scell/sdk';
863
+ *
864
+ * const client = new ScellTenantClient('your-tenant-key');
865
+ *
866
+ * // Create a direct invoice
867
+ * const { data: invoice } = await client.directInvoices.create({
868
+ * company_id: 'company-uuid',
869
+ * buyer: {
870
+ * company_name: 'Client Corp',
871
+ * siret: '12345678901234',
872
+ * address: {
873
+ * line1: '123 Rue Client',
874
+ * postal_code: '75001',
875
+ * city: 'Paris',
876
+ * country: 'FR'
877
+ * },
878
+ * email: 'billing@client.com'
879
+ * },
880
+ * lines: [{
881
+ * description: 'Consulting services',
882
+ * quantity: 10,
883
+ * unit_price: 150,
884
+ * tax_rate: 20,
885
+ * total_ht: 1500,
886
+ * total_tax: 300,
887
+ * total_ttc: 1800
888
+ * }]
889
+ * });
890
+ *
891
+ * // List all direct invoices
892
+ * const { data: invoices, meta } = await client.directInvoices.list({
893
+ * status: 'validated',
894
+ * per_page: 50
895
+ * });
896
+ * ```
897
+ */
898
+ declare class TenantDirectInvoicesResource {
899
+ private readonly http;
900
+ constructor(http: HttpClient);
901
+ /**
902
+ * Create a new direct invoice
903
+ *
904
+ * Creates an outgoing invoice from the tenant to an external buyer.
905
+ * The invoice will be generated in the specified format (Factur-X by default).
906
+ *
907
+ * @param params - Invoice creation parameters
908
+ * @param requestOptions - Optional request configuration
909
+ * @returns Created invoice
910
+ *
911
+ * @example
912
+ * ```typescript
913
+ * const { data: invoice } = await client.directInvoices.create({
914
+ * company_id: 'company-uuid',
915
+ * buyer: {
916
+ * company_name: 'Acme Corporation',
917
+ * siret: '98765432109876',
918
+ * address: {
919
+ * line1: '456 Avenue Business',
920
+ * postal_code: '69001',
921
+ * city: 'Lyon',
922
+ * country: 'FR'
923
+ * },
924
+ * email: 'accounts@acme.com'
925
+ * },
926
+ * lines: [{
927
+ * description: 'Monthly subscription',
928
+ * quantity: 1,
929
+ * unit_price: 299,
930
+ * tax_rate: 20,
931
+ * total_ht: 299,
932
+ * total_tax: 59.80,
933
+ * total_ttc: 358.80
934
+ * }],
935
+ * issue_date: '2026-01-26',
936
+ * due_date: '2026-02-26',
937
+ * notes: 'Thank you for your business!'
938
+ * });
939
+ *
940
+ * console.log('Invoice created:', invoice.invoice_number);
941
+ * ```
942
+ */
943
+ create(params: CreateTenantDirectInvoiceParams, requestOptions?: RequestOptions): Promise<SingleResponse<TenantInvoice>>;
944
+ /**
945
+ * List all direct invoices
946
+ *
947
+ * Returns a paginated list of direct invoices created by the tenant.
948
+ * Supports filtering by status, date range, buyer, and amount.
949
+ *
950
+ * @param filters - Filter and pagination options
951
+ * @param requestOptions - Optional request configuration
952
+ * @returns Paginated list of invoices
953
+ *
954
+ * @example
955
+ * ```typescript
956
+ * // List all validated invoices
957
+ * const { data: invoices, meta } = await client.directInvoices.list({
958
+ * status: 'validated',
959
+ * per_page: 50
960
+ * });
961
+ *
962
+ * console.log(`Found ${meta.total} validated invoices`);
963
+ *
964
+ * // Filter by date range
965
+ * const januaryInvoices = await client.directInvoices.list({
966
+ * date_from: '2026-01-01',
967
+ * date_to: '2026-01-31'
968
+ * });
969
+ *
970
+ * // Search by buyer
971
+ * const acmeInvoices = await client.directInvoices.list({
972
+ * search: 'Acme'
973
+ * });
974
+ * ```
975
+ */
976
+ list(filters?: TenantInvoiceFilters, requestOptions?: RequestOptions): Promise<PaginatedResponse<TenantInvoice>>;
977
+ /**
978
+ * Get a specific direct invoice by ID
979
+ *
980
+ * @param invoiceId - Invoice UUID
981
+ * @param requestOptions - Optional request configuration
982
+ * @returns Invoice details
983
+ *
984
+ * @example
985
+ * ```typescript
986
+ * const { data: invoice } = await client.directInvoices.get('invoice-uuid');
987
+ *
988
+ * console.log('Invoice:', invoice.invoice_number);
989
+ * console.log('Status:', invoice.status);
990
+ * console.log('Total:', invoice.total_ttc, invoice.currency);
991
+ * ```
992
+ */
993
+ get(invoiceId: string, requestOptions?: RequestOptions): Promise<SingleResponse<TenantInvoice>>;
994
+ /**
995
+ * Update a direct invoice
996
+ *
997
+ * Only invoices in 'draft' status can be updated.
998
+ * Once validated or sent, invoices become immutable.
999
+ *
1000
+ * @param invoiceId - Invoice UUID
1001
+ * @param params - Update parameters
1002
+ * @param requestOptions - Optional request configuration
1003
+ * @returns Updated invoice
1004
+ *
1005
+ * @example
1006
+ * ```typescript
1007
+ * const { data: invoice } = await client.directInvoices.update(
1008
+ * 'invoice-uuid',
1009
+ * {
1010
+ * due_date: '2026-03-15',
1011
+ * notes: 'Updated payment terms'
1012
+ * }
1013
+ * );
1014
+ *
1015
+ * console.log('Invoice updated:', invoice.due_date);
1016
+ * ```
1017
+ */
1018
+ update(invoiceId: string, params: UpdateTenantInvoiceParams, requestOptions?: RequestOptions): Promise<SingleResponse<TenantInvoice>>;
1019
+ /**
1020
+ * Delete a direct invoice
1021
+ *
1022
+ * Only invoices in 'draft' status can be deleted.
1023
+ * Validated or sent invoices cannot be deleted for audit trail compliance.
1024
+ *
1025
+ * @param invoiceId - Invoice UUID
1026
+ * @param requestOptions - Optional request configuration
1027
+ *
1028
+ * @example
1029
+ * ```typescript
1030
+ * await client.directInvoices.delete('draft-invoice-uuid');
1031
+ * console.log('Invoice deleted successfully');
1032
+ * ```
1033
+ */
1034
+ delete(invoiceId: string, requestOptions?: RequestOptions): Promise<MessageResponse>;
1035
+ /**
1036
+ * Validate a direct invoice
1037
+ *
1038
+ * Validates the invoice, generates the electronic invoice file,
1039
+ * and changes status from 'draft' to 'validated'.
1040
+ *
1041
+ * @param invoiceId - Invoice UUID
1042
+ * @param requestOptions - Optional request configuration
1043
+ * @returns Validated invoice
1044
+ *
1045
+ * @example
1046
+ * ```typescript
1047
+ * const { data: invoice } = await client.directInvoices.validate('invoice-uuid');
1048
+ * console.log('Invoice validated:', invoice.status); // 'validated'
1049
+ * console.log('Validated at:', invoice.validated_at);
1050
+ * ```
1051
+ */
1052
+ validate(invoiceId: string, requestOptions?: RequestOptions): Promise<SingleResponse<TenantInvoice>>;
1053
+ /**
1054
+ * Send a direct invoice to the buyer
1055
+ *
1056
+ * Sends the validated invoice to the buyer via email.
1057
+ * The invoice must be in 'validated' status.
1058
+ *
1059
+ * @param invoiceId - Invoice UUID
1060
+ * @param requestOptions - Optional request configuration
1061
+ * @returns Updated invoice
1062
+ *
1063
+ * @example
1064
+ * ```typescript
1065
+ * const { data: invoice } = await client.directInvoices.send('invoice-uuid');
1066
+ * console.log('Invoice sent to:', invoice.buyer.email);
1067
+ * ```
1068
+ */
1069
+ send(invoiceId: string, requestOptions?: RequestOptions): Promise<SingleResponse<TenantInvoice>>;
1070
+ /**
1071
+ * Download invoice as PDF
1072
+ *
1073
+ * Downloads the electronic invoice file as a PDF (Factur-X).
1074
+ *
1075
+ * @param invoiceId - Invoice UUID
1076
+ * @param requestOptions - Optional request configuration
1077
+ * @returns ArrayBuffer containing the PDF file
1078
+ *
1079
+ * @example
1080
+ * ```typescript
1081
+ * // Download invoice PDF
1082
+ * const pdfBuffer = await client.directInvoices.download('invoice-uuid');
1083
+ *
1084
+ * // In Node.js, save to file:
1085
+ * import { writeFileSync } from 'fs';
1086
+ * writeFileSync('invoice.pdf', Buffer.from(pdfBuffer));
1087
+ *
1088
+ * // In browser, trigger download:
1089
+ * const blob = new Blob([pdfBuffer], { type: 'application/pdf' });
1090
+ * const url = URL.createObjectURL(blob);
1091
+ * const a = document.createElement('a');
1092
+ * a.href = url;
1093
+ * a.download = 'invoice.pdf';
1094
+ * a.click();
1095
+ * ```
1096
+ */
1097
+ download(invoiceId: string, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
1098
+ /**
1099
+ * Download invoice XML
1100
+ *
1101
+ * Downloads the electronic invoice XML (UBL/CII format).
1102
+ *
1103
+ * @param invoiceId - Invoice UUID
1104
+ * @param requestOptions - Optional request configuration
1105
+ * @returns ArrayBuffer containing the XML file
1106
+ *
1107
+ * @example
1108
+ * ```typescript
1109
+ * const xmlBuffer = await client.directInvoices.downloadXml('invoice-uuid');
1110
+ * const xmlString = new TextDecoder().decode(xmlBuffer);
1111
+ * console.log('XML:', xmlString);
1112
+ * ```
1113
+ */
1114
+ downloadXml(invoiceId: string, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
1115
+ /**
1116
+ * Bulk create multiple invoices
1117
+ */
1118
+ bulkCreate(invoices: CreateTenantDirectInvoiceParams[], requestOptions?: RequestOptions): Promise<MessageResponse>;
1119
+ /**
1120
+ * Bulk submit multiple invoices
1121
+ */
1122
+ bulkSubmit(invoiceIds: string[], requestOptions?: RequestOptions): Promise<MessageResponse>;
1123
+ /**
1124
+ * Get status of multiple invoices
1125
+ */
1126
+ bulkStatus(invoiceIds: string[], requestOptions?: RequestOptions): Promise<SingleResponse<Record<string, unknown>[]>>;
1127
+ }
1128
+
1129
+ /**
1130
+ * Tenant Direct Credit Notes Resource
1131
+ *
1132
+ * Manage credit notes for direct invoices issued by a tenant.
1133
+ * Direct credit notes are linked to direct invoices (not sub-tenant invoices)
1134
+ * and allow partial or total refunds.
1135
+ *
1136
+ * @packageDocumentation
1137
+ */
1138
+
1139
+ /**
1140
+ * Remaining creditable information for a direct invoice
1141
+ */
1142
+ interface DirectInvoiceRemainingCreditable {
1143
+ /** Invoice UUID */
1144
+ invoice_id: string;
1145
+ /** Original invoice total (TTC) */
1146
+ invoice_total: number;
1147
+ /** Total already credited */
1148
+ credited_total: number;
1149
+ /** Remaining amount that can be credited */
1150
+ remaining_total: number;
1151
+ /** Line-by-line breakdown */
1152
+ lines: DirectInvoiceRemainingLine[];
1153
+ }
1154
+ /**
1155
+ * Remaining creditable information for an invoice line
1156
+ */
1157
+ interface DirectInvoiceRemainingLine {
1158
+ /** Invoice line UUID */
1159
+ invoice_line_id: string;
1160
+ /** Line description */
1161
+ description: string;
1162
+ /** Original quantity */
1163
+ original_quantity: number;
1164
+ /** Quantity already credited */
1165
+ credited_quantity: number;
1166
+ /** Remaining quantity that can be credited */
1167
+ remaining_quantity: number;
1168
+ /** Unit price */
1169
+ unit_price: number;
1170
+ }
1171
+ /**
1172
+ * Tenant Direct Credit Notes API resource
1173
+ *
1174
+ * Provides operations for managing credit notes linked to direct invoices.
1175
+ * Use this for refunds or corrections on invoices issued to external buyers.
1176
+ *
1177
+ * @example
1178
+ * ```typescript
1179
+ * import { ScellTenantClient } from '@scell/sdk';
1180
+ *
1181
+ * const client = new ScellTenantClient('your-tenant-key');
1182
+ *
1183
+ * // Create a partial credit note
1184
+ * const { data: creditNote } = await client.directCreditNotes.create({
1185
+ * invoice_id: 'invoice-uuid',
1186
+ * reason: 'Product returned - damaged in transit',
1187
+ * type: 'partial',
1188
+ * items: [
1189
+ * { invoice_line_id: 'line-uuid', quantity: 2 }
1190
+ * ]
1191
+ * });
1192
+ *
1193
+ * // Create a total credit note (full refund)
1194
+ * const { data: totalCreditNote } = await client.directCreditNotes.create({
1195
+ * invoice_id: 'invoice-uuid',
1196
+ * reason: 'Order cancelled by customer',
1197
+ * type: 'total'
1198
+ * });
1199
+ *
1200
+ * // List all credit notes
1201
+ * const { data: creditNotes } = await client.directCreditNotes.list({
1202
+ * status: 'sent'
1203
+ * });
1204
+ * ```
1205
+ */
1206
+ declare class TenantDirectCreditNotesResource {
1207
+ private readonly http;
1208
+ constructor(http: HttpClient);
1209
+ /**
1210
+ * Create a new credit note for a direct invoice
1211
+ *
1212
+ * Creates a credit note (avoir) linked to a direct invoice.
1213
+ * - For partial credit notes, specify the items and quantities to credit.
1214
+ * - For total credit notes, all items are automatically credited.
1215
+ *
1216
+ * @param params - Credit note creation parameters
1217
+ * @param requestOptions - Optional request configuration
1218
+ * @returns Created credit note
1219
+ *
1220
+ * @example
1221
+ * ```typescript
1222
+ * // Partial credit note
1223
+ * const { data: creditNote } = await client.directCreditNotes.create({
1224
+ * invoice_id: 'invoice-uuid',
1225
+ * reason: 'Returned items',
1226
+ * type: 'partial',
1227
+ * items: [
1228
+ * { invoice_line_id: 'line-1-uuid', quantity: 2 },
1229
+ * { invoice_line_id: 'line-2-uuid', quantity: 1 }
1230
+ * ]
1231
+ * });
1232
+ *
1233
+ * // Total credit note (cancels entire invoice)
1234
+ * const { data: totalCreditNote } = await client.directCreditNotes.create({
1235
+ * invoice_id: 'invoice-uuid',
1236
+ * reason: 'Invoice issued in error',
1237
+ * type: 'total'
1238
+ * });
1239
+ *
1240
+ * console.log('Credit note number:', creditNote.credit_note_number);
1241
+ * console.log('Amount:', creditNote.total, creditNote.currency);
1242
+ * ```
1243
+ */
1244
+ create(params: CreateTenantDirectCreditNoteParams, requestOptions?: RequestOptions): Promise<SingleResponse<TenantCreditNote$1>>;
1245
+ /**
1246
+ * List all direct credit notes
1247
+ *
1248
+ * Returns a paginated list of credit notes for direct invoices.
1249
+ *
1250
+ * @param filters - Filter and pagination options
1251
+ * @param requestOptions - Optional request configuration
1252
+ * @returns Paginated list of credit notes
1253
+ *
1254
+ * @example
1255
+ * ```typescript
1256
+ * // List all sent credit notes
1257
+ * const { data: creditNotes, meta } = await client.directCreditNotes.list({
1258
+ * status: 'sent',
1259
+ * per_page: 50
1260
+ * });
1261
+ *
1262
+ * console.log(`Found ${meta.total} sent credit notes`);
1263
+ *
1264
+ * // Filter by date range
1265
+ * const januaryCreditNotes = await client.directCreditNotes.list({
1266
+ * date_from: '2026-01-01',
1267
+ * date_to: '2026-01-31'
1268
+ * });
1269
+ * ```
1270
+ */
1271
+ list(filters?: TenantCreditNoteFilters, requestOptions?: RequestOptions): Promise<PaginatedResponse<TenantCreditNote$1>>;
1272
+ /**
1273
+ * Get a specific credit note by ID
1274
+ *
1275
+ * @param creditNoteId - Credit note UUID
1276
+ * @param requestOptions - Optional request configuration
1277
+ * @returns Credit note details
1278
+ *
1279
+ * @example
1280
+ * ```typescript
1281
+ * const { data: creditNote } = await client.directCreditNotes.get('credit-note-uuid');
1282
+ *
1283
+ * console.log('Credit note:', creditNote.credit_note_number);
1284
+ * console.log('Status:', creditNote.status);
1285
+ * console.log('Reason:', creditNote.reason);
1286
+ * console.log('Total:', creditNote.total, creditNote.currency);
1287
+ * ```
1288
+ */
1289
+ get(creditNoteId: string, requestOptions?: RequestOptions): Promise<SingleResponse<TenantCreditNote$1>>;
1290
+ /**
1291
+ * Update a credit note
1292
+ *
1293
+ * Only credit notes in 'draft' status can be updated.
1294
+ *
1295
+ * @param creditNoteId - Credit note UUID
1296
+ * @param params - Update parameters
1297
+ * @param requestOptions - Optional request configuration
1298
+ * @returns Updated credit note
1299
+ *
1300
+ * @example
1301
+ * ```typescript
1302
+ * const { data: creditNote } = await client.directCreditNotes.update(
1303
+ * 'credit-note-uuid',
1304
+ * {
1305
+ * reason: 'Updated reason: Customer complaint resolved',
1306
+ * items: [
1307
+ * { invoice_line_id: 'line-uuid', quantity: 3 }
1308
+ * ]
1309
+ * }
1310
+ * );
1311
+ * ```
1312
+ */
1313
+ update(creditNoteId: string, params: UpdateTenantCreditNoteParams, requestOptions?: RequestOptions): Promise<SingleResponse<TenantCreditNote$1>>;
1314
+ /**
1315
+ * Delete a credit note
1316
+ *
1317
+ * Only credit notes in 'draft' status can be deleted.
1318
+ *
1319
+ * @param creditNoteId - Credit note UUID
1320
+ * @param requestOptions - Optional request configuration
1321
+ *
1322
+ * @example
1323
+ * ```typescript
1324
+ * await client.directCreditNotes.delete('draft-credit-note-uuid');
1325
+ * console.log('Credit note deleted');
1326
+ * ```
1327
+ */
1328
+ delete(creditNoteId: string, requestOptions?: RequestOptions): Promise<MessageResponse>;
1329
+ /**
1330
+ * Send a credit note
1331
+ *
1332
+ * Validates and sends the credit note, changing status from 'draft' to 'sent'.
1333
+ *
1334
+ * @param creditNoteId - Credit note UUID
1335
+ * @param requestOptions - Optional request configuration
1336
+ * @returns Sent credit note
1337
+ *
1338
+ * @example
1339
+ * ```typescript
1340
+ * const { data: creditNote } = await client.directCreditNotes.send('credit-note-uuid');
1341
+ * console.log('Credit note sent:', creditNote.status); // 'sent'
1342
+ * ```
1343
+ */
1344
+ send(creditNoteId: string, requestOptions?: RequestOptions): Promise<SingleResponse<TenantCreditNote$1>>;
1345
+ /**
1346
+ * Download credit note as PDF
1347
+ *
1348
+ * @param creditNoteId - Credit note UUID
1349
+ * @param requestOptions - Optional request configuration
1350
+ * @returns ArrayBuffer containing the PDF file
1351
+ *
1352
+ * @example
1353
+ * ```typescript
1354
+ * const pdfBuffer = await client.directCreditNotes.download('credit-note-uuid');
1355
+ *
1356
+ * // In Node.js:
1357
+ * import { writeFileSync } from 'fs';
1358
+ * writeFileSync('credit-note.pdf', Buffer.from(pdfBuffer));
1359
+ *
1360
+ * // In browser:
1361
+ * const blob = new Blob([pdfBuffer], { type: 'application/pdf' });
1362
+ * const url = URL.createObjectURL(blob);
1363
+ * window.open(url);
1364
+ * ```
1365
+ */
1366
+ download(creditNoteId: string, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
1367
+ /**
1368
+ * Get remaining creditable amount for a direct invoice
1369
+ *
1370
+ * Returns information about how much can still be credited,
1371
+ * including line-by-line breakdown.
1372
+ *
1373
+ * @param invoiceId - Invoice UUID
1374
+ * @param requestOptions - Optional request configuration
1375
+ * @returns Remaining creditable information
1376
+ *
1377
+ * @example
1378
+ * ```typescript
1379
+ * const remaining = await client.directCreditNotes.remainingCreditable('invoice-uuid');
1380
+ *
1381
+ * console.log('Invoice total:', remaining.invoice_total);
1382
+ * console.log('Already credited:', remaining.credited_total);
1383
+ * console.log('Can still credit:', remaining.remaining_total);
1384
+ *
1385
+ * // Check per-line
1386
+ * remaining.lines.forEach(line => {
1387
+ * if (line.remaining_quantity > 0) {
1388
+ * console.log(`${line.description}: ${line.remaining_quantity} units remaining`);
1389
+ * }
1390
+ * });
1391
+ * ```
1392
+ */
1393
+ remainingCreditable(invoiceId: string, requestOptions?: RequestOptions): Promise<DirectInvoiceRemainingCreditable>;
1394
+ }
1395
+
1396
+ /**
1397
+ * Tenant Incoming Invoices Resource
1398
+ *
1399
+ * Manage incoming invoices (purchase invoices) for sub-tenants.
1400
+ * Incoming invoices are invoices received by a sub-tenant from external suppliers.
1401
+ *
1402
+ * @packageDocumentation
1403
+ */
1404
+
1405
+ /**
1406
+ * Input for accepting an incoming invoice
1407
+ */
1408
+ interface AcceptIncomingInvoiceInput {
1409
+ /** Expected payment date (YYYY-MM-DD) */
1410
+ payment_date?: string | undefined;
1411
+ /** Optional note about acceptance */
1412
+ note?: string | undefined;
1413
+ }
1414
+ /**
1415
+ * Input for marking an invoice as paid
1416
+ */
1417
+ interface MarkPaidIncomingInvoiceInput {
1418
+ /** Payment reference (bank transfer ID, check number, etc.) */
1419
+ payment_reference?: string | undefined;
1420
+ /** Payment date (ISO 8601) - defaults to current date/time */
1421
+ paid_at?: string | undefined;
1422
+ /** Optional note about the payment */
1423
+ note?: string | undefined;
1424
+ }
1425
+ /**
1426
+ * Tenant Incoming Invoices API resource
1427
+ *
1428
+ * Provides operations for managing incoming invoices (purchase invoices)
1429
+ * received by sub-tenants from external suppliers.
1430
+ *
1431
+ * In the French e-invoicing lifecycle, incoming invoices go through these states:
1432
+ * - pending: Awaiting review
1433
+ * - accepted: Approved for payment
1434
+ * - rejected: Disputed/refused
1435
+ * - paid: Payment completed
1436
+ *
1437
+ * @example
1438
+ * ```typescript
1439
+ * import { ScellTenantClient } from '@scell/sdk';
1440
+ *
1441
+ * const client = new ScellTenantClient('your-tenant-key');
1442
+ *
1443
+ * // Create an incoming invoice for a sub-tenant
1444
+ * const { data: invoice } = await client.incomingInvoices.create(
1445
+ * 'sub-tenant-uuid',
1446
+ * {
1447
+ * invoice_number: 'SUPP-2026-001',
1448
+ * company_id: 'company-uuid',
1449
+ * seller: {
1450
+ * company_name: 'Supplier Corp',
1451
+ * siren: '123456789',
1452
+ * address: {
1453
+ * line1: '789 Rue Fournisseur',
1454
+ * postal_code: '33000',
1455
+ * city: 'Bordeaux',
1456
+ * country: 'FR'
1457
+ * },
1458
+ * email: 'invoices@supplier.com'
1459
+ * },
1460
+ * lines: [{
1461
+ * description: 'Raw materials',
1462
+ * quantity: 100,
1463
+ * unit_price: 10,
1464
+ * tax_rate: 20,
1465
+ * total_ht: 1000,
1466
+ * total_tax: 200,
1467
+ * total_ttc: 1200
1468
+ * }],
1469
+ * issue_date: '2026-01-20',
1470
+ * total_ht: 1000,
1471
+ * total_ttc: 1200
1472
+ * }
1473
+ * );
1474
+ *
1475
+ * // Accept the invoice
1476
+ * await client.incomingInvoices.accept(invoice.id, {
1477
+ * payment_date: '2026-02-20',
1478
+ * note: 'Approved by finance department'
1479
+ * });
1480
+ *
1481
+ * // Later, mark as paid
1482
+ * await client.incomingInvoices.markPaid(invoice.id, {
1483
+ * payment_reference: 'VIR-2026-0150'
1484
+ * });
1485
+ * ```
1486
+ */
1487
+ declare class TenantIncomingInvoicesResource {
1488
+ private readonly http;
1489
+ constructor(http: HttpClient);
1490
+ /**
1491
+ * Create a new incoming invoice for a sub-tenant
1492
+ *
1493
+ * Creates a purchase invoice received by a sub-tenant from an external supplier.
1494
+ * The seller's SIREN is validated using the Luhn algorithm.
1495
+ *
1496
+ * @param subTenantId - Sub-tenant UUID
1497
+ * @param params - Invoice creation parameters
1498
+ * @param requestOptions - Optional request configuration
1499
+ * @returns Created invoice
1500
+ *
1501
+ * @example
1502
+ * ```typescript
1503
+ * const { data: invoice } = await client.incomingInvoices.create(
1504
+ * 'sub-tenant-uuid',
1505
+ * {
1506
+ * invoice_number: 'SUPP-2026-001',
1507
+ * company_id: 'company-uuid',
1508
+ * seller: {
1509
+ * company_name: 'Acme Supplies',
1510
+ * siren: '123456789',
1511
+ * siret: '12345678901234',
1512
+ * vat_number: 'FR12123456789',
1513
+ * address: {
1514
+ * line1: '123 Industrial Park',
1515
+ * postal_code: '31000',
1516
+ * city: 'Toulouse',
1517
+ * country: 'FR'
1518
+ * },
1519
+ * email: 'billing@acme-supplies.com'
1520
+ * },
1521
+ * lines: [
1522
+ * {
1523
+ * description: 'Widget A - Bulk order',
1524
+ * quantity: 500,
1525
+ * unit_price: 2.50,
1526
+ * tax_rate: 20,
1527
+ * total_ht: 1250,
1528
+ * total_tax: 250,
1529
+ * total_ttc: 1500
1530
+ * }
1531
+ * ],
1532
+ * issue_date: '2026-01-15',
1533
+ * due_date: '2026-02-15',
1534
+ * total_ht: 1250,
1535
+ * total_ttc: 1500
1536
+ * }
1537
+ * );
1538
+ *
1539
+ * console.log('Incoming invoice created:', invoice.invoice_number);
1540
+ * ```
1541
+ */
1542
+ create(subTenantId: string, params: CreateIncomingInvoiceParams, requestOptions?: RequestOptions): Promise<SingleResponse<TenantInvoice>>;
1543
+ /**
1544
+ * List incoming invoices for a sub-tenant
1545
+ *
1546
+ * Returns a paginated list of purchase invoices received by the sub-tenant.
1547
+ *
1548
+ * @param subTenantId - Sub-tenant UUID
1549
+ * @param filters - Filter and pagination options
1550
+ * @param requestOptions - Optional request configuration
1551
+ * @returns Paginated list of invoices
1552
+ *
1553
+ * @example
1554
+ * ```typescript
1555
+ * // List all pending invoices
1556
+ * const { data: invoices, meta } = await client.incomingInvoices.listForSubTenant(
1557
+ * 'sub-tenant-uuid',
1558
+ * { status: 'pending', per_page: 50 }
1559
+ * );
1560
+ *
1561
+ * console.log(`Found ${meta.total} pending invoices to review`);
1562
+ *
1563
+ * // Filter by supplier
1564
+ * const acmeInvoices = await client.incomingInvoices.listForSubTenant(
1565
+ * 'sub-tenant-uuid',
1566
+ * { seller_siret: '12345678901234' }
1567
+ * );
1568
+ * ```
1569
+ */
1570
+ listForSubTenant(subTenantId: string, filters?: TenantInvoiceFilters, requestOptions?: RequestOptions): Promise<PaginatedResponse<TenantInvoice>>;
1571
+ /**
1572
+ * Get a specific incoming invoice by ID
1573
+ *
1574
+ * @param invoiceId - Invoice UUID
1575
+ * @param requestOptions - Optional request configuration
1576
+ * @returns Invoice details
1577
+ *
1578
+ * @example
1579
+ * ```typescript
1580
+ * const { data: invoice } = await client.incomingInvoices.get('invoice-uuid');
1581
+ *
1582
+ * console.log('Invoice from:', invoice.seller.name);
1583
+ * console.log('Status:', invoice.status);
1584
+ * console.log('Amount:', invoice.total_ttc, invoice.currency);
1585
+ * ```
1586
+ */
1587
+ get(invoiceId: string, requestOptions?: RequestOptions): Promise<SingleResponse<TenantInvoice>>;
1588
+ /**
1589
+ * Accept an incoming invoice
1590
+ *
1591
+ * Marks the invoice as accepted, indicating approval for payment.
1592
+ * Optionally specify an expected payment date.
1593
+ *
1594
+ * @param invoiceId - Invoice UUID
1595
+ * @param input - Optional acceptance details
1596
+ * @param requestOptions - Optional request configuration
1597
+ * @returns Updated invoice
1598
+ *
1599
+ * @example
1600
+ * ```typescript
1601
+ * // Accept with payment date
1602
+ * const { data: invoice } = await client.incomingInvoices.accept(
1603
+ * 'invoice-uuid',
1604
+ * {
1605
+ * payment_date: '2026-02-15',
1606
+ * note: 'Approved by CFO'
1607
+ * }
1608
+ * );
1609
+ *
1610
+ * console.log('Invoice accepted:', invoice.status); // 'accepted'
1611
+ *
1612
+ * // Simple acceptance
1613
+ * await client.incomingInvoices.accept('invoice-uuid');
1614
+ * ```
1615
+ */
1616
+ accept(invoiceId: string, input?: AcceptIncomingInvoiceInput, requestOptions?: RequestOptions): Promise<SingleResponse<TenantInvoice>>;
1617
+ /**
1618
+ * Reject an incoming invoice
1619
+ *
1620
+ * Marks the invoice as rejected with a reason and optional code.
1621
+ *
1622
+ * @param invoiceId - Invoice UUID
1623
+ * @param reason - Reason for rejection
1624
+ * @param code - Optional standardized rejection code
1625
+ * @param requestOptions - Optional request configuration
1626
+ * @returns Updated invoice
1627
+ *
1628
+ * @example
1629
+ * ```typescript
1630
+ * const { data: invoice } = await client.incomingInvoices.reject(
1631
+ * 'invoice-uuid',
1632
+ * 'Amount does not match purchase order PO-2026-042',
1633
+ * 'incorrect_amount'
1634
+ * );
1635
+ *
1636
+ * console.log('Invoice rejected:', invoice.status); // 'rejected'
1637
+ * ```
1638
+ */
1639
+ reject(invoiceId: string, reason: string, code?: RejectionCode, requestOptions?: RequestOptions): Promise<SingleResponse<TenantInvoice>>;
1640
+ /**
1641
+ * Mark an incoming invoice as paid
1642
+ *
1643
+ * Records payment information for an accepted invoice.
1644
+ * This is a mandatory step in the French e-invoicing lifecycle.
1645
+ *
1646
+ * @param invoiceId - Invoice UUID
1647
+ * @param input - Optional payment details
1648
+ * @param requestOptions - Optional request configuration
1649
+ * @returns Updated invoice with payment information
1650
+ *
1651
+ * @example
1652
+ * ```typescript
1653
+ * // Mark as paid with details
1654
+ * const { data: invoice } = await client.incomingInvoices.markPaid(
1655
+ * 'invoice-uuid',
1656
+ * {
1657
+ * payment_reference: 'VIR-2026-0150',
1658
+ * paid_at: '2026-02-14T14:30:00Z',
1659
+ * note: 'Payment via bank transfer'
1660
+ * }
1661
+ * );
1662
+ *
1663
+ * console.log('Invoice paid:', invoice.status); // 'paid'
1664
+ * console.log('Payment ref:', invoice.payment_reference);
1665
+ *
1666
+ * // Simple mark as paid (current date)
1667
+ * await client.incomingInvoices.markPaid('invoice-uuid');
1668
+ * ```
1669
+ */
1670
+ markPaid(invoiceId: string, input?: MarkPaidIncomingInvoiceInput, requestOptions?: RequestOptions): Promise<SingleResponse<TenantInvoice>>;
1671
+ /**
1672
+ * Delete an incoming invoice
1673
+ *
1674
+ * Only invoices in 'pending' status can be deleted.
1675
+ *
1676
+ * @param invoiceId - Invoice UUID
1677
+ * @param requestOptions - Optional request configuration
1678
+ *
1679
+ * @example
1680
+ * ```typescript
1681
+ * await client.incomingInvoices.delete('pending-invoice-uuid');
1682
+ * console.log('Incoming invoice deleted');
1683
+ * ```
1684
+ */
1685
+ delete(invoiceId: string, requestOptions?: RequestOptions): Promise<MessageResponse>;
1686
+ /**
1687
+ * Download incoming invoice as PDF
1688
+ *
1689
+ * @param invoiceId - Invoice UUID
1690
+ * @param requestOptions - Optional request configuration
1691
+ * @returns ArrayBuffer containing the PDF file
1692
+ *
1693
+ * @example
1694
+ * ```typescript
1695
+ * const pdfBuffer = await client.incomingInvoices.download('invoice-uuid');
1696
+ *
1697
+ * // Save to file (Node.js)
1698
+ * import { writeFileSync } from 'fs';
1699
+ * writeFileSync('supplier-invoice.pdf', Buffer.from(pdfBuffer));
1700
+ * ```
1701
+ */
1702
+ download(invoiceId: string, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
1703
+ }
1704
+
1705
+ /**
1706
+ * Tenant Credit Notes types
1707
+ *
1708
+ * @packageDocumentation
1709
+ */
1710
+
1711
+ /**
1712
+ * Credit note status
1713
+ */
1714
+ type TenantCreditNoteStatus = 'draft' | 'sent' | 'cancelled';
1715
+ /**
1716
+ * Credit note type
1717
+ */
1718
+ type TenantCreditNoteType = 'partial' | 'total';
1719
+ /**
1720
+ * Credit note item
1721
+ */
1722
+ interface TenantCreditNoteItem {
1723
+ id: UUID;
1724
+ invoice_line_id?: UUID | undefined;
1725
+ description: string;
1726
+ quantity: number;
1727
+ unit_price: number;
1728
+ tax_rate: number;
1729
+ total: number;
1730
+ }
1731
+ /**
1732
+ * Tenant Credit Note
1733
+ */
1734
+ interface TenantCreditNote {
1735
+ id: UUID;
1736
+ credit_note_number: string;
1737
+ invoice_id: UUID;
1738
+ tenant_id: UUID;
1739
+ sub_tenant_id: UUID;
1740
+ status: TenantCreditNoteStatus;
1741
+ type: TenantCreditNoteType;
1742
+ reason: string;
1743
+ subtotal: number;
1744
+ tax_amount: number;
1745
+ total: number;
1746
+ currency: CurrencyCode;
1747
+ buyer_name?: string | undefined;
1748
+ buyer_siret?: Siret | undefined;
1749
+ seller_name?: string | undefined;
1750
+ seller_siret?: Siret | undefined;
1751
+ issue_date: DateString;
1752
+ created_at: DateTimeString;
1753
+ updated_at: DateTimeString;
1754
+ items?: TenantCreditNoteItem[] | undefined;
1755
+ }
1756
+ /**
1757
+ * Credit note item input for creation
1758
+ */
1759
+ interface TenantCreditNoteItemInput {
1760
+ invoice_line_id: UUID;
1761
+ quantity?: number | undefined;
1762
+ }
1763
+ /**
1764
+ * Input for creating a tenant credit note
1765
+ */
1766
+ interface CreateTenantCreditNoteInput {
1767
+ invoice_id: UUID;
1768
+ reason: string;
1769
+ type: TenantCreditNoteType;
1770
+ items?: TenantCreditNoteItemInput[] | undefined;
1771
+ metadata?: Record<string, unknown> | undefined;
1772
+ }
1773
+ /**
1774
+ * Line item remaining creditable information
1775
+ */
1776
+ interface RemainingCreditableLine {
1777
+ invoice_line_id: UUID;
1778
+ description: string;
1779
+ original_quantity: number;
1780
+ credited_quantity: number;
1781
+ remaining_quantity: number;
1782
+ unit_price: number;
1783
+ }
1784
+ /**
1785
+ * Remaining creditable information for an invoice
1786
+ */
1787
+ interface RemainingCreditable {
1788
+ invoice_id: UUID;
1789
+ invoice_total: number;
1790
+ credited_total: number;
1791
+ remaining_total: number;
1792
+ lines: RemainingCreditableLine[];
1793
+ }
1794
+ /**
1795
+ * List options for tenant credit notes
1796
+ */
1797
+ interface TenantCreditNoteListOptions extends PaginationOptions {
1798
+ status?: TenantCreditNoteStatus | undefined;
1799
+ date_from?: DateString | undefined;
1800
+ date_to?: DateString | undefined;
1801
+ }
1802
+ /**
1803
+ * Input for updating a tenant credit note
1804
+ *
1805
+ * Only credit notes in 'draft' status can be updated.
1806
+ */
1807
+ interface UpdateTenantCreditNoteInput {
1808
+ /** Updated reason for the credit note */
1809
+ reason?: string | undefined;
1810
+ /** Updated items (for partial credit notes) */
1811
+ items?: TenantCreditNoteItemInput[] | undefined;
1812
+ /** Updated metadata */
1813
+ metadata?: Record<string, unknown> | undefined;
1814
+ }
1815
+
1816
+ /**
1817
+ * Tenant Credit Notes Resource
1818
+ *
1819
+ * @packageDocumentation
1820
+ */
1821
+
1822
+ /**
1823
+ * Tenant Credit Notes API resource
1824
+ *
1825
+ * Manage credit notes for sub-tenant invoices.
1826
+ *
1827
+ * @example
1828
+ * ```typescript
1829
+ * // List credit notes for a sub-tenant
1830
+ * const { data, meta } = await client.tenantCreditNotes.list('sub-tenant-uuid', {
1831
+ * status: 'sent'
1832
+ * });
1833
+ *
1834
+ * // Create a credit note
1835
+ * const creditNote = await client.tenantCreditNotes.create('sub-tenant-uuid', {
1836
+ * invoice_id: 'invoice-uuid',
1837
+ * reason: 'Product returned',
1838
+ * type: 'partial',
1839
+ * items: [{ invoice_line_id: 'line-uuid', quantity: 1 }]
1840
+ * });
1841
+ * ```
1842
+ */
1843
+ declare class TenantCreditNotesResource {
1844
+ private readonly http;
1845
+ constructor(http: HttpClient);
1846
+ /**
1847
+ * List credit notes for a sub-tenant
1848
+ *
1849
+ * @param subTenantId - Sub-tenant UUID
1850
+ * @param options - Filter and pagination options
1851
+ * @param requestOptions - Request options
1852
+ * @returns Paginated list of credit notes
1853
+ *
1854
+ * @example
1855
+ * ```typescript
1856
+ * const { data, meta } = await client.tenantCreditNotes.list('sub-tenant-uuid', {
1857
+ * status: 'sent',
1858
+ * date_from: '2024-01-01',
1859
+ * per_page: 50
1860
+ * });
1861
+ * console.log(`Found ${meta.total} credit notes`);
1862
+ * ```
1863
+ */
1864
+ list(subTenantId: string, options?: TenantCreditNoteListOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<TenantCreditNote>>;
1865
+ /**
1866
+ * Create a new credit note for a sub-tenant invoice
1867
+ *
1868
+ * @param subTenantId - Sub-tenant UUID
1869
+ * @param input - Credit note creation data
1870
+ * @param requestOptions - Request options
1871
+ * @returns Created credit note
1872
+ *
1873
+ * @example
1874
+ * ```typescript
1875
+ * // Create a partial credit note
1876
+ * const { data: creditNote } = await client.tenantCreditNotes.create(
1877
+ * 'sub-tenant-uuid',
1878
+ * {
1879
+ * invoice_id: 'invoice-uuid',
1880
+ * reason: 'Product returned - damaged item',
1881
+ * type: 'partial',
1882
+ * items: [
1883
+ * { invoice_line_id: 'line-uuid-1', quantity: 2 }
1884
+ * ]
1885
+ * }
1886
+ * );
1887
+ *
1888
+ * // Create a total credit note
1889
+ * const { data: totalCreditNote } = await client.tenantCreditNotes.create(
1890
+ * 'sub-tenant-uuid',
1891
+ * {
1892
+ * invoice_id: 'invoice-uuid',
1893
+ * reason: 'Order cancelled',
1894
+ * type: 'total'
1895
+ * }
1896
+ * );
1897
+ * ```
1898
+ */
1899
+ create(subTenantId: string, input: CreateTenantCreditNoteInput, requestOptions?: RequestOptions): Promise<SingleResponse<TenantCreditNote>>;
1900
+ /**
1901
+ * Get a specific credit note by ID
1902
+ *
1903
+ * @param creditNoteId - Credit note UUID
1904
+ * @param requestOptions - Request options
1905
+ * @returns Credit note details
1906
+ *
1907
+ * @example
1908
+ * ```typescript
1909
+ * const { data: creditNote } = await client.tenantCreditNotes.get('credit-note-uuid');
1910
+ * console.log('Credit note number:', creditNote.credit_note_number);
1911
+ * console.log('Total:', creditNote.total, creditNote.currency);
1912
+ * ```
1913
+ */
1914
+ get(creditNoteId: string, requestOptions?: RequestOptions): Promise<SingleResponse<TenantCreditNote>>;
1915
+ /**
1916
+ * Update a credit note
1917
+ *
1918
+ * Only credit notes in 'draft' status can be updated.
1919
+ *
1920
+ * @param creditNoteId - Credit note UUID
1921
+ * @param input - Update data
1922
+ * @param requestOptions - Request options
1923
+ * @returns Updated credit note
1924
+ *
1925
+ * @example
1926
+ * ```typescript
1927
+ * const { data: creditNote } = await client.tenantCreditNotes.update(
1928
+ * 'credit-note-uuid',
1929
+ * {
1930
+ * reason: 'Updated reason: Customer complaint resolved',
1931
+ * items: [
1932
+ * { invoice_line_id: 'line-uuid', quantity: 3 }
1933
+ * ]
1934
+ * }
1935
+ * );
1936
+ * console.log('Credit note updated:', creditNote.reason);
1937
+ * ```
1938
+ */
1939
+ update(creditNoteId: string, input: UpdateTenantCreditNoteInput, requestOptions?: RequestOptions): Promise<SingleResponse<TenantCreditNote>>;
1940
+ /**
1941
+ * Send a credit note
1942
+ *
1943
+ * Changes the status from 'draft' to 'sent'.
1944
+ *
1945
+ * @param creditNoteId - Credit note UUID
1946
+ * @param requestOptions - Request options
1947
+ * @returns Updated credit note
1948
+ *
1949
+ * @example
1950
+ * ```typescript
1951
+ * const { data: sentCreditNote } = await client.tenantCreditNotes.send('credit-note-uuid');
1952
+ * console.log('Status:', sentCreditNote.status); // 'sent'
1953
+ * ```
1954
+ */
1955
+ send(creditNoteId: string, requestOptions?: RequestOptions): Promise<SingleResponse<TenantCreditNote>>;
1956
+ /**
1957
+ * Delete a credit note (draft only)
1958
+ *
1959
+ * Only credit notes with status 'draft' can be deleted.
1960
+ *
1961
+ * @param creditNoteId - Credit note UUID
1962
+ * @param requestOptions - Request options
1963
+ *
1964
+ * @example
1965
+ * ```typescript
1966
+ * await client.tenantCreditNotes.delete('credit-note-uuid');
1967
+ * ```
1968
+ */
1969
+ delete(creditNoteId: string, requestOptions?: RequestOptions): Promise<MessageResponse>;
1970
+ /**
1971
+ * Download credit note as PDF
1972
+ *
1973
+ * @param creditNoteId - Credit note UUID
1974
+ * @param requestOptions - Request options
1975
+ * @returns ArrayBuffer containing the PDF file
1976
+ *
1977
+ * @example
1978
+ * ```typescript
1979
+ * // Download credit note PDF
1980
+ * const pdfBuffer = await client.tenantCreditNotes.download('credit-note-uuid');
1981
+ *
1982
+ * // In Node.js, save to file:
1983
+ * import { writeFileSync } from 'fs';
1984
+ * writeFileSync('credit-note.pdf', Buffer.from(pdfBuffer));
1985
+ *
1986
+ * // In browser, trigger download:
1987
+ * const blob = new Blob([pdfBuffer], { type: 'application/pdf' });
1988
+ * const url = URL.createObjectURL(blob);
1989
+ * const a = document.createElement('a');
1990
+ * a.href = url;
1991
+ * a.download = 'credit-note.pdf';
1992
+ * a.click();
1993
+ * ```
1994
+ */
1995
+ download(creditNoteId: string, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
1996
+ /**
1997
+ * Get remaining creditable amount for an invoice
1998
+ *
1999
+ * Returns information about how much can still be credited for an invoice,
2000
+ * including per-line breakdown.
2001
+ *
2002
+ * @param invoiceId - Invoice UUID
2003
+ * @param requestOptions - Request options
2004
+ * @returns Remaining creditable information
2005
+ *
2006
+ * @example
2007
+ * ```typescript
2008
+ * const remaining = await client.tenantCreditNotes.remainingCreditable('invoice-uuid');
2009
+ *
2010
+ * console.log('Invoice total:', remaining.invoice_total);
2011
+ * console.log('Already credited:', remaining.credited_total);
2012
+ * console.log('Remaining to credit:', remaining.remaining_total);
2013
+ *
2014
+ * // Check remaining quantity per line
2015
+ * remaining.lines.forEach(line => {
2016
+ * console.log(`${line.description}: ${line.remaining_quantity} remaining`);
2017
+ * });
2018
+ * ```
2019
+ */
2020
+ remainingCreditable(invoiceId: string, requestOptions?: RequestOptions): Promise<RemainingCreditable>;
2021
+ }
2022
+
2023
+ /**
2024
+ * Fiscal Compliance Types
2025
+ *
2026
+ * Types for the fiscal compliance API (LF 2026).
2027
+ *
2028
+ * @packageDocumentation
2029
+ */
2030
+ interface FiscalComplianceData {
2031
+ closing_coverage_percent: number;
2032
+ chain_integrity_percent: number;
2033
+ open_incidents: FiscalIncident[];
2034
+ open_incidents_count: number;
2035
+ overall_status: FiscalComplianceStatus;
2036
+ last_integrity_check_at: string | null;
2037
+ last_closing_at: string | null;
2038
+ last_closing_date: string | null;
2039
+ total_fiscal_entries: number;
2040
+ days_with_activity: number;
2041
+ days_closed: number;
2042
+ attestation_status: FiscalAttestationStatus;
2043
+ }
2044
+ type FiscalComplianceStatus = 'CONFORME' | 'ALERTE' | 'NON_CONFORME';
2045
+ interface FiscalIncident {
2046
+ type: string;
2047
+ severity: 'critical' | 'warning' | 'info';
2048
+ message: string;
2049
+ since?: string;
2050
+ count?: number;
2051
+ }
2052
+ interface FiscalAttestationStatus {
2053
+ current: boolean;
2054
+ software_version: string;
2055
+ attestation_version: string | null;
2056
+ needs_renewal: boolean;
2057
+ reason: string | null;
2058
+ }
2059
+ interface FiscalIntegrityReport {
2060
+ is_valid: boolean;
2061
+ entries_checked: number;
2062
+ broken_links: number;
2063
+ details?: Record<string, unknown>;
2064
+ }
2065
+ interface FiscalIntegrityCheck {
2066
+ id: string;
2067
+ tenant_id: string;
2068
+ result: 'passed' | 'failed';
2069
+ entries_checked: number;
2070
+ broken_links: number;
2071
+ details?: Record<string, unknown>;
2072
+ created_at: string;
2073
+ }
2074
+ interface FiscalIntegrityOptions {
2075
+ date_from?: string;
2076
+ date_to?: string;
2077
+ }
2078
+ interface FiscalIntegrityHistoryOptions {
2079
+ per_page?: number;
2080
+ }
2081
+ interface FiscalClosing {
2082
+ id: string;
2083
+ tenant_id: string;
2084
+ closing_date: string;
2085
+ closing_type: string;
2086
+ status: string;
2087
+ entries_count: number;
2088
+ total_debit: number;
2089
+ total_credit: number;
2090
+ chain_hash?: string;
2091
+ environment?: string;
2092
+ created_at?: string;
2093
+ }
2094
+ interface FiscalClosingsOptions {
2095
+ limit?: number;
2096
+ }
2097
+ interface FiscalDailyClosingInput {
2098
+ date?: string;
2099
+ }
2100
+ interface FiscalFecExportOptions {
2101
+ start_date: string;
2102
+ end_date: string;
2103
+ format?: 'pipe' | 'tab';
2104
+ download?: boolean;
2105
+ }
2106
+ interface FiscalFecExportResult {
2107
+ period: {
2108
+ start_date: string;
2109
+ end_date: string;
2110
+ };
2111
+ format: string;
2112
+ file_path: string;
2113
+ }
2114
+ interface FiscalAttestation {
2115
+ year: number;
2116
+ tenant_name: string;
2117
+ software_version: string;
2118
+ compliance: Record<string, unknown>;
2119
+ generated_at?: string;
2120
+ certificate_hash?: string;
2121
+ }
2122
+ interface FiscalEntry {
2123
+ id: string;
2124
+ tenant_id: string;
2125
+ sequence_number: number;
2126
+ entry_type: string;
2127
+ fiscal_date: string;
2128
+ entity_type?: string | null;
2129
+ entity_id?: string | null;
2130
+ data_snapshot?: Record<string, unknown> | null;
2131
+ data_hash?: string;
2132
+ previous_hash?: string;
2133
+ chain_hash?: string;
2134
+ environment?: string;
2135
+ legal_status?: string;
2136
+ created_at?: string;
2137
+ }
2138
+ interface FiscalEntriesOptions {
2139
+ date_from?: string;
2140
+ date_to?: string;
2141
+ entry_type?: string;
2142
+ environment?: 'production' | 'sandbox';
2143
+ per_page?: number;
2144
+ }
2145
+ interface FiscalKillSwitchStatus {
2146
+ is_active: boolean;
2147
+ kill_switch: FiscalKillSwitch | null;
2148
+ }
2149
+ interface FiscalKillSwitch {
2150
+ id: string;
2151
+ tenant_id: string;
2152
+ is_active: boolean;
2153
+ activated_at: string;
2154
+ reason: string;
2155
+ activated_by: string;
2156
+ deactivated_at?: string | null;
2157
+ deactivated_by?: string | null;
2158
+ }
2159
+ interface FiscalKillSwitchActivateInput {
2160
+ reason: string;
2161
+ }
2162
+ interface FiscalAnchor {
2163
+ id: string;
2164
+ tenant_id: string;
2165
+ anchor_type: string;
2166
+ source_hash: string;
2167
+ anchor_reference?: string | null;
2168
+ anchor_provider?: string | null;
2169
+ anchored_at?: string | null;
2170
+ created_at?: string;
2171
+ }
2172
+ interface FiscalAnchorsOptions {
2173
+ limit?: number;
2174
+ }
2175
+ type FiscalRuleCategory = 'vat' | 'invoicing' | 'credit_note' | 'closing' | 'export';
2176
+ interface FiscalRule {
2177
+ id: string;
2178
+ rule_key: string;
2179
+ name: string;
2180
+ category: FiscalRuleCategory;
2181
+ rule_definition: Record<string, unknown>;
2182
+ version: number;
2183
+ effective_from: string;
2184
+ effective_until?: string | null;
2185
+ legal_reference?: string | null;
2186
+ tenant_id?: string | null;
2187
+ description?: string | null;
2188
+ is_active: boolean;
2189
+ created_at?: string;
2190
+ }
2191
+ interface FiscalRulesOptions {
2192
+ date?: string;
2193
+ category?: FiscalRuleCategory;
2194
+ }
2195
+ interface FiscalCreateRuleInput {
2196
+ rule_key: string;
2197
+ name: string;
2198
+ category: FiscalRuleCategory;
2199
+ rule_definition: Record<string, unknown>;
2200
+ effective_from: string;
2201
+ effective_until?: string;
2202
+ legal_reference?: string;
2203
+ }
2204
+ interface FiscalUpdateRuleInput {
2205
+ rule_definition: Record<string, unknown>;
2206
+ effective_from?: string;
2207
+ effective_until?: string;
2208
+ legal_reference?: string;
2209
+ }
2210
+ interface FiscalExportRulesOptions {
2211
+ start_date: string;
2212
+ end_date: string;
2213
+ }
2214
+ interface FiscalReplayRulesInput {
2215
+ start_date: string;
2216
+ end_date: string;
2217
+ }
2218
+ type FiscalForensicExportType = 'chronology' | 'graph' | 'report';
2219
+ interface FiscalForensicExportOptions {
2220
+ start_date: string;
2221
+ end_date: string;
2222
+ type?: FiscalForensicExportType;
2223
+ }
2224
+
2225
+ /**
2226
+ * Fiscal Compliance Resource
2227
+ * @packageDocumentation
2228
+ */
2229
+
2230
+ declare class FiscalResource {
2231
+ private readonly http;
2232
+ constructor(http: HttpClient);
2233
+ compliance(requestOptions?: RequestOptions): Promise<SingleResponse<FiscalComplianceData>>;
2234
+ integrity(options?: FiscalIntegrityOptions, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalIntegrityReport>>;
2235
+ integrityHistory(options?: FiscalIntegrityHistoryOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalIntegrityReport>>;
2236
+ integrityForDate(date: string, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalIntegrityReport>>;
2237
+ closings(options?: FiscalClosingsOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalClosing>>;
2238
+ performDailyClosing(input?: FiscalDailyClosingInput, requestOptions?: RequestOptions): Promise<MessageResponse>;
2239
+ fecExport(options: FiscalFecExportOptions, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalFecExportResult>>;
2240
+ fecDownload(options: FiscalFecExportOptions, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
2241
+ attestation(year: number, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalAttestation>>;
2242
+ attestationDownload(year: number, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
2243
+ entries(options?: FiscalEntriesOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalEntry>>;
2244
+ killSwitchStatus(requestOptions?: RequestOptions): Promise<SingleResponse<FiscalKillSwitchStatus>>;
2245
+ killSwitchActivate(input: FiscalKillSwitchActivateInput, requestOptions?: RequestOptions): Promise<MessageResponse>;
2246
+ killSwitchDeactivate(requestOptions?: RequestOptions): Promise<MessageResponse>;
2247
+ anchors(options?: FiscalAnchorsOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalAnchor>>;
2248
+ rules(options?: FiscalRulesOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalRule>>;
2249
+ ruleDetail(key: string, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalRule>>;
2250
+ ruleHistory(key: string, requestOptions?: RequestOptions): Promise<PaginatedResponse<FiscalRule>>;
2251
+ createRule(input: FiscalCreateRuleInput, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalRule>>;
2252
+ updateRule(id: string, input: FiscalUpdateRuleInput, requestOptions?: RequestOptions): Promise<SingleResponse<FiscalRule>>;
2253
+ exportRules(options: FiscalExportRulesOptions, requestOptions?: RequestOptions): Promise<SingleResponse<Record<string, unknown>>>;
2254
+ replayRules(input: FiscalReplayRulesInput, requestOptions?: RequestOptions): Promise<MessageResponse>;
2255
+ forensicExport(options: FiscalForensicExportOptions, requestOptions?: RequestOptions): Promise<SingleResponse<Record<string, unknown>>>;
2256
+ }
2257
+
2258
+ /**
2259
+ * Billing Types
2260
+ *
2261
+ * Types for the tenant billing API.
2262
+ *
2263
+ * @packageDocumentation
2264
+ */
2265
+ interface BillingInvoice {
2266
+ id: string;
2267
+ invoice_number: string;
2268
+ period: string;
2269
+ total_ht: number;
2270
+ total_tax: number;
2271
+ total_ttc: number;
2272
+ status: string;
2273
+ currency: string;
2274
+ issued_at?: string | null;
2275
+ due_date?: string | null;
2276
+ paid_at?: string | null;
2277
+ lines?: BillingInvoiceLine[] | null;
2278
+ }
2279
+ interface BillingInvoiceLine {
2280
+ description: string;
2281
+ quantity: number;
2282
+ unit_price: number;
2283
+ total: number;
2284
+ }
2285
+ interface BillingInvoiceListOptions {
2286
+ per_page?: number;
2287
+ page?: number;
2288
+ }
2289
+ interface BillingUsage {
2290
+ period: string;
2291
+ invoices_count: number;
2292
+ credit_notes_count: number;
2293
+ signatures_count: number;
2294
+ total_cost: number;
2295
+ currency: string;
2296
+ breakdown?: Record<string, unknown> | null;
2297
+ }
2298
+ interface BillingUsageOptions {
2299
+ period?: string;
2300
+ }
2301
+ interface BillingTopUpInput {
2302
+ amount: number;
2303
+ payment_method?: string;
2304
+ }
2305
+ interface BillingTopUpConfirmInput {
2306
+ payment_intent_id: string;
2307
+ }
2308
+ interface BillingTransaction {
2309
+ id: string;
2310
+ type: string;
2311
+ amount: number;
2312
+ currency: string;
2313
+ description?: string | null;
2314
+ reference?: string | null;
2315
+ status?: string | null;
2316
+ created_at?: string | null;
2317
+ }
2318
+ interface BillingTransactionListOptions {
2319
+ per_page?: number;
2320
+ page?: number;
2321
+ }
2322
+
2323
+ /**
2324
+ * Billing Resource
2325
+ * @packageDocumentation
2326
+ */
2327
+
2328
+ declare class BillingResource {
2329
+ private readonly http;
2330
+ constructor(http: HttpClient);
2331
+ invoices(options?: BillingInvoiceListOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<BillingInvoice>>;
2332
+ showInvoice(invoiceId: string, requestOptions?: RequestOptions): Promise<SingleResponse<BillingInvoice>>;
2333
+ downloadInvoice(invoiceId: string, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
2334
+ usage(options?: BillingUsageOptions, requestOptions?: RequestOptions): Promise<SingleResponse<BillingUsage>>;
2335
+ topUp(input: BillingTopUpInput, requestOptions?: RequestOptions): Promise<MessageResponse>;
2336
+ confirmTopUp(input: BillingTopUpConfirmInput, requestOptions?: RequestOptions): Promise<MessageResponse>;
2337
+ transactions(options?: BillingTransactionListOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<BillingTransaction>>;
2338
+ }
2339
+
2340
+ /**
2341
+ * Stats Types
2342
+ *
2343
+ * Types for the tenant statistics API.
2344
+ *
2345
+ * @packageDocumentation
2346
+ */
2347
+ interface StatsOverview {
2348
+ total_invoices: number;
2349
+ total_credit_notes: number;
2350
+ total_revenue: number;
2351
+ total_expenses: number;
2352
+ active_sub_tenants: number;
2353
+ currency: string;
2354
+ status_breakdown?: Record<string, number> | null;
2355
+ period_comparison?: Record<string, unknown> | null;
2356
+ }
2357
+ interface StatsMonthly {
2358
+ month: string;
2359
+ invoices_count: number;
2360
+ credit_notes_count: number;
2361
+ revenue: number;
2362
+ expenses: number;
2363
+ daily_breakdown?: Record<string, unknown>[] | null;
2364
+ }
2365
+ interface StatsOverviewOptions {
2366
+ period?: string;
2367
+ currency?: string;
2368
+ }
2369
+ interface StatsMonthlyOptions {
2370
+ year?: number;
2371
+ month?: number;
2372
+ }
2373
+
2374
+ /**
2375
+ * Stats Resource
2376
+ * @packageDocumentation
2377
+ */
2378
+
2379
+ declare class StatsResource {
2380
+ private readonly http;
2381
+ constructor(http: HttpClient);
2382
+ overview(options?: StatsOverviewOptions, requestOptions?: RequestOptions): Promise<SingleResponse<StatsOverview>>;
2383
+ monthly(options?: StatsMonthlyOptions, requestOptions?: RequestOptions): Promise<SingleResponse<StatsMonthly[]>>;
2384
+ subTenantOverview(subTenantId: string, options?: StatsOverviewOptions, requestOptions?: RequestOptions): Promise<SingleResponse<StatsOverview>>;
2385
+ }
2386
+
2387
+ /**
2388
+ * Sub-Tenant Types
2389
+ *
2390
+ * Types for the sub-tenant management API.
2391
+ *
2392
+ * @packageDocumentation
2393
+ */
2394
+ interface SubTenant {
2395
+ id: string;
2396
+ external_id?: string | null;
2397
+ name: string;
2398
+ siret?: string | null;
2399
+ siren?: string | null;
2400
+ email?: string | null;
2401
+ phone?: string | null;
2402
+ address?: SubTenantAddress | null;
2403
+ metadata?: Record<string, unknown> | null;
2404
+ created_at?: string;
2405
+ updated_at?: string;
2406
+ }
2407
+ interface SubTenantAddress {
2408
+ line1: string;
2409
+ line2?: string;
2410
+ postal_code: string;
2411
+ city: string;
2412
+ country?: string;
2413
+ }
2414
+ interface SubTenantListOptions {
2415
+ per_page?: number;
2416
+ page?: number;
2417
+ search?: string;
2418
+ }
2419
+ interface CreateSubTenantInput {
2420
+ external_id?: string;
2421
+ name: string;
2422
+ siret?: string;
2423
+ siren?: string;
2424
+ email?: string;
2425
+ phone?: string;
2426
+ address?: SubTenantAddress;
2427
+ metadata?: Record<string, unknown>;
2428
+ }
2429
+ interface UpdateSubTenantInput {
2430
+ external_id?: string;
2431
+ name?: string;
2432
+ siret?: string;
2433
+ siren?: string;
2434
+ email?: string;
2435
+ phone?: string;
2436
+ address?: SubTenantAddress;
2437
+ metadata?: Record<string, unknown>;
2438
+ }
2439
+
2440
+ /**
2441
+ * Sub-Tenants Resource
2442
+ * @packageDocumentation
2443
+ */
2444
+
2445
+ declare class SubTenantsResource {
2446
+ private readonly http;
2447
+ constructor(http: HttpClient);
2448
+ list(options?: SubTenantListOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<SubTenant>>;
2449
+ create(input: CreateSubTenantInput, requestOptions?: RequestOptions): Promise<SingleResponse<SubTenant>>;
2450
+ get(id: string, requestOptions?: RequestOptions): Promise<SingleResponse<SubTenant>>;
2451
+ update(id: string, input: UpdateSubTenantInput, requestOptions?: RequestOptions): Promise<SingleResponse<SubTenant>>;
2452
+ delete(id: string, requestOptions?: RequestOptions): Promise<MessageResponse>;
2453
+ findByExternalId(externalId: string, requestOptions?: RequestOptions): Promise<SingleResponse<SubTenant>>;
2454
+ }
2455
+
2456
+ /**
2457
+ * Tenant Profile Types
2458
+ *
2459
+ * Types for tenant profile and identity API.
2460
+ *
2461
+ * @packageDocumentation
2462
+ */
2463
+ interface TenantProfile {
2464
+ id: string;
2465
+ name: string;
2466
+ email?: string;
2467
+ phone?: string;
2468
+ siret?: string;
2469
+ siren?: string;
2470
+ address?: TenantAddress | null;
2471
+ kyb_status?: string;
2472
+ environment?: string;
2473
+ created_at?: string;
2474
+ updated_at?: string;
2475
+ }
2476
+ interface TenantAddress {
2477
+ line1: string;
2478
+ line2?: string;
2479
+ postal_code: string;
2480
+ city: string;
2481
+ country?: string;
2482
+ }
2483
+ interface UpdateTenantProfileInput {
2484
+ name?: string;
2485
+ email?: string;
2486
+ phone?: string;
2487
+ address?: TenantAddress;
2488
+ }
2489
+ interface TenantBalance {
2490
+ credits: number;
2491
+ currency: string;
2492
+ }
2493
+ interface TenantQuickStats {
2494
+ invoices_this_month: number;
2495
+ credit_notes_this_month: number;
2496
+ signatures_this_month: number;
2497
+ }
2498
+ interface RegenerateKeyResult {
2499
+ tenant_key: string;
2500
+ }
2501
+
2502
+ /**
2503
+ * Scell Tenant Client
2504
+ *
2505
+ * Client for multi-tenant operations using X-Tenant-Key authentication.
2506
+ * Use this client for tenant-specific invoice and credit note operations.
2507
+ *
2508
+ * @packageDocumentation
2509
+ */
2510
+
2511
+ /**
2512
+ * Scell Tenant Client
2513
+ *
2514
+ * Use this client for multi-tenant operations with X-Tenant-Key authentication.
2515
+ */
2516
+ declare class ScellTenantClient {
2517
+ private readonly http;
2518
+ /** Direct invoices resource */
2519
+ readonly directInvoices: TenantDirectInvoicesResource;
2520
+ /** Direct credit notes resource */
2521
+ readonly directCreditNotes: TenantDirectCreditNotesResource;
2522
+ /** Incoming invoices resource */
2523
+ readonly incomingInvoices: TenantIncomingInvoicesResource;
2524
+ /** Sub-tenant credit notes resource */
2525
+ readonly subTenantCreditNotes: TenantCreditNotesResource;
2526
+ /** Fiscal compliance resource (LF 2026) */
2527
+ readonly fiscal: FiscalResource;
2528
+ /** Billing resource */
2529
+ readonly billing: BillingResource;
2530
+ /** Stats resource */
2531
+ readonly stats: StatsResource;
2532
+ /** Sub-tenants resource */
2533
+ readonly subTenants: SubTenantsResource;
2534
+ /**
2535
+ * Create a new Scell Tenant Client
2536
+ *
2537
+ * @param tenantKey - Your tenant API key (from dashboard)
2538
+ * @param config - Optional client configuration
2539
+ */
2540
+ constructor(tenantKey: string, config?: ClientConfig);
2541
+ /** Get tenant profile */
2542
+ me(requestOptions?: RequestOptions): Promise<SingleResponse<TenantProfile>>;
2543
+ /** Update tenant profile */
2544
+ updateProfile(input: UpdateTenantProfileInput, requestOptions?: RequestOptions): Promise<SingleResponse<TenantProfile>>;
2545
+ /** Get tenant balance */
2546
+ balance(requestOptions?: RequestOptions): Promise<SingleResponse<TenantBalance>>;
2547
+ /** Get quick stats */
2548
+ quickStats(requestOptions?: RequestOptions): Promise<SingleResponse<TenantQuickStats>>;
2549
+ /** Regenerate tenant key */
2550
+ regenerateKey(requestOptions?: RequestOptions): Promise<SingleResponse<RegenerateKeyResult>>;
2551
+ }
2552
+
246
2553
  /**
247
2554
  * API Key entity
248
2555
  */
@@ -996,238 +3303,6 @@ declare class CompaniesResource {
996
3303
  kycStatus(id: string, requestOptions?: RequestOptions): Promise<KycStatusResponse>;
997
3304
  }
998
3305
 
999
- /**
1000
- * Invoice direction
1001
- */
1002
- type InvoiceDirection = 'outgoing' | 'incoming';
1003
- /**
1004
- * Invoice output format
1005
- */
1006
- type InvoiceFormat = 'facturx' | 'ubl' | 'cii';
1007
- /**
1008
- * Invoice status
1009
- */
1010
- type InvoiceStatus = 'draft' | 'pending' | 'validated' | 'converted' | 'transmitted' | 'accepted' | 'rejected' | 'paid' | 'disputed' | 'cancelled' | 'error';
1011
- /**
1012
- * Invoice download file type
1013
- */
1014
- type InvoiceDownloadType = 'original' | 'converted' | 'pdf';
1015
- /**
1016
- * Invoice line item
1017
- */
1018
- interface InvoiceLine {
1019
- line_number: number;
1020
- description: string;
1021
- quantity: number;
1022
- unit_price: number;
1023
- tax_rate: number;
1024
- total_ht: number;
1025
- total_tax: number;
1026
- total_ttc: number;
1027
- }
1028
- /**
1029
- * Invoice party (seller or buyer)
1030
- */
1031
- interface InvoiceParty {
1032
- siret: Siret;
1033
- name: string;
1034
- address: Address;
1035
- }
1036
- /**
1037
- * Invoice entity
1038
- */
1039
- interface Invoice {
1040
- id: UUID;
1041
- external_id: string | null;
1042
- invoice_number: string;
1043
- direction: InvoiceDirection;
1044
- output_format: InvoiceFormat;
1045
- issue_date: DateString;
1046
- due_date: DateString | null;
1047
- currency: CurrencyCode;
1048
- total_ht: number;
1049
- total_tax: number;
1050
- total_ttc: number;
1051
- seller: InvoiceParty;
1052
- buyer: InvoiceParty;
1053
- lines: InvoiceLine[] | null;
1054
- status: InvoiceStatus;
1055
- status_message: string | null;
1056
- environment: Environment;
1057
- archive_enabled: boolean;
1058
- amount_charged: number | null;
1059
- created_at: DateTimeString;
1060
- validated_at: DateTimeString | null;
1061
- transmitted_at: DateTimeString | null;
1062
- completed_at: DateTimeString | null;
1063
- /** Date when the invoice was marked as paid (ISO 8601) */
1064
- paid_at: DateTimeString | null;
1065
- /** Payment reference (bank transfer ID, check number, etc.) */
1066
- payment_reference: string | null;
1067
- /** Optional note about the payment */
1068
- payment_note: string | null;
1069
- }
1070
- /**
1071
- * Invoice line input for creation
1072
- */
1073
- interface InvoiceLineInput {
1074
- description: string;
1075
- quantity: number;
1076
- unit_price: number;
1077
- tax_rate: number;
1078
- total_ht: number;
1079
- total_tax: number;
1080
- total_ttc: number;
1081
- }
1082
- /**
1083
- * Invoice creation input
1084
- */
1085
- interface CreateInvoiceInput {
1086
- /** Your external reference ID */
1087
- external_id?: string | undefined;
1088
- /** Invoice number (required) */
1089
- invoice_number: string;
1090
- /** Direction: outgoing (sale) or incoming (purchase) */
1091
- direction: InvoiceDirection;
1092
- /** Output format for electronic invoice */
1093
- output_format: InvoiceFormat;
1094
- /** Issue date (YYYY-MM-DD) */
1095
- issue_date: DateString;
1096
- /** Due date (YYYY-MM-DD) */
1097
- due_date?: DateString | undefined;
1098
- /** Currency code (default: EUR) */
1099
- currency?: CurrencyCode | undefined;
1100
- /** Total excluding tax */
1101
- total_ht: number;
1102
- /** Total tax amount */
1103
- total_tax: number;
1104
- /** Total including tax */
1105
- total_ttc: number;
1106
- /** Seller SIRET (14 digits) */
1107
- seller_siret: Siret;
1108
- /** Seller company name */
1109
- seller_name: string;
1110
- /** Seller address */
1111
- seller_address: Address;
1112
- /** Buyer SIRET (14 digits) */
1113
- buyer_siret: Siret;
1114
- /** Buyer company name */
1115
- buyer_name: string;
1116
- /** Buyer address */
1117
- buyer_address: Address;
1118
- /** Invoice line items */
1119
- lines: InvoiceLineInput[];
1120
- /** Enable 10-year archiving */
1121
- archive_enabled?: boolean | undefined;
1122
- }
1123
- /**
1124
- * Invoice list filter options
1125
- */
1126
- interface InvoiceListOptions {
1127
- company_id?: UUID | undefined;
1128
- direction?: InvoiceDirection | undefined;
1129
- status?: InvoiceStatus | undefined;
1130
- environment?: Environment | undefined;
1131
- from?: DateString | undefined;
1132
- to?: DateString | undefined;
1133
- per_page?: number | undefined;
1134
- }
1135
- /**
1136
- * Invoice conversion input
1137
- */
1138
- interface ConvertInvoiceInput {
1139
- invoice_id: UUID;
1140
- target_format: InvoiceFormat;
1141
- }
1142
- /**
1143
- * Invoice download response
1144
- */
1145
- interface InvoiceDownloadResponse {
1146
- url: string;
1147
- expires_at: DateTimeString;
1148
- }
1149
- /**
1150
- * Audit trail entry
1151
- */
1152
- interface AuditTrailEntry {
1153
- action: string;
1154
- details: string;
1155
- actor_ip: string | null;
1156
- created_at: DateTimeString;
1157
- }
1158
- /**
1159
- * Audit trail response
1160
- */
1161
- interface AuditTrailResponse {
1162
- data: AuditTrailEntry[];
1163
- integrity_valid: boolean;
1164
- }
1165
- /**
1166
- * Incoming invoice list filter options
1167
- */
1168
- interface IncomingInvoiceParams {
1169
- status?: InvoiceStatus | undefined;
1170
- seller_siret?: Siret | undefined;
1171
- from?: DateString | undefined;
1172
- to?: DateString | undefined;
1173
- min_amount?: number | undefined;
1174
- max_amount?: number | undefined;
1175
- page?: number | undefined;
1176
- per_page?: number | undefined;
1177
- }
1178
- /**
1179
- * Rejection reason code for incoming invoices
1180
- */
1181
- type RejectionCode = 'incorrect_amount' | 'duplicate' | 'unknown_order' | 'incorrect_vat' | 'other';
1182
- /**
1183
- * Dispute type for incoming invoices
1184
- */
1185
- type DisputeType = 'amount_dispute' | 'quality_dispute' | 'delivery_dispute' | 'other';
1186
- /**
1187
- * Input for accepting an incoming invoice
1188
- */
1189
- interface AcceptInvoiceInput {
1190
- /** Expected payment date (YYYY-MM-DD) */
1191
- payment_date?: DateString | undefined;
1192
- /** Optional note about the acceptance */
1193
- note?: string | undefined;
1194
- }
1195
- /**
1196
- * Input for rejecting an incoming invoice
1197
- */
1198
- interface RejectInvoiceInput {
1199
- /** Reason for rejection */
1200
- reason: string;
1201
- /** Standardized rejection code */
1202
- reason_code: RejectionCode;
1203
- }
1204
- /**
1205
- * Input for disputing an incoming invoice
1206
- */
1207
- interface DisputeInvoiceInput {
1208
- /** Reason for the dispute */
1209
- reason: string;
1210
- /** Type of dispute */
1211
- dispute_type: DisputeType;
1212
- /** Expected correct amount (if amount dispute) */
1213
- expected_amount?: number | undefined;
1214
- }
1215
- /**
1216
- * Input for marking an incoming invoice as paid
1217
- */
1218
- interface MarkPaidInput {
1219
- /** Payment reference (bank transfer ID, check number, etc.) */
1220
- payment_reference?: string | undefined;
1221
- /** Payment date (ISO 8601) - defaults to current date/time if not provided */
1222
- paid_at?: DateTimeString | undefined;
1223
- /** Optional note about the payment */
1224
- note?: string | undefined;
1225
- }
1226
- /**
1227
- * Invoice file download format
1228
- */
1229
- type InvoiceFileFormat = 'pdf' | 'xml';
1230
-
1231
3306
  /**
1232
3307
  * Invoices Resource
1233
3308
  *
@@ -1850,6 +3925,28 @@ declare class SignaturesResource {
1850
3925
  * ```
1851
3926
  */
1852
3927
  cancel(id: string, requestOptions?: RequestOptions): Promise<MessageResponse>;
3928
+ /**
3929
+ * Get signature audit trail (JSON)
3930
+ *
3931
+ * Returns the complete history of actions on the signature:
3932
+ * creation, delivery, opening, signing, refusal, etc.
3933
+ *
3934
+ * @param id - Signature UUID
3935
+ * @param requestOptions - Request options
3936
+ * @returns Audit trail entries with integrity validation
3937
+ *
3938
+ * @example
3939
+ * ```typescript
3940
+ * const { data: entries, integrity_valid } = await client.signatures.auditTrail(
3941
+ * 'signature-uuid'
3942
+ * );
3943
+ *
3944
+ * if (integrity_valid) {
3945
+ * entries.forEach(e => console.log(e.action, e.created_at));
3946
+ * }
3947
+ * ```
3948
+ */
3949
+ auditTrail(id: string, requestOptions?: RequestOptions): Promise<AuditTrailResponse>;
1853
3950
  }
1854
3951
 
1855
3952
  /**
@@ -2410,7 +4507,7 @@ declare class ScellTimeoutError extends ScellError {
2410
4507
  *
2411
4508
  * @example
2412
4509
  * ```typescript
2413
- * import { ScellClient, ScellApiClient, ScellAuth, ScellWebhooks } from '@scell/sdk';
4510
+ * import { ScellClient, ScellApiClient, ScellTenantClient, ScellAuth, ScellWebhooks } from '@scell/sdk';
2414
4511
  *
2415
4512
  * // Dashboard client (Bearer token)
2416
4513
  * const auth = await ScellAuth.login({ email, password });
@@ -2419,9 +4516,15 @@ declare class ScellTimeoutError extends ScellError {
2419
4516
  * // API client (X-API-Key)
2420
4517
  * const apiClient = new ScellApiClient('your-api-key');
2421
4518
  *
4519
+ * // Tenant client (X-Tenant-Key) - for multi-tenant operations
4520
+ * const tenantClient = new ScellTenantClient('your-tenant-key');
4521
+ *
2422
4522
  * // Create invoice
2423
4523
  * const invoice = await apiClient.invoices.create({...});
2424
4524
  *
4525
+ * // Create direct invoice (tenant)
4526
+ * const directInvoice = await tenantClient.directInvoices.create({...});
4527
+ *
2425
4528
  * // Verify webhook
2426
4529
  * const isValid = await ScellWebhooks.verifySignature(payload, signature, secret);
2427
4530
  * ```
@@ -2518,10 +4621,24 @@ declare class ScellApiClient {
2518
4621
  readonly invoices: InvoicesResource;
2519
4622
  /** Signature operations (create, download, remind, cancel) */
2520
4623
  readonly signatures: SignaturesResource;
4624
+ /** Sub-tenant management (provision, update, list) */
4625
+ readonly subTenants: SubTenantsResource;
4626
+ /** NF525 fiscal compliance (closings, FEC, attestation) */
4627
+ readonly fiscal: FiscalResource;
4628
+ /** Platform statistics */
4629
+ readonly stats: StatsResource;
4630
+ /** Platform billing (usage, top-up, transactions) */
4631
+ readonly billing: BillingResource;
4632
+ /** Credit notes operations (create, send, download) */
4633
+ readonly creditNotes: TenantCreditNotesResource;
4634
+ /** Tenant invoice operations (create, submit, update, delete) */
4635
+ readonly tenantInvoices: TenantDirectInvoicesResource;
4636
+ /** Incoming invoice operations (list, accept, reject) */
4637
+ readonly incomingInvoices: TenantIncomingInvoicesResource;
2521
4638
  /**
2522
4639
  * Create a new Scell API Client
2523
4640
  *
2524
- * @param apiKey - Your API key (from dashboard)
4641
+ * @param apiKey - Your API key (sk_live_xxx or sk_test_xxx)
2525
4642
  * @param config - Client configuration
2526
4643
  *
2527
4644
  * @example
@@ -2538,4 +4655,4 @@ declare class ScellApiClient {
2538
4655
  constructor(apiKey: string, config?: ClientConfig);
2539
4656
  }
2540
4657
 
2541
- export { type AcceptInvoiceInput, type Address, type ApiErrorResponse, type ApiKey, type ApiKeyWithSecret, type AuditTrailEntry, type AuditTrailResponse, type AuthResponse, type Balance, type BalanceWebhookData, type ClientConfig, type Company, type CompanyStatus, type ConvertInvoiceInput, type CreateApiKeyInput, type CreateCompanyInput, type CreateInvoiceInput, type CreateSignatureInput, type CreateWebhookInput, type CurrencyCode, type DateRangeOptions, type DateString, type DateTimeString, type DisputeInvoiceInput, type DisputeType, type Environment, type ForgotPasswordInput, type IncomingInvoiceParams, type Invoice, type InvoiceDirection, type InvoiceDownloadResponse, type InvoiceDownloadType, type InvoiceFileFormat, type InvoiceFormat, type InvoiceIncomingPaidPayload, type InvoiceLine, type InvoiceLineInput, type InvoiceListOptions, type InvoiceParty, type InvoiceStatus, type InvoiceWebhookData, type KycInitiateResponse, type KycStatusResponse, type LoginCredentials, type MarkPaidInput, type MessageResponse, type MessageWithDataResponse, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type RegisterInput, type RejectInvoiceInput, type RejectionCode, type ReloadBalanceInput, type ReloadBalanceResponse, type ResetPasswordInput, type RetryOptions, ScellApiClient, ScellAuth, ScellAuthenticationError, ScellAuthorizationError, ScellClient, ScellError, ScellInsufficientBalanceError, ScellNetworkError, ScellNotFoundError, ScellRateLimitError, ScellServerError, ScellTimeoutError, ScellValidationError, ScellWebhooks, type Signature, type SignatureDownloadResponse, type SignatureDownloadType, type SignatureListOptions, type SignaturePosition, type SignatureRemindResponse, type SignatureStatus, type SignatureUIConfig, type SignatureWebhookData, type Signer, type SignerAuthMethod, type SignerInput, type SignerStatus, type SingleResponse, type Siren, type Siret, type Transaction, type TransactionListOptions, type TransactionService, type TransactionType, type UUID, type UpdateBalanceSettingsInput, type UpdateCompanyInput, type UpdateWebhookInput, type User, type VerifySignatureOptions, type Webhook, type WebhookEvent, type WebhookListOptions, type WebhookLog, type WebhookPayload, type WebhookTestResponse, type WebhookWithSecret, createRetryWrapper, withRetry };
4658
+ export { type AcceptInvoiceInput, type Address, type ApiErrorResponse, type ApiKey, type ApiKeyWithSecret, type AuditTrailEntry, type AuditTrailResponse, type AuthResponse, type Balance, type BalanceWebhookData, type BillingInvoice, type BillingInvoiceLine, type BillingInvoiceListOptions, type BillingTopUpConfirmInput, type BillingTopUpInput, type BillingTransaction, type BillingTransactionListOptions, type BillingUsage, type BillingUsageOptions, type ClientConfig, type Company, type CompanyStatus, type ConvertInvoiceInput, type CreateApiKeyInput, type CreateCompanyInput, type CreateIncomingInvoiceParams, type CreateInvoiceInput, type CreateSignatureInput, type CreateSubTenantInput, type CreateTenantCreditNoteInput, type CreateTenantDirectCreditNoteParams, type CreateTenantDirectInvoiceParams, type CreateWebhookInput, type CurrencyCode, type DateRangeOptions, type DateString, type DateTimeString, type DisputeInvoiceInput, type DisputeType, type Environment, type FiscalAnchor, type FiscalAnchorsOptions, type FiscalAttestation, type FiscalAttestationStatus, type FiscalClosing, type FiscalClosingsOptions, type FiscalComplianceData, type FiscalComplianceStatus, type FiscalCreateRuleInput, type FiscalDailyClosingInput, type FiscalEntriesOptions, type FiscalEntry, type FiscalExportRulesOptions, type FiscalFecExportOptions, type FiscalFecExportResult, type FiscalForensicExportOptions, type FiscalForensicExportType, type FiscalIncident, type FiscalIntegrityCheck, type FiscalIntegrityHistoryOptions, type FiscalIntegrityOptions, type FiscalIntegrityReport, type FiscalKillSwitch, type FiscalKillSwitchActivateInput, type FiscalKillSwitchStatus, type FiscalReplayRulesInput, type FiscalRule, type FiscalRuleCategory, type FiscalRulesOptions, type FiscalUpdateRuleInput, type ForgotPasswordInput, type IncomingInvoiceParams, type Invoice, type InvoiceDirection, type InvoiceDownloadResponse, type InvoiceDownloadType, type InvoiceFileFormat, type InvoiceFormat, type InvoiceIncomingPaidPayload, type InvoiceLine, type InvoiceLineInput, type InvoiceListOptions, type InvoiceParty, type InvoiceStatus, type InvoiceWebhookData, type KycInitiateResponse, type KycStatusResponse, type LoginCredentials, type MarkPaidInput, type MessageResponse, type MessageWithDataResponse, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type RegenerateKeyResult, type RegisterInput, type RejectInvoiceInput, type RejectionCode, type ReloadBalanceInput, type ReloadBalanceResponse, type RemainingCreditable, type RemainingCreditableLine, type ResetPasswordInput, type RetryOptions, ScellApiClient, ScellAuth, ScellAuthenticationError, ScellAuthorizationError, ScellClient, ScellError, ScellInsufficientBalanceError, ScellNetworkError, ScellNotFoundError, ScellRateLimitError, ScellServerError, ScellTenantClient, ScellTimeoutError, ScellValidationError, ScellWebhooks, type Signature, type SignatureDownloadResponse, type SignatureDownloadType, type SignatureListOptions, type SignaturePosition, type SignatureRemindResponse, type SignatureStatus, type SignatureUIConfig, type SignatureWebhookData, type Signer, type SignerAuthMethod, type SignerInput, type SignerStatus, type SingleResponse, type Siren, type Siret, type StatsMonthly, type StatsMonthlyOptions, type StatsOverview, type StatsOverviewOptions, type SubTenant, type SubTenantAddress, type SubTenantListOptions, type TenantAddress, type TenantBalance, type TenantCreditNote, type TenantCreditNoteFilters, type TenantCreditNoteItem, type TenantCreditNoteItemInput, type TenantCreditNoteListOptions, type TenantCreditNoteStatus, type TenantCreditNoteType, type TenantInvoice, type TenantInvoiceBuyer, type TenantInvoiceDirection, type TenantInvoiceFilters, type TenantInvoiceSeller, type TenantProfile, type TenantQuickStats, type Transaction, type TransactionListOptions, type TransactionService, type TransactionType, type UUID, type UpdateBalanceSettingsInput, type UpdateCompanyInput, type UpdateSubTenantInput, type UpdateTenantCreditNoteInput, type UpdateTenantCreditNoteParams, type UpdateTenantInvoiceParams, type UpdateTenantProfileInput, type UpdateWebhookInput, type User, type VerifySignatureOptions, type Webhook, type WebhookEvent, type WebhookListOptions, type WebhookLog, type WebhookPayload, type WebhookTestResponse, type WebhookWithSecret, createRetryWrapper, withRetry };