@scell/sdk 1.5.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.
package/README.md CHANGED
@@ -204,9 +204,29 @@ const apiClient = new ScellApiClient(apiKey, {
204
204
  // Resources
205
205
  apiClient.invoices // Create, download, convert invoices
206
206
  apiClient.signatures // Create, download, remind, cancel signatures
207
- apiClient.tenantCreditNotes // Create, send, download tenant credit notes
207
+ apiClient.creditNotes // Create, send, download tenant credit notes
208
+ apiClient.subTenants // Sub-tenant management
209
+ apiClient.fiscal // NF525 fiscal compliance
210
+ apiClient.stats // Platform statistics
211
+ apiClient.billing // Usage, top-up, transactions
212
+ apiClient.tenantInvoices // Tenant invoice operations
213
+ apiClient.incomingInvoices // Incoming invoice operations
208
214
  ```
209
215
 
216
+ #### ScellApiClient API Reference
217
+
218
+ | Resource | Methods |
219
+ |----------|---------|
220
+ | `.invoices` | `create(params)`, `list(filters?)`, `get(id)`, `download(id, format?)`, `auditTrail(id)`, `convert(params)`, `incoming(filters?)`, `accept(id, input)`, `reject(id, input)`, `dispute(id, input)`, `markPaid(id, input)`, `downloadFile(id, format?)` |
221
+ | `.signatures` | `create(params)`, `list(filters?)`, `get(id)`, `download(id, type)`, `remind(id)`, `cancel(id)` |
222
+ | `.creditNotes` | `list(subTenantId, options?)`, `create(subTenantId, input)`, `get(id)`, `send(id)`, `download(id)`, `delete(id)`, `remainingCreditable(invoiceId)` |
223
+ | `.subTenants` | `list()`, `create(input)`, `get(id)`, `update(id, input)`, `delete(id)`, `findByExternalId(externalId)` |
224
+ | `.fiscal` | 23 methods (see ScellTenantClient reference) |
225
+ | `.stats` | `overview(options?)`, `monthly(options?)`, `subTenantOverview(subTenantId, options?)` |
226
+ | `.billing` | `invoices(options?)`, `showInvoice(id)`, `downloadInvoice(id)`, `usage(options?)`, `topUp(input)`, `confirmTopUp(input)`, `transactions(options?)` |
227
+ | `.tenantInvoices` | `create(params)`, `list(filters?)`, `get(id)`, `update(id, params)`, `delete(id)`, `validate(id)`, `send(id)`, `download(id)`, `downloadXml(id)`, `bulkCreate(invoices)`, `bulkSubmit(ids)`, `bulkStatus(ids)` |
228
+ | `.incomingInvoices` | `create(subTenantId, params)`, `listForSubTenant(subTenantId)`, `get(id)`, `accept(id)`, `reject(id, reason)`, `markPaid(id)`, `download(id)` |
229
+
210
230
  ### Companies
211
231
 
212
232
  ```typescript
@@ -341,7 +361,7 @@ await apiClient.signatures.cancel(signatureId);
341
361
 
342
362
  ```typescript
343
363
  // List credit notes for a sub-tenant
344
- const { data, meta } = await apiClient.tenantCreditNotes.list('sub-tenant-uuid', {
364
+ const { data, meta } = await apiClient.creditNotes.list('sub-tenant-uuid', {
345
365
  status: 'sent',
346
366
  date_from: '2024-01-01',
347
367
  per_page: 50,
@@ -349,14 +369,14 @@ const { data, meta } = await apiClient.tenantCreditNotes.list('sub-tenant-uuid',
349
369
  console.log(`Found ${meta.total} credit notes`);
350
370
 
351
371
  // Check remaining creditable amount for an invoice
352
- const remaining = await apiClient.tenantCreditNotes.remainingCreditable('invoice-uuid');
372
+ const remaining = await apiClient.creditNotes.remainingCreditable('invoice-uuid');
353
373
  console.log('Remaining to credit:', remaining.remaining_total);
354
374
  remaining.lines.forEach(line => {
355
375
  console.log(`${line.description}: ${line.remaining_quantity} items remaining`);
356
376
  });
357
377
 
358
378
  // Create a partial credit note
359
- const { data: creditNote } = await apiClient.tenantCreditNotes.create('sub-tenant-uuid', {
379
+ const { data: creditNote } = await apiClient.creditNotes.create('sub-tenant-uuid', {
360
380
  invoice_id: 'invoice-uuid',
361
381
  reason: 'Product returned - damaged item',
362
382
  type: 'partial',
@@ -366,27 +386,27 @@ const { data: creditNote } = await apiClient.tenantCreditNotes.create('sub-tenan
366
386
  });
367
387
 
368
388
  // Create a total credit note
369
- const { data: totalCreditNote } = await apiClient.tenantCreditNotes.create('sub-tenant-uuid', {
389
+ const { data: totalCreditNote } = await apiClient.creditNotes.create('sub-tenant-uuid', {
370
390
  invoice_id: 'invoice-uuid',
371
391
  reason: 'Order cancelled',
372
392
  type: 'total'
373
393
  });
374
394
 
375
395
  // Get credit note details
376
- const { data: details } = await apiClient.tenantCreditNotes.get('credit-note-uuid');
396
+ const { data: details } = await apiClient.creditNotes.get('credit-note-uuid');
377
397
  console.log('Credit note number:', details.credit_note_number);
378
398
 
379
399
  // Send a credit note (changes status from draft to sent)
380
- const { data: sent } = await apiClient.tenantCreditNotes.send('credit-note-uuid');
400
+ const { data: sent } = await apiClient.creditNotes.send('credit-note-uuid');
381
401
 
382
402
  // Download credit note as PDF
383
- const pdfBuffer = await apiClient.tenantCreditNotes.download('credit-note-uuid');
403
+ const pdfBuffer = await apiClient.creditNotes.download('credit-note-uuid');
384
404
  // In Node.js:
385
405
  import { writeFileSync } from 'fs';
386
406
  writeFileSync('credit-note.pdf', Buffer.from(pdfBuffer));
387
407
 
388
408
  // Delete a draft credit note
389
- await apiClient.tenantCreditNotes.delete('credit-note-uuid');
409
+ await apiClient.creditNotes.delete('credit-note-uuid');
390
410
  ```
391
411
 
392
412
  ### Balance
@@ -447,6 +467,69 @@ const { data: logs } = await client.webhooks.logs(webhookId);
447
467
  await client.webhooks.delete(webhookId);
448
468
  ```
449
469
 
470
+ ### ScellTenantClient (Multi-Tenant Partner)
471
+
472
+ For multi-tenant operations with X-Tenant-Key authentication.
473
+
474
+ ```typescript
475
+ import { ScellTenantClient } from '@scell/sdk';
476
+
477
+ const tenant = new ScellTenantClient({
478
+ tenantKey: 'tk_live_...',
479
+ baseUrl: 'https://api.scell.io/api/v1', // optional
480
+ });
481
+
482
+ // Profile
483
+ const profile = await tenant.me();
484
+ await tenant.updateProfile({ company_name: 'New Name' });
485
+ const balance = await tenant.balance();
486
+ const stats = await tenant.quickStats();
487
+ await tenant.regenerateKey();
488
+
489
+ // Sub-Tenants
490
+ const subTenants = await tenant.subTenants.list();
491
+ const sub = await tenant.subTenants.create({ ... });
492
+
493
+ // Direct Invoices (without sub-tenant)
494
+ const invoices = await tenant.directInvoices.list();
495
+ const invoice = await tenant.directInvoices.create({ ... });
496
+ await tenant.directInvoices.bulkCreate([...]);
497
+ await tenant.directInvoices.bulkSubmit([id1, id2]);
498
+
499
+ // Direct Credit Notes
500
+ const notes = await tenant.directCreditNotes.list();
501
+ const note = await tenant.directCreditNotes.create({ ... });
502
+
503
+ // Incoming Invoices
504
+ const incoming = await tenant.incomingInvoices.listForSubTenant(subId);
505
+ await tenant.incomingInvoices.accept(invoiceId);
506
+
507
+ // Fiscal Compliance
508
+ const compliance = await tenant.fiscal.compliance();
509
+ const integrity = await tenant.fiscal.integrity();
510
+
511
+ // Billing
512
+ const billingInvoices = await tenant.billing.invoices();
513
+ const usage = await tenant.billing.usage();
514
+
515
+ // Stats
516
+ const overview = await tenant.stats.overview();
517
+ ```
518
+
519
+ #### ScellTenantClient API Reference
520
+
521
+ | Resource | Methods |
522
+ |----------|---------|
523
+ | Direct methods | `me()`, `updateProfile(input)`, `balance()`, `quickStats()`, `regenerateKey()` |
524
+ | `.subTenants` | `list()`, `create(input)`, `get(id)`, `update(id, input)`, `delete(id)`, `findByExternalId(externalId)` |
525
+ | `.directInvoices` | `create(params)`, `list(filters?)`, `get(id)`, `update(id, params)`, `delete(id)`, `validate(id)`, `send(id)`, `download(id)`, `downloadXml(id)`, `bulkCreate(invoices)`, `bulkSubmit(ids)`, `bulkStatus(ids)` |
526
+ | `.directCreditNotes` | `create(params)`, `list(filters?)`, `get(id)`, `update(id, params)`, `send(id)`, `download(id)`, `remainingCreditable(invoiceId)` |
527
+ | `.subTenantCreditNotes` | `list(subTenantId, options?)`, `create(subTenantId, input)`, `get(id)`, `update(id, input)`, `send(id)`, `download(id)`, `remainingCreditable(invoiceId)` |
528
+ | `.incomingInvoices` | `create(subTenantId, params)`, `listForSubTenant(subTenantId, filters?)`, `get(id)`, `accept(id, input?)`, `reject(id, reason, code?)`, `markPaid(id, input?)`, `download(id)` |
529
+ | `.fiscal` | `compliance()`, `integrity()`, `integrityHistory()`, `integrityForDate(date)`, `closings()`, `performDailyClosing(input?)`, `fecExport(options)`, `fecDownload(options)`, `attestation(year)`, `attestationDownload(year)`, `entries()`, `killSwitchStatus()`, `killSwitchActivate(input)`, `killSwitchDeactivate()`, `anchors()`, `rules()`, `ruleDetail(key)`, `ruleHistory(key)`, `createRule(input)`, `updateRule(id, input)`, `exportRules(options)`, `replayRules(input)`, `forensicExport(options)` |
530
+ | `.billing` | `invoices(options?)`, `showInvoice(id)`, `downloadInvoice(id)`, `usage(options?)`, `topUp(input)`, `confirmTopUp(input)`, `transactions(options?)` |
531
+ | `.stats` | `overview(options?)`, `monthly(options?)`, `subTenantOverview(subTenantId, options?)` |
532
+
450
533
  ## Error Handling
451
534
 
452
535
  ```typescript
package/dist/index.d.mts 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
  *
@@ -4569,6 +4752,8 @@ declare class ScellClient {
4569
4752
  readonly invoices: InvoicesResource;
4570
4753
  /** Signature listing (read-only via dashboard) */
4571
4754
  readonly signatures: SignaturesResource;
4755
+ /** Credit notes management */
4756
+ readonly creditNotes: CreditNotesResource;
4572
4757
  /**
4573
4758
  * Create a new Scell Dashboard Client
4574
4759
  *
@@ -4655,4 +4840,4 @@ declare class ScellApiClient {
4655
4840
  constructor(apiKey: string, config?: ClientConfig);
4656
4841
  }
4657
4842
 
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 };
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.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
  *
@@ -4569,6 +4752,8 @@ declare class ScellClient {
4569
4752
  readonly invoices: InvoicesResource;
4570
4753
  /** Signature listing (read-only via dashboard) */
4571
4754
  readonly signatures: SignaturesResource;
4755
+ /** Credit notes management */
4756
+ readonly creditNotes: CreditNotesResource;
4572
4757
  /**
4573
4758
  * Create a new Scell Dashboard Client
4574
4759
  *
@@ -4655,4 +4840,4 @@ declare class ScellApiClient {
4655
4840
  constructor(apiKey: string, config?: ClientConfig);
4656
4841
  }
4657
4842
 
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 };
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 };