@scell/sdk 1.4.0 → 1.7.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 (48) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +92 -9
  3. package/dist/index.d.mts +223 -4
  4. package/dist/index.d.ts +223 -4
  5. package/dist/index.js +207 -5
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +207 -5
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/src/client.ts +0 -0
  11. package/src/errors.ts +0 -0
  12. package/src/index.ts +32 -4
  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 +0 -0
  17. package/src/resources/companies.ts +0 -0
  18. package/src/resources/credit-notes.ts +192 -0
  19. package/src/resources/fiscal.ts +1 -1
  20. package/src/resources/invoices.ts +24 -0
  21. package/src/resources/signatures.ts +33 -0
  22. package/src/resources/stats.ts +0 -0
  23. package/src/resources/sub-tenants.ts +0 -0
  24. package/src/resources/tenant-credit-notes.ts +0 -0
  25. package/src/resources/tenant-direct-credit-notes.ts +0 -0
  26. package/src/resources/tenant-direct-invoices.ts +0 -0
  27. package/src/resources/tenant-incoming-invoices.ts +0 -0
  28. package/src/resources/webhooks.ts +0 -0
  29. package/src/tenant-client.ts +0 -0
  30. package/src/types/api-keys.ts +0 -0
  31. package/src/types/auth.ts +0 -0
  32. package/src/types/balance.ts +0 -0
  33. package/src/types/billing.ts +0 -0
  34. package/src/types/common.ts +0 -0
  35. package/src/types/companies.ts +0 -0
  36. package/src/types/credit-notes.ts +57 -0
  37. package/src/types/fiscal.ts +0 -0
  38. package/src/types/index.ts +8 -0
  39. package/src/types/invoices.ts +0 -0
  40. package/src/types/signatures.ts +0 -0
  41. package/src/types/stats.ts +0 -0
  42. package/src/types/sub-tenants.ts +0 -0
  43. package/src/types/tenant-credit-notes.ts +0 -0
  44. package/src/types/tenant-invoices.ts +0 -0
  45. package/src/types/tenant-profile.ts +0 -0
  46. package/src/types/webhooks.ts +0 -0
  47. package/src/utils/retry.ts +0 -0
  48. package/src/utils/webhook-verify.ts +0 -0
package/dist/index.d.ts CHANGED
@@ -3303,6 +3303,176 @@ declare class CompaniesResource {
3303
3303
  kycStatus(id: string, requestOptions?: RequestOptions): Promise<KycStatusResponse>;
3304
3304
  }
3305
3305
 
3306
+ /**
3307
+ * Credit Notes types (direct user / dashboard)
3308
+ *
3309
+ * @packageDocumentation
3310
+ */
3311
+
3312
+ /**
3313
+ * Credit note item
3314
+ */
3315
+ interface CreditNoteItem {
3316
+ description: string;
3317
+ quantity: number;
3318
+ unit_price: number;
3319
+ tax_rate: number;
3320
+ total: number;
3321
+ }
3322
+ /**
3323
+ * Credit Note (direct user)
3324
+ */
3325
+ interface CreditNote {
3326
+ id: UUID;
3327
+ invoice_id: UUID;
3328
+ number: string;
3329
+ status: string;
3330
+ total_amount: number;
3331
+ tax_amount: number;
3332
+ currency: CurrencyCode;
3333
+ reason: string;
3334
+ items: CreditNoteItem[];
3335
+ created_at: DateTimeString;
3336
+ updated_at: DateTimeString;
3337
+ }
3338
+ /**
3339
+ * Input for creating a credit note
3340
+ */
3341
+ interface CreateCreditNoteInput {
3342
+ invoice_id: UUID;
3343
+ reason: string;
3344
+ items: CreditNoteItem[];
3345
+ }
3346
+ /**
3347
+ * List options for credit notes
3348
+ */
3349
+ interface CreditNoteListOptions extends PaginationOptions {
3350
+ sort?: string | undefined;
3351
+ order?: 'asc' | 'desc' | undefined;
3352
+ }
3353
+
3354
+ /**
3355
+ * Credit Notes Resource (direct user / dashboard)
3356
+ *
3357
+ * Note: Deletion is forbidden by NF525 fiscal compliance.
3358
+ *
3359
+ * @packageDocumentation
3360
+ */
3361
+
3362
+ /**
3363
+ * Credit Notes API resource
3364
+ *
3365
+ * Manage credit notes for the authenticated dashboard user.
3366
+ *
3367
+ * @example
3368
+ * ```typescript
3369
+ * // List credit notes
3370
+ * const { data, meta } = await client.creditNotes.list({ per_page: 50 });
3371
+ *
3372
+ * // Create a credit note
3373
+ * const creditNote = await client.creditNotes.create({
3374
+ * invoice_id: 'invoice-uuid',
3375
+ * reason: 'Product returned',
3376
+ * items: [{ description: 'Item', quantity: 1, unit_price: 100, tax_rate: 20, total: 120 }]
3377
+ * });
3378
+ * ```
3379
+ */
3380
+ declare class CreditNotesResource {
3381
+ private readonly http;
3382
+ constructor(http: HttpClient);
3383
+ /**
3384
+ * List credit notes with optional filtering
3385
+ *
3386
+ * @param options - Filter and pagination options
3387
+ * @param requestOptions - Request options
3388
+ * @returns Paginated list of credit notes
3389
+ *
3390
+ * @example
3391
+ * ```typescript
3392
+ * const { data, meta } = await client.creditNotes.list({ per_page: 50 });
3393
+ * console.log(`Found ${meta.total} credit notes`);
3394
+ * ```
3395
+ */
3396
+ list(options?: CreditNoteListOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<CreditNote>>;
3397
+ /**
3398
+ * Get a specific credit note by ID
3399
+ *
3400
+ * @param id - Credit note UUID
3401
+ * @param requestOptions - Request options
3402
+ * @returns Credit note details
3403
+ *
3404
+ * @example
3405
+ * ```typescript
3406
+ * const { data: creditNote } = await client.creditNotes.get('credit-note-uuid');
3407
+ * console.log('Credit note number:', creditNote.number);
3408
+ * ```
3409
+ */
3410
+ get(id: string, requestOptions?: RequestOptions): Promise<SingleResponse<CreditNote>>;
3411
+ /**
3412
+ * Create a new credit note
3413
+ *
3414
+ * @param input - Credit note creation data
3415
+ * @param requestOptions - Request options
3416
+ * @returns Created credit note
3417
+ *
3418
+ * @example
3419
+ * ```typescript
3420
+ * const { data: creditNote } = await client.creditNotes.create({
3421
+ * invoice_id: 'invoice-uuid',
3422
+ * reason: 'Product returned',
3423
+ * items: [
3424
+ * { description: 'Item A', quantity: 1, unit_price: 100, tax_rate: 20, total: 120 }
3425
+ * ]
3426
+ * });
3427
+ * ```
3428
+ */
3429
+ create(input: CreateCreditNoteInput, requestOptions?: RequestOptions): Promise<SingleResponse<CreditNote>>;
3430
+ /**
3431
+ * Send a credit note
3432
+ *
3433
+ * @param id - Credit note UUID
3434
+ * @param requestOptions - Request options
3435
+ * @returns Success message
3436
+ *
3437
+ * @example
3438
+ * ```typescript
3439
+ * await client.creditNotes.send('credit-note-uuid');
3440
+ * ```
3441
+ */
3442
+ send(id: string, requestOptions?: RequestOptions): Promise<MessageResponse>;
3443
+ /**
3444
+ * Download credit note as PDF
3445
+ *
3446
+ * @param id - Credit note UUID
3447
+ * @param requestOptions - Request options
3448
+ * @returns ArrayBuffer containing the PDF file
3449
+ *
3450
+ * @example
3451
+ * ```typescript
3452
+ * const pdfBuffer = await client.creditNotes.download('credit-note-uuid');
3453
+ *
3454
+ * // In Node.js, save to file:
3455
+ * import { writeFileSync } from 'fs';
3456
+ * writeFileSync('credit-note.pdf', Buffer.from(pdfBuffer));
3457
+ * ```
3458
+ */
3459
+ download(id: string, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
3460
+ /**
3461
+ * Get remaining creditable amount for an invoice
3462
+ *
3463
+ * @param invoiceId - Invoice UUID
3464
+ * @param requestOptions - Request options
3465
+ * @returns Remaining creditable information
3466
+ *
3467
+ * @example
3468
+ * ```typescript
3469
+ * const { data } = await client.creditNotes.remainingCreditable('invoice-uuid');
3470
+ * console.log('Remaining:', data);
3471
+ * ```
3472
+ */
3473
+ remainingCreditable(invoiceId: string, requestOptions?: RequestOptions): Promise<SingleResponse<Record<string, unknown>>>;
3474
+ }
3475
+
3306
3476
  /**
3307
3477
  * Invoices Resource
3308
3478
  *
@@ -3588,6 +3758,19 @@ declare class InvoicesResource {
3588
3758
  * ```
3589
3759
  */
3590
3760
  markPaid(id: string, data?: MarkPaidInput, requestOptions?: RequestOptions): Promise<SingleResponse<Invoice>>;
3761
+ /**
3762
+ * Submit an invoice for processing
3763
+ *
3764
+ * @param id - Invoice UUID
3765
+ * @param requestOptions - Request options
3766
+ * @returns Success message
3767
+ *
3768
+ * @example
3769
+ * ```typescript
3770
+ * await client.invoices.submit('invoice-uuid');
3771
+ * ```
3772
+ */
3773
+ submit(id: string, requestOptions?: RequestOptions): Promise<MessageResponse>;
3591
3774
  /**
3592
3775
  * Download invoice source file as binary content
3593
3776
  *
@@ -3925,6 +4108,28 @@ declare class SignaturesResource {
3925
4108
  * ```
3926
4109
  */
3927
4110
  cancel(id: string, requestOptions?: RequestOptions): Promise<MessageResponse>;
4111
+ /**
4112
+ * Get signature audit trail (JSON)
4113
+ *
4114
+ * Returns the complete history of actions on the signature:
4115
+ * creation, delivery, opening, signing, refusal, etc.
4116
+ *
4117
+ * @param id - Signature UUID
4118
+ * @param requestOptions - Request options
4119
+ * @returns Audit trail entries with integrity validation
4120
+ *
4121
+ * @example
4122
+ * ```typescript
4123
+ * const { data: entries, integrity_valid } = await client.signatures.auditTrail(
4124
+ * 'signature-uuid'
4125
+ * );
4126
+ *
4127
+ * if (integrity_valid) {
4128
+ * entries.forEach(e => console.log(e.action, e.created_at));
4129
+ * }
4130
+ * ```
4131
+ */
4132
+ auditTrail(id: string, requestOptions?: RequestOptions): Promise<AuditTrailResponse>;
3928
4133
  }
3929
4134
 
3930
4135
  /**
@@ -4547,6 +4752,8 @@ declare class ScellClient {
4547
4752
  readonly invoices: InvoicesResource;
4548
4753
  /** Signature listing (read-only via dashboard) */
4549
4754
  readonly signatures: SignaturesResource;
4755
+ /** Credit notes management */
4756
+ readonly creditNotes: CreditNotesResource;
4550
4757
  /**
4551
4758
  * Create a new Scell Dashboard Client
4552
4759
  *
@@ -4599,12 +4806,24 @@ declare class ScellApiClient {
4599
4806
  readonly invoices: InvoicesResource;
4600
4807
  /** Signature operations (create, download, remind, cancel) */
4601
4808
  readonly signatures: SignaturesResource;
4602
- /** Tenant credit notes operations (create, send, download) */
4603
- readonly tenantCreditNotes: TenantCreditNotesResource;
4809
+ /** Sub-tenant management (provision, update, list) */
4810
+ readonly subTenants: SubTenantsResource;
4811
+ /** NF525 fiscal compliance (closings, FEC, attestation) */
4812
+ readonly fiscal: FiscalResource;
4813
+ /** Platform statistics */
4814
+ readonly stats: StatsResource;
4815
+ /** Platform billing (usage, top-up, transactions) */
4816
+ readonly billing: BillingResource;
4817
+ /** Credit notes operations (create, send, download) */
4818
+ readonly creditNotes: TenantCreditNotesResource;
4819
+ /** Tenant invoice operations (create, submit, update, delete) */
4820
+ readonly tenantInvoices: TenantDirectInvoicesResource;
4821
+ /** Incoming invoice operations (list, accept, reject) */
4822
+ readonly incomingInvoices: TenantIncomingInvoicesResource;
4604
4823
  /**
4605
4824
  * Create a new Scell API Client
4606
4825
  *
4607
- * @param apiKey - Your API key (from dashboard)
4826
+ * @param apiKey - Your API key (sk_live_xxx or sk_test_xxx)
4608
4827
  * @param config - Client configuration
4609
4828
  *
4610
4829
  * @example
@@ -4621,4 +4840,4 @@ declare class ScellApiClient {
4621
4840
  constructor(apiKey: string, config?: ClientConfig);
4622
4841
  }
4623
4842
 
4624
- 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 };
4843
+ 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 CreateCreditNoteInput, type CreateIncomingInvoiceParams, type CreateInvoiceInput, type CreateSignatureInput, type CreateSubTenantInput, type CreateTenantCreditNoteInput, type CreateTenantDirectCreditNoteParams, type CreateTenantDirectInvoiceParams, type CreateWebhookInput, type CreditNote, type CreditNoteItem, type CreditNoteListOptions, 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 };
package/dist/index.js CHANGED
@@ -1575,7 +1575,7 @@ var FiscalResource = class {
1575
1575
  return this.http.post("/tenant/fiscal/rules", input, requestOptions);
1576
1576
  }
1577
1577
  async updateRule(id, input, requestOptions) {
1578
- return this.http.post(`/tenant/fiscal/rules/${id}`, input, requestOptions);
1578
+ return this.http.put(`/tenant/fiscal/rules/${id}`, input, requestOptions);
1579
1579
  }
1580
1580
  async exportRules(options, requestOptions) {
1581
1581
  return this.http.get("/tenant/fiscal/rules/export", options, requestOptions);
@@ -2275,6 +2275,140 @@ var CompaniesResource = class {
2275
2275
  }
2276
2276
  };
2277
2277
 
2278
+ // src/resources/credit-notes.ts
2279
+ var CreditNotesResource = class {
2280
+ constructor(http) {
2281
+ this.http = http;
2282
+ }
2283
+ /**
2284
+ * List credit notes with optional filtering
2285
+ *
2286
+ * @param options - Filter and pagination options
2287
+ * @param requestOptions - Request options
2288
+ * @returns Paginated list of credit notes
2289
+ *
2290
+ * @example
2291
+ * ```typescript
2292
+ * const { data, meta } = await client.creditNotes.list({ per_page: 50 });
2293
+ * console.log(`Found ${meta.total} credit notes`);
2294
+ * ```
2295
+ */
2296
+ async list(options = {}, requestOptions) {
2297
+ return this.http.get(
2298
+ "/credit-notes",
2299
+ options,
2300
+ requestOptions
2301
+ );
2302
+ }
2303
+ /**
2304
+ * Get a specific credit note by ID
2305
+ *
2306
+ * @param id - Credit note UUID
2307
+ * @param requestOptions - Request options
2308
+ * @returns Credit note details
2309
+ *
2310
+ * @example
2311
+ * ```typescript
2312
+ * const { data: creditNote } = await client.creditNotes.get('credit-note-uuid');
2313
+ * console.log('Credit note number:', creditNote.number);
2314
+ * ```
2315
+ */
2316
+ async get(id, requestOptions) {
2317
+ return this.http.get(
2318
+ `/credit-notes/${id}`,
2319
+ void 0,
2320
+ requestOptions
2321
+ );
2322
+ }
2323
+ /**
2324
+ * Create a new credit note
2325
+ *
2326
+ * @param input - Credit note creation data
2327
+ * @param requestOptions - Request options
2328
+ * @returns Created credit note
2329
+ *
2330
+ * @example
2331
+ * ```typescript
2332
+ * const { data: creditNote } = await client.creditNotes.create({
2333
+ * invoice_id: 'invoice-uuid',
2334
+ * reason: 'Product returned',
2335
+ * items: [
2336
+ * { description: 'Item A', quantity: 1, unit_price: 100, tax_rate: 20, total: 120 }
2337
+ * ]
2338
+ * });
2339
+ * ```
2340
+ */
2341
+ async create(input, requestOptions) {
2342
+ return this.http.post(
2343
+ "/credit-notes",
2344
+ input,
2345
+ requestOptions
2346
+ );
2347
+ }
2348
+ /**
2349
+ * Send a credit note
2350
+ *
2351
+ * @param id - Credit note UUID
2352
+ * @param requestOptions - Request options
2353
+ * @returns Success message
2354
+ *
2355
+ * @example
2356
+ * ```typescript
2357
+ * await client.creditNotes.send('credit-note-uuid');
2358
+ * ```
2359
+ */
2360
+ async send(id, requestOptions) {
2361
+ return this.http.post(
2362
+ `/credit-notes/${id}/send`,
2363
+ void 0,
2364
+ requestOptions
2365
+ );
2366
+ }
2367
+ /**
2368
+ * Download credit note as PDF
2369
+ *
2370
+ * @param id - Credit note UUID
2371
+ * @param requestOptions - Request options
2372
+ * @returns ArrayBuffer containing the PDF file
2373
+ *
2374
+ * @example
2375
+ * ```typescript
2376
+ * const pdfBuffer = await client.creditNotes.download('credit-note-uuid');
2377
+ *
2378
+ * // In Node.js, save to file:
2379
+ * import { writeFileSync } from 'fs';
2380
+ * writeFileSync('credit-note.pdf', Buffer.from(pdfBuffer));
2381
+ * ```
2382
+ */
2383
+ async download(id, requestOptions) {
2384
+ return this.http.getRaw(
2385
+ `/credit-notes/${id}/download`,
2386
+ void 0,
2387
+ requestOptions
2388
+ );
2389
+ }
2390
+ /**
2391
+ * Get remaining creditable amount for an invoice
2392
+ *
2393
+ * @param invoiceId - Invoice UUID
2394
+ * @param requestOptions - Request options
2395
+ * @returns Remaining creditable information
2396
+ *
2397
+ * @example
2398
+ * ```typescript
2399
+ * const { data } = await client.creditNotes.remainingCreditable('invoice-uuid');
2400
+ * console.log('Remaining:', data);
2401
+ * ```
2402
+ */
2403
+ async remainingCreditable(invoiceId, requestOptions) {
2404
+ return this.http.get(
2405
+ `/invoices/${invoiceId}/remaining-creditable`,
2406
+ void 0,
2407
+ requestOptions
2408
+ );
2409
+ }
2410
+ };
2411
+
2278
2412
  // src/resources/invoices.ts
2279
2413
  var InvoicesResource = class {
2280
2414
  constructor(http) {
@@ -2590,6 +2724,25 @@ var InvoicesResource = class {
2590
2724
  requestOptions
2591
2725
  );
2592
2726
  }
2727
+ /**
2728
+ * Submit an invoice for processing
2729
+ *
2730
+ * @param id - Invoice UUID
2731
+ * @param requestOptions - Request options
2732
+ * @returns Success message
2733
+ *
2734
+ * @example
2735
+ * ```typescript
2736
+ * await client.invoices.submit('invoice-uuid');
2737
+ * ```
2738
+ */
2739
+ async submit(id, requestOptions) {
2740
+ return this.http.post(
2741
+ `/invoices/${id}/submit`,
2742
+ void 0,
2743
+ requestOptions
2744
+ );
2745
+ }
2593
2746
  /**
2594
2747
  * Download invoice source file as binary content
2595
2748
  *
@@ -2810,6 +2963,34 @@ var SignaturesResource = class {
2810
2963
  requestOptions
2811
2964
  );
2812
2965
  }
2966
+ /**
2967
+ * Get signature audit trail (JSON)
2968
+ *
2969
+ * Returns the complete history of actions on the signature:
2970
+ * creation, delivery, opening, signing, refusal, etc.
2971
+ *
2972
+ * @param id - Signature UUID
2973
+ * @param requestOptions - Request options
2974
+ * @returns Audit trail entries with integrity validation
2975
+ *
2976
+ * @example
2977
+ * ```typescript
2978
+ * const { data: entries, integrity_valid } = await client.signatures.auditTrail(
2979
+ * 'signature-uuid'
2980
+ * );
2981
+ *
2982
+ * if (integrity_valid) {
2983
+ * entries.forEach(e => console.log(e.action, e.created_at));
2984
+ * }
2985
+ * ```
2986
+ */
2987
+ async auditTrail(id, requestOptions) {
2988
+ return this.http.get(
2989
+ `/signatures/${id}/audit-trail`,
2990
+ void 0,
2991
+ requestOptions
2992
+ );
2993
+ }
2813
2994
  };
2814
2995
 
2815
2996
  // src/resources/webhooks.ts
@@ -3182,6 +3363,8 @@ var ScellClient = class {
3182
3363
  invoices;
3183
3364
  /** Signature listing (read-only via dashboard) */
3184
3365
  signatures;
3366
+ /** Credit notes management */
3367
+ creditNotes;
3185
3368
  /**
3186
3369
  * Create a new Scell Dashboard Client
3187
3370
  *
@@ -3206,6 +3389,7 @@ var ScellClient = class {
3206
3389
  this.webhooks = new WebhooksResource(this.http);
3207
3390
  this.invoices = new InvoicesResource(this.http);
3208
3391
  this.signatures = new SignaturesResource(this.http);
3392
+ this.creditNotes = new CreditNotesResource(this.http);
3209
3393
  }
3210
3394
  };
3211
3395
  var ScellApiClient = class {
@@ -3214,12 +3398,24 @@ var ScellApiClient = class {
3214
3398
  invoices;
3215
3399
  /** Signature operations (create, download, remind, cancel) */
3216
3400
  signatures;
3217
- /** Tenant credit notes operations (create, send, download) */
3218
- tenantCreditNotes;
3401
+ /** Sub-tenant management (provision, update, list) */
3402
+ subTenants;
3403
+ /** NF525 fiscal compliance (closings, FEC, attestation) */
3404
+ fiscal;
3405
+ /** Platform statistics */
3406
+ stats;
3407
+ /** Platform billing (usage, top-up, transactions) */
3408
+ billing;
3409
+ /** Credit notes operations (create, send, download) */
3410
+ creditNotes;
3411
+ /** Tenant invoice operations (create, submit, update, delete) */
3412
+ tenantInvoices;
3413
+ /** Incoming invoice operations (list, accept, reject) */
3414
+ incomingInvoices;
3219
3415
  /**
3220
3416
  * Create a new Scell API Client
3221
3417
  *
3222
- * @param apiKey - Your API key (from dashboard)
3418
+ * @param apiKey - Your API key (sk_live_xxx or sk_test_xxx)
3223
3419
  * @param config - Client configuration
3224
3420
  *
3225
3421
  * @example
@@ -3237,7 +3433,13 @@ var ScellApiClient = class {
3237
3433
  this.http = new HttpClient("api-key", apiKey, config);
3238
3434
  this.invoices = new InvoicesResource(this.http);
3239
3435
  this.signatures = new SignaturesResource(this.http);
3240
- this.tenantCreditNotes = new TenantCreditNotesResource(this.http);
3436
+ this.subTenants = new SubTenantsResource(this.http);
3437
+ this.fiscal = new FiscalResource(this.http);
3438
+ this.stats = new StatsResource(this.http);
3439
+ this.billing = new BillingResource(this.http);
3440
+ this.creditNotes = new TenantCreditNotesResource(this.http);
3441
+ this.tenantInvoices = new TenantDirectInvoicesResource(this.http);
3442
+ this.incomingInvoices = new TenantIncomingInvoicesResource(this.http);
3241
3443
  }
3242
3444
  };
3243
3445