@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 +92 -9
- package/dist/index.d.mts +186 -1
- package/dist/index.d.ts +186 -1
- 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/credit-notes.ts +57 -0
- package/src/types/index.ts +8 -0
package/dist/index.mjs
CHANGED
|
@@ -1573,7 +1573,7 @@ var FiscalResource = class {
|
|
|
1573
1573
|
return this.http.post("/tenant/fiscal/rules", input, requestOptions);
|
|
1574
1574
|
}
|
|
1575
1575
|
async updateRule(id, input, requestOptions) {
|
|
1576
|
-
return this.http.
|
|
1576
|
+
return this.http.put(`/tenant/fiscal/rules/${id}`, input, requestOptions);
|
|
1577
1577
|
}
|
|
1578
1578
|
async exportRules(options, requestOptions) {
|
|
1579
1579
|
return this.http.get("/tenant/fiscal/rules/export", options, requestOptions);
|
|
@@ -2273,6 +2273,140 @@ var CompaniesResource = class {
|
|
|
2273
2273
|
}
|
|
2274
2274
|
};
|
|
2275
2275
|
|
|
2276
|
+
// src/resources/credit-notes.ts
|
|
2277
|
+
var CreditNotesResource = class {
|
|
2278
|
+
constructor(http) {
|
|
2279
|
+
this.http = http;
|
|
2280
|
+
}
|
|
2281
|
+
/**
|
|
2282
|
+
* List credit notes with optional filtering
|
|
2283
|
+
*
|
|
2284
|
+
* @param options - Filter and pagination options
|
|
2285
|
+
* @param requestOptions - Request options
|
|
2286
|
+
* @returns Paginated list of credit notes
|
|
2287
|
+
*
|
|
2288
|
+
* @example
|
|
2289
|
+
* ```typescript
|
|
2290
|
+
* const { data, meta } = await client.creditNotes.list({ per_page: 50 });
|
|
2291
|
+
* console.log(`Found ${meta.total} credit notes`);
|
|
2292
|
+
* ```
|
|
2293
|
+
*/
|
|
2294
|
+
async list(options = {}, requestOptions) {
|
|
2295
|
+
return this.http.get(
|
|
2296
|
+
"/credit-notes",
|
|
2297
|
+
options,
|
|
2298
|
+
requestOptions
|
|
2299
|
+
);
|
|
2300
|
+
}
|
|
2301
|
+
/**
|
|
2302
|
+
* Get a specific credit note by ID
|
|
2303
|
+
*
|
|
2304
|
+
* @param id - Credit note UUID
|
|
2305
|
+
* @param requestOptions - Request options
|
|
2306
|
+
* @returns Credit note details
|
|
2307
|
+
*
|
|
2308
|
+
* @example
|
|
2309
|
+
* ```typescript
|
|
2310
|
+
* const { data: creditNote } = await client.creditNotes.get('credit-note-uuid');
|
|
2311
|
+
* console.log('Credit note number:', creditNote.number);
|
|
2312
|
+
* ```
|
|
2313
|
+
*/
|
|
2314
|
+
async get(id, requestOptions) {
|
|
2315
|
+
return this.http.get(
|
|
2316
|
+
`/credit-notes/${id}`,
|
|
2317
|
+
void 0,
|
|
2318
|
+
requestOptions
|
|
2319
|
+
);
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* Create a new credit note
|
|
2323
|
+
*
|
|
2324
|
+
* @param input - Credit note creation data
|
|
2325
|
+
* @param requestOptions - Request options
|
|
2326
|
+
* @returns Created credit note
|
|
2327
|
+
*
|
|
2328
|
+
* @example
|
|
2329
|
+
* ```typescript
|
|
2330
|
+
* const { data: creditNote } = await client.creditNotes.create({
|
|
2331
|
+
* invoice_id: 'invoice-uuid',
|
|
2332
|
+
* reason: 'Product returned',
|
|
2333
|
+
* items: [
|
|
2334
|
+
* { description: 'Item A', quantity: 1, unit_price: 100, tax_rate: 20, total: 120 }
|
|
2335
|
+
* ]
|
|
2336
|
+
* });
|
|
2337
|
+
* ```
|
|
2338
|
+
*/
|
|
2339
|
+
async create(input, requestOptions) {
|
|
2340
|
+
return this.http.post(
|
|
2341
|
+
"/credit-notes",
|
|
2342
|
+
input,
|
|
2343
|
+
requestOptions
|
|
2344
|
+
);
|
|
2345
|
+
}
|
|
2346
|
+
/**
|
|
2347
|
+
* Send a credit note
|
|
2348
|
+
*
|
|
2349
|
+
* @param id - Credit note UUID
|
|
2350
|
+
* @param requestOptions - Request options
|
|
2351
|
+
* @returns Success message
|
|
2352
|
+
*
|
|
2353
|
+
* @example
|
|
2354
|
+
* ```typescript
|
|
2355
|
+
* await client.creditNotes.send('credit-note-uuid');
|
|
2356
|
+
* ```
|
|
2357
|
+
*/
|
|
2358
|
+
async send(id, requestOptions) {
|
|
2359
|
+
return this.http.post(
|
|
2360
|
+
`/credit-notes/${id}/send`,
|
|
2361
|
+
void 0,
|
|
2362
|
+
requestOptions
|
|
2363
|
+
);
|
|
2364
|
+
}
|
|
2365
|
+
/**
|
|
2366
|
+
* Download credit note as PDF
|
|
2367
|
+
*
|
|
2368
|
+
* @param id - Credit note UUID
|
|
2369
|
+
* @param requestOptions - Request options
|
|
2370
|
+
* @returns ArrayBuffer containing the PDF file
|
|
2371
|
+
*
|
|
2372
|
+
* @example
|
|
2373
|
+
* ```typescript
|
|
2374
|
+
* const pdfBuffer = await client.creditNotes.download('credit-note-uuid');
|
|
2375
|
+
*
|
|
2376
|
+
* // In Node.js, save to file:
|
|
2377
|
+
* import { writeFileSync } from 'fs';
|
|
2378
|
+
* writeFileSync('credit-note.pdf', Buffer.from(pdfBuffer));
|
|
2379
|
+
* ```
|
|
2380
|
+
*/
|
|
2381
|
+
async download(id, requestOptions) {
|
|
2382
|
+
return this.http.getRaw(
|
|
2383
|
+
`/credit-notes/${id}/download`,
|
|
2384
|
+
void 0,
|
|
2385
|
+
requestOptions
|
|
2386
|
+
);
|
|
2387
|
+
}
|
|
2388
|
+
/**
|
|
2389
|
+
* Get remaining creditable amount for an invoice
|
|
2390
|
+
*
|
|
2391
|
+
* @param invoiceId - Invoice UUID
|
|
2392
|
+
* @param requestOptions - Request options
|
|
2393
|
+
* @returns Remaining creditable information
|
|
2394
|
+
*
|
|
2395
|
+
* @example
|
|
2396
|
+
* ```typescript
|
|
2397
|
+
* const { data } = await client.creditNotes.remainingCreditable('invoice-uuid');
|
|
2398
|
+
* console.log('Remaining:', data);
|
|
2399
|
+
* ```
|
|
2400
|
+
*/
|
|
2401
|
+
async remainingCreditable(invoiceId, requestOptions) {
|
|
2402
|
+
return this.http.get(
|
|
2403
|
+
`/invoices/${invoiceId}/remaining-creditable`,
|
|
2404
|
+
void 0,
|
|
2405
|
+
requestOptions
|
|
2406
|
+
);
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
|
|
2276
2410
|
// src/resources/invoices.ts
|
|
2277
2411
|
var InvoicesResource = class {
|
|
2278
2412
|
constructor(http) {
|
|
@@ -2588,6 +2722,25 @@ var InvoicesResource = class {
|
|
|
2588
2722
|
requestOptions
|
|
2589
2723
|
);
|
|
2590
2724
|
}
|
|
2725
|
+
/**
|
|
2726
|
+
* Submit an invoice for processing
|
|
2727
|
+
*
|
|
2728
|
+
* @param id - Invoice UUID
|
|
2729
|
+
* @param requestOptions - Request options
|
|
2730
|
+
* @returns Success message
|
|
2731
|
+
*
|
|
2732
|
+
* @example
|
|
2733
|
+
* ```typescript
|
|
2734
|
+
* await client.invoices.submit('invoice-uuid');
|
|
2735
|
+
* ```
|
|
2736
|
+
*/
|
|
2737
|
+
async submit(id, requestOptions) {
|
|
2738
|
+
return this.http.post(
|
|
2739
|
+
`/invoices/${id}/submit`,
|
|
2740
|
+
void 0,
|
|
2741
|
+
requestOptions
|
|
2742
|
+
);
|
|
2743
|
+
}
|
|
2591
2744
|
/**
|
|
2592
2745
|
* Download invoice source file as binary content
|
|
2593
2746
|
*
|
|
@@ -3208,6 +3361,8 @@ var ScellClient = class {
|
|
|
3208
3361
|
invoices;
|
|
3209
3362
|
/** Signature listing (read-only via dashboard) */
|
|
3210
3363
|
signatures;
|
|
3364
|
+
/** Credit notes management */
|
|
3365
|
+
creditNotes;
|
|
3211
3366
|
/**
|
|
3212
3367
|
* Create a new Scell Dashboard Client
|
|
3213
3368
|
*
|
|
@@ -3232,6 +3387,7 @@ var ScellClient = class {
|
|
|
3232
3387
|
this.webhooks = new WebhooksResource(this.http);
|
|
3233
3388
|
this.invoices = new InvoicesResource(this.http);
|
|
3234
3389
|
this.signatures = new SignaturesResource(this.http);
|
|
3390
|
+
this.creditNotes = new CreditNotesResource(this.http);
|
|
3235
3391
|
}
|
|
3236
3392
|
};
|
|
3237
3393
|
var ScellApiClient = class {
|