@scell/sdk 1.5.0 → 1.8.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 +153 -9
- package/dist/index.d.mts +215 -6
- package/dist/index.d.ts +215 -6
- package/dist/index.js +157 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +157 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/resources/credit-notes.ts +192 -0
- package/src/resources/fiscal.ts +1 -1
- package/src/resources/invoices.ts +24 -0
- package/src/types/common.ts +1 -1
- package/src/types/companies.ts +5 -1
- package/src/types/credit-notes.ts +57 -0
- package/src/types/index.ts +8 -0
- package/src/types/invoices.ts +23 -3
package/README.md
CHANGED
|
@@ -87,6 +87,67 @@ const { data: invoice } = await apiClient.invoices.create({
|
|
|
87
87
|
console.log('Invoice created:', invoice.id);
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
### International Invoicing
|
|
91
|
+
|
|
92
|
+
For non-French parties, SIRET is not required. Use VAT numbers for EU businesses and `legal_id` with a scheme code for non-EU businesses.
|
|
93
|
+
|
|
94
|
+
#### Invoice with Belgian Buyer (EU)
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
const { data: invoice } = await apiClient.invoices.create({
|
|
98
|
+
invoice_number: 'INV-2026-042',
|
|
99
|
+
issue_date: '2026-03-29',
|
|
100
|
+
due_date: '2026-04-28',
|
|
101
|
+
currency: 'EUR',
|
|
102
|
+
// French seller (SIRET required)
|
|
103
|
+
seller_siret: '12345678901234',
|
|
104
|
+
seller_name: 'Ma Société SAS',
|
|
105
|
+
seller_country: 'FR',
|
|
106
|
+
seller_vat_number: 'FR12345678901',
|
|
107
|
+
seller_address: { line1: '10 rue de Paris', postal_code: '75001', city: 'Paris', country: 'FR' },
|
|
108
|
+
// Belgian buyer (no SIRET, VAT number instead)
|
|
109
|
+
buyer_name: 'Entreprise Belge SPRL',
|
|
110
|
+
buyer_country: 'BE',
|
|
111
|
+
buyer_vat_number: 'BE0123456789',
|
|
112
|
+
buyer_address: { line1: '15 Avenue Louise', postal_code: '1050', city: 'Bruxelles', country: 'BE' },
|
|
113
|
+
lines: [
|
|
114
|
+
{ description: 'Consulting services', quantity: 10, unit_price: 150.00, vat_rate: 0 },
|
|
115
|
+
],
|
|
116
|
+
format: 'ubl',
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
> **Note:** For intra-community B2B transactions (e.g. FR -> BE, FR -> DE), VAT rate is typically 0% under the reverse charge mechanism. The buyer accounts for VAT in their own country.
|
|
121
|
+
|
|
122
|
+
#### Invoice with UK Buyer (Non-EU)
|
|
123
|
+
|
|
124
|
+
For non-EU buyers, use `buyer_legal_id` and `buyer_legal_id_scheme` in addition to the VAT number:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
const { data: invoice } = await apiClient.invoices.create({
|
|
128
|
+
invoice_number: 'INV-2026-044',
|
|
129
|
+
issue_date: '2026-03-29',
|
|
130
|
+
due_date: '2026-04-28',
|
|
131
|
+
currency: 'GBP',
|
|
132
|
+
seller_siret: '12345678901234',
|
|
133
|
+
seller_name: 'Ma Société SAS',
|
|
134
|
+
seller_country: 'FR',
|
|
135
|
+
seller_vat_number: 'FR12345678901',
|
|
136
|
+
seller_address: { line1: '10 rue de Paris', postal_code: '75001', city: 'Paris', country: 'FR' },
|
|
137
|
+
// UK buyer — legal_id with scheme
|
|
138
|
+
buyer_name: 'British Ltd',
|
|
139
|
+
buyer_country: 'GB',
|
|
140
|
+
buyer_vat_number: 'GB123456789',
|
|
141
|
+
buyer_legal_id: '12345678',
|
|
142
|
+
buyer_legal_id_scheme: '0088', // UK Company Number scheme
|
|
143
|
+
buyer_address: { line1: '20 Baker Street', postal_code: 'W1U 3BW', city: 'London', country: 'GB' },
|
|
144
|
+
lines: [
|
|
145
|
+
{ description: 'Design services', quantity: 5, unit_price: 200.00, vat_rate: 0 },
|
|
146
|
+
],
|
|
147
|
+
format: 'ubl',
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
90
151
|
### Create a Signature Request
|
|
91
152
|
|
|
92
153
|
```typescript
|
|
@@ -204,9 +265,29 @@ const apiClient = new ScellApiClient(apiKey, {
|
|
|
204
265
|
// Resources
|
|
205
266
|
apiClient.invoices // Create, download, convert invoices
|
|
206
267
|
apiClient.signatures // Create, download, remind, cancel signatures
|
|
207
|
-
apiClient.
|
|
268
|
+
apiClient.creditNotes // Create, send, download tenant credit notes
|
|
269
|
+
apiClient.subTenants // Sub-tenant management
|
|
270
|
+
apiClient.fiscal // NF525 fiscal compliance
|
|
271
|
+
apiClient.stats // Platform statistics
|
|
272
|
+
apiClient.billing // Usage, top-up, transactions
|
|
273
|
+
apiClient.tenantInvoices // Tenant invoice operations
|
|
274
|
+
apiClient.incomingInvoices // Incoming invoice operations
|
|
208
275
|
```
|
|
209
276
|
|
|
277
|
+
#### ScellApiClient API Reference
|
|
278
|
+
|
|
279
|
+
| Resource | Methods |
|
|
280
|
+
|----------|---------|
|
|
281
|
+
| `.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?)` |
|
|
282
|
+
| `.signatures` | `create(params)`, `list(filters?)`, `get(id)`, `download(id, type)`, `remind(id)`, `cancel(id)` |
|
|
283
|
+
| `.creditNotes` | `list(subTenantId, options?)`, `create(subTenantId, input)`, `get(id)`, `send(id)`, `download(id)`, `delete(id)`, `remainingCreditable(invoiceId)` |
|
|
284
|
+
| `.subTenants` | `list()`, `create(input)`, `get(id)`, `update(id, input)`, `delete(id)`, `findByExternalId(externalId)` |
|
|
285
|
+
| `.fiscal` | 23 methods (see ScellTenantClient reference) |
|
|
286
|
+
| `.stats` | `overview(options?)`, `monthly(options?)`, `subTenantOverview(subTenantId, options?)` |
|
|
287
|
+
| `.billing` | `invoices(options?)`, `showInvoice(id)`, `downloadInvoice(id)`, `usage(options?)`, `topUp(input)`, `confirmTopUp(input)`, `transactions(options?)` |
|
|
288
|
+
| `.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)` |
|
|
289
|
+
| `.incomingInvoices` | `create(subTenantId, params)`, `listForSubTenant(subTenantId)`, `get(id)`, `accept(id)`, `reject(id, reason)`, `markPaid(id)`, `download(id)` |
|
|
290
|
+
|
|
210
291
|
### Companies
|
|
211
292
|
|
|
212
293
|
```typescript
|
|
@@ -341,7 +422,7 @@ await apiClient.signatures.cancel(signatureId);
|
|
|
341
422
|
|
|
342
423
|
```typescript
|
|
343
424
|
// List credit notes for a sub-tenant
|
|
344
|
-
const { data, meta } = await apiClient.
|
|
425
|
+
const { data, meta } = await apiClient.creditNotes.list('sub-tenant-uuid', {
|
|
345
426
|
status: 'sent',
|
|
346
427
|
date_from: '2024-01-01',
|
|
347
428
|
per_page: 50,
|
|
@@ -349,14 +430,14 @@ const { data, meta } = await apiClient.tenantCreditNotes.list('sub-tenant-uuid',
|
|
|
349
430
|
console.log(`Found ${meta.total} credit notes`);
|
|
350
431
|
|
|
351
432
|
// Check remaining creditable amount for an invoice
|
|
352
|
-
const remaining = await apiClient.
|
|
433
|
+
const remaining = await apiClient.creditNotes.remainingCreditable('invoice-uuid');
|
|
353
434
|
console.log('Remaining to credit:', remaining.remaining_total);
|
|
354
435
|
remaining.lines.forEach(line => {
|
|
355
436
|
console.log(`${line.description}: ${line.remaining_quantity} items remaining`);
|
|
356
437
|
});
|
|
357
438
|
|
|
358
439
|
// Create a partial credit note
|
|
359
|
-
const { data: creditNote } = await apiClient.
|
|
440
|
+
const { data: creditNote } = await apiClient.creditNotes.create('sub-tenant-uuid', {
|
|
360
441
|
invoice_id: 'invoice-uuid',
|
|
361
442
|
reason: 'Product returned - damaged item',
|
|
362
443
|
type: 'partial',
|
|
@@ -366,27 +447,27 @@ const { data: creditNote } = await apiClient.tenantCreditNotes.create('sub-tenan
|
|
|
366
447
|
});
|
|
367
448
|
|
|
368
449
|
// Create a total credit note
|
|
369
|
-
const { data: totalCreditNote } = await apiClient.
|
|
450
|
+
const { data: totalCreditNote } = await apiClient.creditNotes.create('sub-tenant-uuid', {
|
|
370
451
|
invoice_id: 'invoice-uuid',
|
|
371
452
|
reason: 'Order cancelled',
|
|
372
453
|
type: 'total'
|
|
373
454
|
});
|
|
374
455
|
|
|
375
456
|
// Get credit note details
|
|
376
|
-
const { data: details } = await apiClient.
|
|
457
|
+
const { data: details } = await apiClient.creditNotes.get('credit-note-uuid');
|
|
377
458
|
console.log('Credit note number:', details.credit_note_number);
|
|
378
459
|
|
|
379
460
|
// Send a credit note (changes status from draft to sent)
|
|
380
|
-
const { data: sent } = await apiClient.
|
|
461
|
+
const { data: sent } = await apiClient.creditNotes.send('credit-note-uuid');
|
|
381
462
|
|
|
382
463
|
// Download credit note as PDF
|
|
383
|
-
const pdfBuffer = await apiClient.
|
|
464
|
+
const pdfBuffer = await apiClient.creditNotes.download('credit-note-uuid');
|
|
384
465
|
// In Node.js:
|
|
385
466
|
import { writeFileSync } from 'fs';
|
|
386
467
|
writeFileSync('credit-note.pdf', Buffer.from(pdfBuffer));
|
|
387
468
|
|
|
388
469
|
// Delete a draft credit note
|
|
389
|
-
await apiClient.
|
|
470
|
+
await apiClient.creditNotes.delete('credit-note-uuid');
|
|
390
471
|
```
|
|
391
472
|
|
|
392
473
|
### Balance
|
|
@@ -447,6 +528,69 @@ const { data: logs } = await client.webhooks.logs(webhookId);
|
|
|
447
528
|
await client.webhooks.delete(webhookId);
|
|
448
529
|
```
|
|
449
530
|
|
|
531
|
+
### ScellTenantClient (Multi-Tenant Partner)
|
|
532
|
+
|
|
533
|
+
For multi-tenant operations with X-Tenant-Key authentication.
|
|
534
|
+
|
|
535
|
+
```typescript
|
|
536
|
+
import { ScellTenantClient } from '@scell/sdk';
|
|
537
|
+
|
|
538
|
+
const tenant = new ScellTenantClient({
|
|
539
|
+
tenantKey: 'tk_live_...',
|
|
540
|
+
baseUrl: 'https://api.scell.io/api/v1', // optional
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
// Profile
|
|
544
|
+
const profile = await tenant.me();
|
|
545
|
+
await tenant.updateProfile({ company_name: 'New Name' });
|
|
546
|
+
const balance = await tenant.balance();
|
|
547
|
+
const stats = await tenant.quickStats();
|
|
548
|
+
await tenant.regenerateKey();
|
|
549
|
+
|
|
550
|
+
// Sub-Tenants
|
|
551
|
+
const subTenants = await tenant.subTenants.list();
|
|
552
|
+
const sub = await tenant.subTenants.create({ ... });
|
|
553
|
+
|
|
554
|
+
// Direct Invoices (without sub-tenant)
|
|
555
|
+
const invoices = await tenant.directInvoices.list();
|
|
556
|
+
const invoice = await tenant.directInvoices.create({ ... });
|
|
557
|
+
await tenant.directInvoices.bulkCreate([...]);
|
|
558
|
+
await tenant.directInvoices.bulkSubmit([id1, id2]);
|
|
559
|
+
|
|
560
|
+
// Direct Credit Notes
|
|
561
|
+
const notes = await tenant.directCreditNotes.list();
|
|
562
|
+
const note = await tenant.directCreditNotes.create({ ... });
|
|
563
|
+
|
|
564
|
+
// Incoming Invoices
|
|
565
|
+
const incoming = await tenant.incomingInvoices.listForSubTenant(subId);
|
|
566
|
+
await tenant.incomingInvoices.accept(invoiceId);
|
|
567
|
+
|
|
568
|
+
// Fiscal Compliance
|
|
569
|
+
const compliance = await tenant.fiscal.compliance();
|
|
570
|
+
const integrity = await tenant.fiscal.integrity();
|
|
571
|
+
|
|
572
|
+
// Billing
|
|
573
|
+
const billingInvoices = await tenant.billing.invoices();
|
|
574
|
+
const usage = await tenant.billing.usage();
|
|
575
|
+
|
|
576
|
+
// Stats
|
|
577
|
+
const overview = await tenant.stats.overview();
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
#### ScellTenantClient API Reference
|
|
581
|
+
|
|
582
|
+
| Resource | Methods |
|
|
583
|
+
|----------|---------|
|
|
584
|
+
| Direct methods | `me()`, `updateProfile(input)`, `balance()`, `quickStats()`, `regenerateKey()` |
|
|
585
|
+
| `.subTenants` | `list()`, `create(input)`, `get(id)`, `update(id, input)`, `delete(id)`, `findByExternalId(externalId)` |
|
|
586
|
+
| `.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)` |
|
|
587
|
+
| `.directCreditNotes` | `create(params)`, `list(filters?)`, `get(id)`, `update(id, params)`, `send(id)`, `download(id)`, `remainingCreditable(invoiceId)` |
|
|
588
|
+
| `.subTenantCreditNotes` | `list(subTenantId, options?)`, `create(subTenantId, input)`, `get(id)`, `update(id, input)`, `send(id)`, `download(id)`, `remainingCreditable(invoiceId)` |
|
|
589
|
+
| `.incomingInvoices` | `create(subTenantId, params)`, `listForSubTenant(subTenantId, filters?)`, `get(id)`, `accept(id, input?)`, `reject(id, reason, code?)`, `markPaid(id, input?)`, `download(id)` |
|
|
590
|
+
| `.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)` |
|
|
591
|
+
| `.billing` | `invoices(options?)`, `showInvoice(id)`, `downloadInvoice(id)`, `usage(options?)`, `topUp(input)`, `confirmTopUp(input)`, `transactions(options?)` |
|
|
592
|
+
| `.stats` | `overview(options?)`, `monthly(options?)`, `subTenantOverview(subTenantId, options?)` |
|
|
593
|
+
|
|
450
594
|
## Error Handling
|
|
451
595
|
|
|
452
596
|
```typescript
|
package/dist/index.d.mts
CHANGED
|
@@ -183,7 +183,7 @@ interface Address {
|
|
|
183
183
|
line2?: string | undefined;
|
|
184
184
|
postal_code: string;
|
|
185
185
|
city: string;
|
|
186
|
-
country
|
|
186
|
+
country: string;
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Pagination metadata
|
|
@@ -276,7 +276,11 @@ interface InvoiceLine {
|
|
|
276
276
|
* Invoice party (seller or buyer)
|
|
277
277
|
*/
|
|
278
278
|
interface InvoiceParty {
|
|
279
|
-
siret
|
|
279
|
+
siret?: Siret;
|
|
280
|
+
vat_number?: string;
|
|
281
|
+
legal_id?: string;
|
|
282
|
+
legal_id_scheme?: string;
|
|
283
|
+
country: string;
|
|
280
284
|
name: string;
|
|
281
285
|
address: Address;
|
|
282
286
|
}
|
|
@@ -351,13 +355,29 @@ interface CreateInvoiceInput {
|
|
|
351
355
|
/** Total including tax */
|
|
352
356
|
total_ttc: number;
|
|
353
357
|
/** Seller SIRET (14 digits) */
|
|
354
|
-
seller_siret
|
|
358
|
+
seller_siret?: Siret;
|
|
359
|
+
/** Seller VAT number */
|
|
360
|
+
seller_vat_number?: string;
|
|
361
|
+
/** Seller country (ISO 3166-1 alpha-2) */
|
|
362
|
+
seller_country: string;
|
|
363
|
+
/** Seller legal identifier */
|
|
364
|
+
seller_legal_id?: string;
|
|
365
|
+
/** Seller legal identifier scheme */
|
|
366
|
+
seller_legal_id_scheme?: string;
|
|
355
367
|
/** Seller company name */
|
|
356
368
|
seller_name: string;
|
|
357
369
|
/** Seller address */
|
|
358
370
|
seller_address: Address;
|
|
359
371
|
/** Buyer SIRET (14 digits) */
|
|
360
|
-
buyer_siret
|
|
372
|
+
buyer_siret?: Siret;
|
|
373
|
+
/** Buyer VAT number */
|
|
374
|
+
buyer_vat_number?: string;
|
|
375
|
+
/** Buyer country (ISO 3166-1 alpha-2) */
|
|
376
|
+
buyer_country: string;
|
|
377
|
+
/** Buyer legal identifier */
|
|
378
|
+
buyer_legal_id?: string;
|
|
379
|
+
/** Buyer legal identifier scheme */
|
|
380
|
+
buyer_legal_id_scheme?: string;
|
|
361
381
|
/** Buyer company name */
|
|
362
382
|
buyer_name: string;
|
|
363
383
|
/** Buyer address */
|
|
@@ -3091,6 +3111,8 @@ interface Company {
|
|
|
3091
3111
|
siret: Siret;
|
|
3092
3112
|
siren: Siren | null;
|
|
3093
3113
|
vat_number: string | null;
|
|
3114
|
+
legal_id: string | null;
|
|
3115
|
+
legal_id_scheme: string | null;
|
|
3094
3116
|
legal_form: string | null;
|
|
3095
3117
|
address_line1: string;
|
|
3096
3118
|
address_line2: string | null;
|
|
@@ -3111,7 +3133,9 @@ interface Company {
|
|
|
3111
3133
|
*/
|
|
3112
3134
|
interface CreateCompanyInput {
|
|
3113
3135
|
name: string;
|
|
3114
|
-
siret
|
|
3136
|
+
siret?: Siret;
|
|
3137
|
+
legal_id?: string;
|
|
3138
|
+
legal_id_scheme?: string;
|
|
3115
3139
|
vat_number?: string | undefined;
|
|
3116
3140
|
legal_form?: string | undefined;
|
|
3117
3141
|
address_line1: string;
|
|
@@ -3303,6 +3327,176 @@ declare class CompaniesResource {
|
|
|
3303
3327
|
kycStatus(id: string, requestOptions?: RequestOptions): Promise<KycStatusResponse>;
|
|
3304
3328
|
}
|
|
3305
3329
|
|
|
3330
|
+
/**
|
|
3331
|
+
* Credit Notes types (direct user / dashboard)
|
|
3332
|
+
*
|
|
3333
|
+
* @packageDocumentation
|
|
3334
|
+
*/
|
|
3335
|
+
|
|
3336
|
+
/**
|
|
3337
|
+
* Credit note item
|
|
3338
|
+
*/
|
|
3339
|
+
interface CreditNoteItem {
|
|
3340
|
+
description: string;
|
|
3341
|
+
quantity: number;
|
|
3342
|
+
unit_price: number;
|
|
3343
|
+
tax_rate: number;
|
|
3344
|
+
total: number;
|
|
3345
|
+
}
|
|
3346
|
+
/**
|
|
3347
|
+
* Credit Note (direct user)
|
|
3348
|
+
*/
|
|
3349
|
+
interface CreditNote {
|
|
3350
|
+
id: UUID;
|
|
3351
|
+
invoice_id: UUID;
|
|
3352
|
+
number: string;
|
|
3353
|
+
status: string;
|
|
3354
|
+
total_amount: number;
|
|
3355
|
+
tax_amount: number;
|
|
3356
|
+
currency: CurrencyCode;
|
|
3357
|
+
reason: string;
|
|
3358
|
+
items: CreditNoteItem[];
|
|
3359
|
+
created_at: DateTimeString;
|
|
3360
|
+
updated_at: DateTimeString;
|
|
3361
|
+
}
|
|
3362
|
+
/**
|
|
3363
|
+
* Input for creating a credit note
|
|
3364
|
+
*/
|
|
3365
|
+
interface CreateCreditNoteInput {
|
|
3366
|
+
invoice_id: UUID;
|
|
3367
|
+
reason: string;
|
|
3368
|
+
items: CreditNoteItem[];
|
|
3369
|
+
}
|
|
3370
|
+
/**
|
|
3371
|
+
* List options for credit notes
|
|
3372
|
+
*/
|
|
3373
|
+
interface CreditNoteListOptions extends PaginationOptions {
|
|
3374
|
+
sort?: string | undefined;
|
|
3375
|
+
order?: 'asc' | 'desc' | undefined;
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3378
|
+
/**
|
|
3379
|
+
* Credit Notes Resource (direct user / dashboard)
|
|
3380
|
+
*
|
|
3381
|
+
* Note: Deletion is forbidden by NF525 fiscal compliance.
|
|
3382
|
+
*
|
|
3383
|
+
* @packageDocumentation
|
|
3384
|
+
*/
|
|
3385
|
+
|
|
3386
|
+
/**
|
|
3387
|
+
* Credit Notes API resource
|
|
3388
|
+
*
|
|
3389
|
+
* Manage credit notes for the authenticated dashboard user.
|
|
3390
|
+
*
|
|
3391
|
+
* @example
|
|
3392
|
+
* ```typescript
|
|
3393
|
+
* // List credit notes
|
|
3394
|
+
* const { data, meta } = await client.creditNotes.list({ per_page: 50 });
|
|
3395
|
+
*
|
|
3396
|
+
* // Create a credit note
|
|
3397
|
+
* const creditNote = await client.creditNotes.create({
|
|
3398
|
+
* invoice_id: 'invoice-uuid',
|
|
3399
|
+
* reason: 'Product returned',
|
|
3400
|
+
* items: [{ description: 'Item', quantity: 1, unit_price: 100, tax_rate: 20, total: 120 }]
|
|
3401
|
+
* });
|
|
3402
|
+
* ```
|
|
3403
|
+
*/
|
|
3404
|
+
declare class CreditNotesResource {
|
|
3405
|
+
private readonly http;
|
|
3406
|
+
constructor(http: HttpClient);
|
|
3407
|
+
/**
|
|
3408
|
+
* List credit notes with optional filtering
|
|
3409
|
+
*
|
|
3410
|
+
* @param options - Filter and pagination options
|
|
3411
|
+
* @param requestOptions - Request options
|
|
3412
|
+
* @returns Paginated list of credit notes
|
|
3413
|
+
*
|
|
3414
|
+
* @example
|
|
3415
|
+
* ```typescript
|
|
3416
|
+
* const { data, meta } = await client.creditNotes.list({ per_page: 50 });
|
|
3417
|
+
* console.log(`Found ${meta.total} credit notes`);
|
|
3418
|
+
* ```
|
|
3419
|
+
*/
|
|
3420
|
+
list(options?: CreditNoteListOptions, requestOptions?: RequestOptions): Promise<PaginatedResponse<CreditNote>>;
|
|
3421
|
+
/**
|
|
3422
|
+
* Get a specific credit note by ID
|
|
3423
|
+
*
|
|
3424
|
+
* @param id - Credit note UUID
|
|
3425
|
+
* @param requestOptions - Request options
|
|
3426
|
+
* @returns Credit note details
|
|
3427
|
+
*
|
|
3428
|
+
* @example
|
|
3429
|
+
* ```typescript
|
|
3430
|
+
* const { data: creditNote } = await client.creditNotes.get('credit-note-uuid');
|
|
3431
|
+
* console.log('Credit note number:', creditNote.number);
|
|
3432
|
+
* ```
|
|
3433
|
+
*/
|
|
3434
|
+
get(id: string, requestOptions?: RequestOptions): Promise<SingleResponse<CreditNote>>;
|
|
3435
|
+
/**
|
|
3436
|
+
* Create a new credit note
|
|
3437
|
+
*
|
|
3438
|
+
* @param input - Credit note creation data
|
|
3439
|
+
* @param requestOptions - Request options
|
|
3440
|
+
* @returns Created credit note
|
|
3441
|
+
*
|
|
3442
|
+
* @example
|
|
3443
|
+
* ```typescript
|
|
3444
|
+
* const { data: creditNote } = await client.creditNotes.create({
|
|
3445
|
+
* invoice_id: 'invoice-uuid',
|
|
3446
|
+
* reason: 'Product returned',
|
|
3447
|
+
* items: [
|
|
3448
|
+
* { description: 'Item A', quantity: 1, unit_price: 100, tax_rate: 20, total: 120 }
|
|
3449
|
+
* ]
|
|
3450
|
+
* });
|
|
3451
|
+
* ```
|
|
3452
|
+
*/
|
|
3453
|
+
create(input: CreateCreditNoteInput, requestOptions?: RequestOptions): Promise<SingleResponse<CreditNote>>;
|
|
3454
|
+
/**
|
|
3455
|
+
* Send a credit note
|
|
3456
|
+
*
|
|
3457
|
+
* @param id - Credit note UUID
|
|
3458
|
+
* @param requestOptions - Request options
|
|
3459
|
+
* @returns Success message
|
|
3460
|
+
*
|
|
3461
|
+
* @example
|
|
3462
|
+
* ```typescript
|
|
3463
|
+
* await client.creditNotes.send('credit-note-uuid');
|
|
3464
|
+
* ```
|
|
3465
|
+
*/
|
|
3466
|
+
send(id: string, requestOptions?: RequestOptions): Promise<MessageResponse>;
|
|
3467
|
+
/**
|
|
3468
|
+
* Download credit note as PDF
|
|
3469
|
+
*
|
|
3470
|
+
* @param id - Credit note UUID
|
|
3471
|
+
* @param requestOptions - Request options
|
|
3472
|
+
* @returns ArrayBuffer containing the PDF file
|
|
3473
|
+
*
|
|
3474
|
+
* @example
|
|
3475
|
+
* ```typescript
|
|
3476
|
+
* const pdfBuffer = await client.creditNotes.download('credit-note-uuid');
|
|
3477
|
+
*
|
|
3478
|
+
* // In Node.js, save to file:
|
|
3479
|
+
* import { writeFileSync } from 'fs';
|
|
3480
|
+
* writeFileSync('credit-note.pdf', Buffer.from(pdfBuffer));
|
|
3481
|
+
* ```
|
|
3482
|
+
*/
|
|
3483
|
+
download(id: string, requestOptions?: RequestOptions): Promise<ArrayBuffer>;
|
|
3484
|
+
/**
|
|
3485
|
+
* Get remaining creditable amount for an invoice
|
|
3486
|
+
*
|
|
3487
|
+
* @param invoiceId - Invoice UUID
|
|
3488
|
+
* @param requestOptions - Request options
|
|
3489
|
+
* @returns Remaining creditable information
|
|
3490
|
+
*
|
|
3491
|
+
* @example
|
|
3492
|
+
* ```typescript
|
|
3493
|
+
* const { data } = await client.creditNotes.remainingCreditable('invoice-uuid');
|
|
3494
|
+
* console.log('Remaining:', data);
|
|
3495
|
+
* ```
|
|
3496
|
+
*/
|
|
3497
|
+
remainingCreditable(invoiceId: string, requestOptions?: RequestOptions): Promise<SingleResponse<Record<string, unknown>>>;
|
|
3498
|
+
}
|
|
3499
|
+
|
|
3306
3500
|
/**
|
|
3307
3501
|
* Invoices Resource
|
|
3308
3502
|
*
|
|
@@ -3588,6 +3782,19 @@ declare class InvoicesResource {
|
|
|
3588
3782
|
* ```
|
|
3589
3783
|
*/
|
|
3590
3784
|
markPaid(id: string, data?: MarkPaidInput, requestOptions?: RequestOptions): Promise<SingleResponse<Invoice>>;
|
|
3785
|
+
/**
|
|
3786
|
+
* Submit an invoice for processing
|
|
3787
|
+
*
|
|
3788
|
+
* @param id - Invoice UUID
|
|
3789
|
+
* @param requestOptions - Request options
|
|
3790
|
+
* @returns Success message
|
|
3791
|
+
*
|
|
3792
|
+
* @example
|
|
3793
|
+
* ```typescript
|
|
3794
|
+
* await client.invoices.submit('invoice-uuid');
|
|
3795
|
+
* ```
|
|
3796
|
+
*/
|
|
3797
|
+
submit(id: string, requestOptions?: RequestOptions): Promise<MessageResponse>;
|
|
3591
3798
|
/**
|
|
3592
3799
|
* Download invoice source file as binary content
|
|
3593
3800
|
*
|
|
@@ -4569,6 +4776,8 @@ declare class ScellClient {
|
|
|
4569
4776
|
readonly invoices: InvoicesResource;
|
|
4570
4777
|
/** Signature listing (read-only via dashboard) */
|
|
4571
4778
|
readonly signatures: SignaturesResource;
|
|
4779
|
+
/** Credit notes management */
|
|
4780
|
+
readonly creditNotes: CreditNotesResource;
|
|
4572
4781
|
/**
|
|
4573
4782
|
* Create a new Scell Dashboard Client
|
|
4574
4783
|
*
|
|
@@ -4655,4 +4864,4 @@ declare class ScellApiClient {
|
|
|
4655
4864
|
constructor(apiKey: string, config?: ClientConfig);
|
|
4656
4865
|
}
|
|
4657
4866
|
|
|
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 };
|
|
4867
|
+
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 };
|