@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/dist/index.d.ts
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 };
|
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 {
|