@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.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.
|
|
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
|
*
|
|
@@ -3210,6 +3363,8 @@ var ScellClient = class {
|
|
|
3210
3363
|
invoices;
|
|
3211
3364
|
/** Signature listing (read-only via dashboard) */
|
|
3212
3365
|
signatures;
|
|
3366
|
+
/** Credit notes management */
|
|
3367
|
+
creditNotes;
|
|
3213
3368
|
/**
|
|
3214
3369
|
* Create a new Scell Dashboard Client
|
|
3215
3370
|
*
|
|
@@ -3234,6 +3389,7 @@ var ScellClient = class {
|
|
|
3234
3389
|
this.webhooks = new WebhooksResource(this.http);
|
|
3235
3390
|
this.invoices = new InvoicesResource(this.http);
|
|
3236
3391
|
this.signatures = new SignaturesResource(this.http);
|
|
3392
|
+
this.creditNotes = new CreditNotesResource(this.http);
|
|
3237
3393
|
}
|
|
3238
3394
|
};
|
|
3239
3395
|
var ScellApiClient = class {
|