@smartbills/sdk 1.1.0-alpha.25 → 1.1.0-alpha.27

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.
@@ -1,5 +1,578 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
2
 
3
+ /**
4
+ * A receipt in the Smartbills system.
5
+ *
6
+ * Receipts are the core documents that track purchases, expenses, and transactions.
7
+ * They can be created manually, via OCR scanning, through email extraction, or
8
+ * from third-party integrations.
9
+ *
10
+ * @see {@link ReceiptCreateRequest} for creating a new receipt
11
+ * @see {@link ReceiptUpdateRequest} for updating an existing receipt
12
+ */
13
+ interface SBReceipt extends SBEntity, SBTimestamps {
14
+ type: ReceiptType;
15
+ source: ReceiptSource;
16
+ title?: string;
17
+ receiptNumber?: string;
18
+ currency?: string;
19
+ subTotal: number;
20
+ total: number;
21
+ totalDiscounts: number;
22
+ totalItems: number;
23
+ totalFees: number;
24
+ totalTaxes: number;
25
+ totalShipping: number;
26
+ totalTip: number;
27
+ date?: string;
28
+ cancelReason?: string;
29
+ originalReceiptUrl?: string;
30
+ barcode?: SBReceiptBarcode;
31
+ billingAddress?: SBBillingAddress;
32
+ business?: SBReceiptBusiness;
33
+ customer?: SBReceiptCustomer;
34
+ discounts?: SBReceiptDiscount[];
35
+ documents?: SBReceiptDocument[];
36
+ items?: SBReceiptLineItem[];
37
+ fees?: SBReceiptFee[];
38
+ payments?: SBReceiptPayment[];
39
+ refunds?: SBReceiptRefund[];
40
+ taxes?: SBReceiptTax[];
41
+ transactions?: SBReceiptTransaction[];
42
+ vendor?: SBReceiptVendor;
43
+ userId?: number;
44
+ businessId?: number;
45
+ checkoutStatus?: number;
46
+ }
47
+ /**
48
+ * A barcode associated with a receipt.
49
+ */
50
+ interface SBReceiptBarcode {
51
+ value: string;
52
+ format?: string;
53
+ }
54
+ /**
55
+ * The business information displayed on a receipt.
56
+ */
57
+ interface SBReceiptBusiness {
58
+ id?: number;
59
+ name?: string;
60
+ logo?: string;
61
+ address?: string;
62
+ }
63
+ /**
64
+ * Customer information associated with a receipt.
65
+ */
66
+ interface SBReceiptCustomer {
67
+ id?: number;
68
+ name?: string;
69
+ email?: string;
70
+ phone?: string;
71
+ }
72
+ /**
73
+ * A discount applied to a receipt.
74
+ */
75
+ interface SBReceiptDiscount {
76
+ name?: string;
77
+ amount: number;
78
+ percentage?: number;
79
+ }
80
+ /**
81
+ * A document attached to a receipt (e.g., PDF, image).
82
+ */
83
+ interface SBReceiptDocument {
84
+ id?: number;
85
+ name: string;
86
+ url?: string;
87
+ mimeType?: string;
88
+ createdAt?: string;
89
+ }
90
+ /**
91
+ * An individual line item on a receipt.
92
+ */
93
+ interface SBReceiptLineItem extends SBEntity {
94
+ name: string;
95
+ description?: string;
96
+ quantity: number;
97
+ unitPrice: number;
98
+ total: number;
99
+ sku?: string;
100
+ category?: string;
101
+ taxes?: SBReceiptTax[];
102
+ discounts?: SBReceiptDiscount[];
103
+ }
104
+ /**
105
+ * A fee applied to a receipt (e.g., service charge, delivery fee).
106
+ */
107
+ interface SBReceiptFee {
108
+ name: string;
109
+ amount: number;
110
+ }
111
+ /**
112
+ * A payment recorded against a receipt.
113
+ */
114
+ interface SBReceiptPayment extends SBEntity {
115
+ type: ReceiptPaymentType;
116
+ status: ReceiptPaymentStatus;
117
+ amount: number;
118
+ tip?: number;
119
+ billingAddress?: SBBillingAddress;
120
+ card?: SBReceiptPaymentCard;
121
+ statementDescriptor?: string;
122
+ receiptNumber?: string;
123
+ receiptUrl?: string;
124
+ }
125
+ /**
126
+ * Credit or debit card details for a receipt payment.
127
+ */
128
+ interface SBReceiptPaymentCard {
129
+ brand?: string;
130
+ last4?: string;
131
+ expirationMonth?: number;
132
+ expirationYear?: number;
133
+ }
134
+ /**
135
+ * A refund issued against a receipt.
136
+ */
137
+ interface SBReceiptRefund extends SBEntity {
138
+ note?: string;
139
+ processedAt?: string;
140
+ amount?: SBMoney;
141
+ }
142
+ /**
143
+ * A tax line on a receipt.
144
+ */
145
+ interface SBReceiptTax {
146
+ name: string;
147
+ amount: number;
148
+ rate?: number;
149
+ taxNumber?: string;
150
+ }
151
+ /**
152
+ * A transaction linked to a receipt.
153
+ */
154
+ interface SBReceiptTransaction extends SBEntity {
155
+ amount: number;
156
+ currency?: string;
157
+ date?: string;
158
+ }
159
+ /**
160
+ * Vendor (merchant) information displayed on a receipt.
161
+ */
162
+ interface SBReceiptVendor {
163
+ id?: number;
164
+ name?: string;
165
+ logo?: string;
166
+ }
167
+ /**
168
+ * Request payload for creating a new receipt.
169
+ */
170
+ interface ReceiptCreateRequest {
171
+ title?: string;
172
+ receiptNumber?: string;
173
+ currency?: string;
174
+ date?: string;
175
+ subTotal?: number;
176
+ total?: number;
177
+ items?: Omit<SBReceiptLineItem, "id">[];
178
+ taxes?: SBReceiptTax[];
179
+ fees?: SBReceiptFee[];
180
+ discounts?: SBReceiptDiscount[];
181
+ payments?: Omit<SBReceiptPayment, "id">[];
182
+ }
183
+ /**
184
+ * Request payload for updating an existing receipt.
185
+ */
186
+ interface ReceiptUpdateRequest extends ReceiptCreateRequest {
187
+ id: number;
188
+ }
189
+ /**
190
+ * Request parameters for listing receipts with filters and pagination.
191
+ */
192
+ interface ReceiptListRequest {
193
+ page?: number;
194
+ limit?: number;
195
+ search?: string;
196
+ sortBy?: string;
197
+ sortDirection?: "asc" | "desc";
198
+ startDate?: string;
199
+ endDate?: string;
200
+ vendorId?: number;
201
+ businessId?: number;
202
+ }
203
+ /**
204
+ * Request payload for creating a receipt from an OCR-scanned image.
205
+ */
206
+ interface ReceiptOCRCreateRequest {
207
+ file: File | Blob;
208
+ businessId?: number;
209
+ }
210
+
211
+ /**
212
+ * Lifecycle status from the issuer's perspective (AR side). Set by the merchant
213
+ * who issued the invoice. Stripe-aligned. Distinct from {@link SBBillStatus} —
214
+ * when both businesses are on the platform, both fields exist on the same
215
+ * underlying row and evolve independently.
216
+ */
217
+ declare enum SBInvoiceStatus {
218
+ DRAFT = "Draft",
219
+ OPEN = "Open",
220
+ PAID = "Paid",
221
+ VOID = "Void",
222
+ UNCOLLECTIBLE = "Uncollectible"
223
+ }
224
+ /**
225
+ * Lifecycle status from the recipient's perspective (AP side — accounts payable).
226
+ * Captures the recipient's internal approval workflow → scheduling → payment
227
+ * execution. Distinct from {@link SBInvoiceStatus}; both can coexist on the same row.
228
+ */
229
+ declare enum SBBillStatus {
230
+ DRAFT = "Draft",
231
+ PENDING_APPROVAL = "PendingApproval",
232
+ APPROVED = "Approved",
233
+ READY_FOR_PAYMENT = "ReadyForPayment",
234
+ SCHEDULED = "Scheduled",
235
+ PROCESSING = "Processing",
236
+ PAYMENT_FAILED = "PaymentFailed",
237
+ DENIED = "Denied",
238
+ PAID = "Paid",
239
+ VOID = "Void"
240
+ }
241
+ /**
242
+ * Payment state — shared between issuer and recipient. Money is objective: when
243
+ * payment is received, both sides see the same value. Orthogonal to
244
+ * {@link SBInvoiceStatus} and {@link SBBillStatus}.
245
+ */
246
+ declare enum SBPaymentStatus {
247
+ UNPAID = "Unpaid",
248
+ PARTIALLY_PAID = "PartiallyPaid",
249
+ PAID = "Paid",
250
+ PARTIALLY_REFUNDED = "PartiallyRefunded",
251
+ REFUNDED = "Refunded"
252
+ }
253
+ declare enum PaymentTerms {
254
+ UPON_RECEIPT = "UponReceipt",
255
+ NET_7 = "Net7",
256
+ NET_15 = "Net15",
257
+ NET_30 = "Net30",
258
+ NET_45 = "Net45",
259
+ NET_60 = "Net60",
260
+ NET_90 = "Net90",
261
+ CUSTOM = "Custom"
262
+ }
263
+ /**
264
+ * Customer projection embedded on an invoice. Carries the billing/shipping address
265
+ * for the invoice — addresses live under the customer rather than at the top level
266
+ * because the customer is who's billed/shipped to.
267
+ */
268
+ interface SBInvoiceCustomer {
269
+ id?: number;
270
+ firstName?: string;
271
+ lastName?: string;
272
+ email?: string;
273
+ phoneNumber?: string;
274
+ company?: string;
275
+ billingAddress?: SBAddress;
276
+ shippingAddress?: SBAddress;
277
+ }
278
+ interface SBInvoiceMerchant {
279
+ businessId?: number;
280
+ name?: string;
281
+ logo?: string;
282
+ email?: string;
283
+ phoneNumber?: string;
284
+ website?: string;
285
+ address?: SBAddress;
286
+ }
287
+ interface SBInvoiceEmployee {
288
+ id?: number;
289
+ firstName?: string;
290
+ lastName?: string;
291
+ name?: string;
292
+ email?: string;
293
+ avatar?: string;
294
+ }
295
+ interface SBInvoiceLineItemTax {
296
+ id?: number;
297
+ name?: string;
298
+ rate?: number;
299
+ amount?: SBMoney;
300
+ taxId?: number;
301
+ }
302
+ interface SBInvoiceLineItem {
303
+ id?: number;
304
+ description?: string;
305
+ quantity?: number;
306
+ unitPrice?: number;
307
+ price?: SBMoney;
308
+ subTotal?: SBMoney;
309
+ total?: SBMoney;
310
+ amount?: number;
311
+ productId?: number;
312
+ product?: {
313
+ id?: number;
314
+ name?: string;
315
+ sku?: string;
316
+ };
317
+ taxable?: boolean;
318
+ taxIds?: number[];
319
+ taxes?: SBInvoiceLineItemTax[];
320
+ }
321
+ interface SBInvoiceRecurring {
322
+ isRecurring: boolean;
323
+ interval?: string;
324
+ intervalCount: number;
325
+ startDate?: string;
326
+ endDate?: string;
327
+ nextScheduledDate?: string;
328
+ lastGeneratedDate?: string;
329
+ maxOccurrences?: number;
330
+ occurrenceCount: number;
331
+ isPaused: boolean;
332
+ parentInvoiceId?: number;
333
+ }
334
+ interface SBInvoiceStripeLinks {
335
+ paymentIntentId?: string;
336
+ shortCode?: string;
337
+ paymentLinkUrl?: string;
338
+ checkoutUrl?: string;
339
+ }
340
+ interface SBPaymentMethodCardInfo {
341
+ last4?: string;
342
+ brand?: string;
343
+ bin?: string;
344
+ countryCode?: string;
345
+ fingerprint?: string;
346
+ expirationMonth?: number;
347
+ expirationYear?: number;
348
+ }
349
+ interface SBPaymentMethodBankAccountInfo {
350
+ last4?: string;
351
+ bankName?: string;
352
+ accountType?: string;
353
+ }
354
+ interface SBPaymentMethodInfo {
355
+ type?: string;
356
+ card?: SBPaymentMethodCardInfo;
357
+ bankAccount?: SBPaymentMethodBankAccountInfo;
358
+ }
359
+ /**
360
+ * Authenticated invoice projection. Totals and lifecycle dates are flat on the root
361
+ * (matches the .NET <c>SBInvoiceResponse</c> shape).
362
+ */
363
+ interface SBInvoice extends SBEntity, SBTimestamps {
364
+ invoiceNumber?: string;
365
+ /** Generic transaction-level status (Pending/Posted/etc.) — distinct from {@link status}. */
366
+ transactionStatus?: string;
367
+ /** Document lifecycle status (Draft/Open/Paid/Void/...). */
368
+ invoiceStatus?: SBInvoiceStatus;
369
+ /** Payment state (Unpaid/Partial/Paid/Refunded). Orthogonal to {@link status}. */
370
+ paymentStatus?: SBPaymentStatus;
371
+ isOverdue?: boolean;
372
+ isPaid?: boolean;
373
+ currency?: string;
374
+ merchant?: SBInvoiceMerchant;
375
+ customer?: SBInvoiceCustomer;
376
+ employee?: SBInvoiceEmployee;
377
+ lineItems?: SBInvoiceLineItem[];
378
+ lineItemGroups?: unknown[];
379
+ taxes?: SBInvoiceLineItemTax[];
380
+ discounts?: unknown[];
381
+ fees?: unknown[];
382
+ subTotal?: SBMoney;
383
+ totalTaxes?: SBMoney;
384
+ totalDiscounts?: SBMoney;
385
+ totalFees?: SBMoney;
386
+ total?: SBMoney;
387
+ amountPaid?: SBMoney;
388
+ amountDue?: SBMoney;
389
+ balanceForward?: SBMoney;
390
+ amountOverpaid?: SBMoney;
391
+ date?: string;
392
+ dueDate?: string;
393
+ paymentTerms?: string;
394
+ sentAt?: string;
395
+ viewedAt?: string;
396
+ paidAt?: string;
397
+ voidedAt?: string;
398
+ billingPeriodStartDate?: string;
399
+ billingPeriodEndDate?: string;
400
+ autoPaymentDate?: string;
401
+ payments?: SBReceiptPayment[];
402
+ recurring?: SBInvoiceRecurring | null;
403
+ stripe?: SBInvoiceStripeLinks;
404
+ reminders?: InvoiceReminder[];
405
+ }
406
+ interface InvoiceListRequest extends PaginationRequest {
407
+ invoiceStatus?: SBInvoiceStatus;
408
+ paymentStatus?: SBPaymentStatus;
409
+ customerId?: number;
410
+ customerName?: string;
411
+ invoiceNumber?: string;
412
+ fromIssueDate?: string;
413
+ toIssueDate?: string;
414
+ fromDueDate?: string;
415
+ toDueDate?: string;
416
+ minAmount?: number;
417
+ maxAmount?: number;
418
+ isOverdue?: boolean;
419
+ isPaid?: boolean;
420
+ isRecurring?: boolean;
421
+ search?: string;
422
+ }
423
+ declare enum InvoiceReminderFrequency {
424
+ ONCE = "ONCE",
425
+ WEEKLY = "WEEKLY",
426
+ BIWEEKLY = "BIWEEKLY",
427
+ MONTHLY = "MONTHLY"
428
+ }
429
+ declare enum InvoiceReminderTiming {
430
+ BEFORE_DUE = "BEFORE_DUE",
431
+ ON_DUE = "ON_DUE",
432
+ AFTER_DUE = "AFTER_DUE"
433
+ }
434
+ interface InvoiceReminder {
435
+ id?: number;
436
+ enabled: boolean;
437
+ timing: InvoiceReminderTiming;
438
+ daysOffset: number;
439
+ frequency: InvoiceReminderFrequency;
440
+ maxReminders: number;
441
+ message?: string;
442
+ }
443
+ interface InvoiceFeeCreateRequest {
444
+ feeId?: number;
445
+ name?: string;
446
+ amount?: number;
447
+ percentage?: number;
448
+ type?: "FIXED" | "PERCENTAGE";
449
+ }
450
+ interface InvoiceDiscountCreateRequest {
451
+ promoCodeId?: number;
452
+ name?: string;
453
+ amount?: number;
454
+ percentage?: number;
455
+ type?: "FIXED" | "PERCENTAGE";
456
+ }
457
+ interface InvoiceCreateRequest {
458
+ invoiceNumber?: string;
459
+ date?: string;
460
+ dueDate?: string;
461
+ paymentTerms?: PaymentTerms;
462
+ billingPeriodStartDate?: string;
463
+ billingPeriodEndDate?: string;
464
+ autoPaymentDate?: string;
465
+ amountDue?: SBMoney;
466
+ balanceForward?: SBMoney;
467
+ paymentLinkUrl?: string;
468
+ customerId?: number;
469
+ vendorId?: number;
470
+ employeeId?: number;
471
+ currency?: string;
472
+ note?: string;
473
+ lineItems?: Omit<SBInvoiceLineItem, "id" | "product" | "taxes" | "price" | "subTotal" | "total">[];
474
+ fees?: InvoiceFeeCreateRequest[];
475
+ discounts?: InvoiceDiscountCreateRequest[];
476
+ billingAddress?: SBAddress;
477
+ shippingAddress?: SBAddress;
478
+ reminders?: InvoiceReminder[];
479
+ }
480
+ type InvoiceUpdateRequest = Partial<InvoiceCreateRequest>;
481
+ interface NextInvoiceNumberResponse {
482
+ invoiceNumber: string;
483
+ prefix: string;
484
+ sequenceNumber: number;
485
+ }
486
+ interface InvoiceSummary {
487
+ totalRevenue: number;
488
+ outstanding: number;
489
+ overdueCount: number;
490
+ paidThisMonth: number;
491
+ totalCount: number;
492
+ draftCount: number;
493
+ sentCount: number;
494
+ paidCount: number;
495
+ }
496
+ interface PublicInvoiceMerchantSocial {
497
+ facebook?: string;
498
+ instagram?: string;
499
+ linkedIn?: string;
500
+ tikTok?: string;
501
+ twitter?: string;
502
+ youTube?: string;
503
+ }
504
+ interface PublicInvoiceMerchant {
505
+ businessId?: number;
506
+ name?: string;
507
+ logo?: string;
508
+ website?: string;
509
+ email?: string;
510
+ phoneNumber?: string;
511
+ address?: SBAddress;
512
+ social?: PublicInvoiceMerchantSocial;
513
+ }
514
+ interface PublicInvoiceCustomer {
515
+ firstName?: string;
516
+ lastName?: string;
517
+ company?: string;
518
+ email?: string;
519
+ billingAddress?: SBAddress;
520
+ shippingAddress?: SBAddress;
521
+ }
522
+ interface PublicInvoiceLineItem {
523
+ name?: string;
524
+ description?: string;
525
+ quantity?: number;
526
+ unitPrice?: SBMoney;
527
+ total?: SBMoney;
528
+ }
529
+ interface PublicInvoicePaymentCardSnippet {
530
+ brand?: string;
531
+ last4?: string;
532
+ }
533
+ interface PublicInvoicePayment {
534
+ /**
535
+ * Payment id. Used by the renderer to resolve a specific payment for
536
+ * receipt URLs (e.g. `/i/{shortCode}?receipt=1&paymentId={id}`).
537
+ */
538
+ id: number;
539
+ amount?: SBMoney;
540
+ paidAt?: string;
541
+ method?: string;
542
+ card?: PublicInvoicePaymentCardSnippet;
543
+ }
544
+ interface PublicInvoiceMerchantRating {
545
+ average: number;
546
+ count: number;
547
+ breakdown: Record<number, number>;
548
+ }
549
+ /**
550
+ * Public-payment-page projection. The public DTO is intentionally status-free; the
551
+ * only state surfaced is {@link isOverdue}.
552
+ */
553
+ interface PublicInvoiceResponse {
554
+ id: number;
555
+ invoiceNumber?: string;
556
+ currency?: string;
557
+ isOverdue?: boolean;
558
+ merchant?: PublicInvoiceMerchant;
559
+ customer?: PublicInvoiceCustomer;
560
+ lineItems?: PublicInvoiceLineItem[];
561
+ subTotal?: SBMoney;
562
+ totalTaxes?: SBMoney;
563
+ totalDiscounts?: SBMoney;
564
+ totalFees?: SBMoney;
565
+ total?: SBMoney;
566
+ amountPaid?: SBMoney;
567
+ amountDue?: SBMoney;
568
+ issuedAt?: string;
569
+ dueDate?: string;
570
+ shortCode?: string;
571
+ checkoutUrl?: string;
572
+ payments?: PublicInvoicePayment[];
573
+ merchantRating?: PublicInvoiceMerchantRating;
574
+ }
575
+
3
576
  /**
4
577
  * The type classification of a transaction.
5
578
  *
@@ -167,29 +740,7 @@ declare enum BillApprovalType {
167
740
  /** Direct manager approval is required */
168
741
  MANAGER = "MANAGER"
169
742
  }
170
- /**
171
- * The current status of a bill in its lifecycle.
172
- *
173
- * Bills progress through these states from creation to payment.
174
- */
175
- declare enum BillStatus {
176
- /** Bill is being drafted and has not been submitted */
177
- DRAFT = "DRAFT",
178
- /** Bill is awaiting approval from designated approvers */
179
- PENDING_APPROVAL = "PENDING_APPROVAL",
180
- /** Bill has been approved and is ready for payment */
181
- APPROVED = "APPROVED",
182
- /** Bill payment has been scheduled for a future date */
183
- SCHEDULED = "SCHEDULED",
184
- /** Bill has been fully paid */
185
- PAID = "PAID",
186
- /** Bill has been cancelled */
187
- CANCELLED = "CANCELLED",
188
- /** Bill is past the due date and unpaid */
189
- OVERDUE = "OVERDUE",
190
- /** Automated payment attempt failed */
191
- PAYMENT_FAILED = "PAYMENT_FAILED"
192
- }
743
+
193
744
  /**
194
745
  * The role of a user within a business organization.
195
746
  *
@@ -1446,6 +1997,39 @@ interface SBBillingPlan {
1446
1997
  interface UpgradeSubscriptionRequest {
1447
1998
  planId: string;
1448
1999
  }
2000
+ /** Request payload for previewing a plan change before committing. */
2001
+ interface PreviewPlanChangeRequest {
2002
+ planId: string;
2003
+ }
2004
+ /** One line of a preview invoice (proration credit/charge or recurring line). */
2005
+ interface SBPlanChangePreviewLineItem {
2006
+ description: string | null;
2007
+ amount: number;
2008
+ currency: string | null;
2009
+ proration: boolean;
2010
+ periodStart: string | null;
2011
+ periodEnd: string | null;
2012
+ }
2013
+ /** Preview of charges and timing for a proposed plan change. */
2014
+ interface SBPlanChangePreview {
2015
+ success: boolean;
2016
+ message: string | null;
2017
+ /** False when the change must go through a new checkout session (no in-place preview possible). */
2018
+ canPreview: boolean;
2019
+ currentPlanKey: string | null;
2020
+ targetPlanKey: string | null;
2021
+ /** "upgrade" | "downgrade" | "same". */
2022
+ changeType: string | null;
2023
+ currency: string | null;
2024
+ prorationTotal: number;
2025
+ nextInvoiceTotal: number;
2026
+ lines: SBPlanChangePreviewLineItem[];
2027
+ nextInvoiceDate: string | null;
2028
+ trialEnd: string | null;
2029
+ isTrialing: boolean;
2030
+ /** True when the change takes effect at period end (no immediate charge). */
2031
+ effectiveAtPeriodEnd: boolean;
2032
+ }
1449
2033
  /** Request payload for creating a Stripe billing portal session. */
1450
2034
  interface CreatePortalSessionRequest {
1451
2035
  returnUrl?: string;
@@ -1497,6 +2081,8 @@ declare class BillingService extends BaseService {
1497
2081
  getSubscription(options?: RequestOptions): Promise<SBSubscription>;
1498
2082
  /** Upgrades the business subscription to a new plan. */
1499
2083
  upgradeSubscription(data: UpgradeSubscriptionRequest, options?: RequestOptions): Promise<SBSubscription>;
2084
+ /** Previews the prorated charge and timing for a proposed plan change before the user commits. */
2085
+ previewPlanChange(data: PreviewPlanChangeRequest, options?: RequestOptions): Promise<SBPlanChangePreview>;
1500
2086
  /** Cancels the current business subscription. */
1501
2087
  cancelSubscription(options?: RequestOptions): Promise<SBSubscription>;
1502
2088
  /** Retrieves all available billing plans. */
@@ -1532,41 +2118,82 @@ declare class BillingService extends BaseService {
1532
2118
  }
1533
2119
 
1534
2120
  /**
1535
- * A bill (accounts payable) in the Smartbills system.
2121
+ * AP (vendor bill) entity. Distinct from {@link SBInvoice} (AR) they share the same
2122
+ * backend table but the wire-format projections are intentionally separate so each can
2123
+ * evolve independently without cross-contamination.
1536
2124
  *
1537
- * Bills represent money owed to vendors. They support a full lifecycle
1538
- * from draft creation through approval, scheduling, and payment.
1539
- *
1540
- * @see {@link BillCreateRequest} for creating a new bill
1541
- * @see {@link BillUpdateRequest} for updating an existing bill
2125
+ * Bills carry the approval workflow (PendingApproval/Approved/Scheduled/...), vendor
2126
+ * info, and payment-execution details. Customer-facing concerns (Stripe links, recurring,
2127
+ * sent/viewed engagement) belong on {@link SBInvoice}.
1542
2128
  */
1543
2129
  interface SBBill extends SBEntity, SBTimestamps {
1544
- title?: string;
2130
+ businessId?: number;
1545
2131
  billNumber?: string;
1546
- referenceNumber?: string;
1547
- vendorId?: number;
1548
- vendorName?: string;
2132
+ /** Lifecycle status — shared enum with invoices. */
2133
+ status: SBBillStatus;
2134
+ /** Payment state — shared enum with invoices. */
2135
+ paymentStatus?: SBPaymentStatus;
2136
+ isOverdue?: boolean;
2137
+ isPaid?: boolean;
1549
2138
  currency?: string;
1550
- subTotal: number;
1551
- total: number;
1552
- totalTaxes: number;
1553
- dueDate?: string;
1554
- issueDate?: string;
1555
- paidDate?: string;
1556
- status: BillStatus;
1557
- approvalStatus?: BillApprovalStatus;
1558
- note?: string;
1559
- categoryId?: number;
1560
- categoryName?: string;
1561
- businessId: number;
1562
- items?: SBBillLineItem[];
2139
+ vendor?: SBBillVendor;
2140
+ vendorAccount?: SBBillVendorAccount;
2141
+ employee?: SBBillEmployee;
2142
+ lineItems?: SBBillLineItem[];
1563
2143
  taxes?: SBBillTax[];
1564
- attachments?: SBBillAttachment[];
2144
+ discounts?: unknown[];
2145
+ fees?: unknown[];
2146
+ subTotal?: SBMoney;
2147
+ totalTaxes?: SBMoney;
2148
+ totalDiscounts?: SBMoney;
2149
+ totalFees?: SBMoney;
2150
+ total?: SBMoney;
2151
+ amountPaid?: SBMoney;
2152
+ amountDue?: SBMoney;
2153
+ date?: string;
2154
+ dueDate?: string;
2155
+ paidAt?: string;
2156
+ voidedAt?: string;
2157
+ submittedForApprovalAt?: string;
2158
+ submittedByEmployee?: SBBillEmployee;
2159
+ fullyApprovedAt?: string;
2160
+ deniedAt?: string;
2161
+ denialReason?: string;
1565
2162
  approvals?: SBBillApproval[];
2163
+ scheduledPaymentDate?: string;
2164
+ scheduledPaymentMethod?: string;
2165
+ paymentInitiatedAt?: string;
2166
+ paymentCompletedAt?: string;
2167
+ paymentReference?: string;
2168
+ paymentMethod?: string;
2169
+ paymentFailureReason?: string;
2170
+ markedPaidAt?: string;
2171
+ markedPaidByEmployee?: SBBillEmployee;
2172
+ voidReason?: string;
2173
+ statusHistory?: SBBillStatusHistoryItem[];
2174
+ payments?: SBReceiptPayment[];
2175
+ attachments?: SBBillAttachment[];
2176
+ }
2177
+ interface SBBillVendor {
2178
+ id?: number;
2179
+ name?: string;
2180
+ logo?: string;
2181
+ email?: string;
2182
+ phoneNumber?: string;
2183
+ website?: string;
2184
+ }
2185
+ interface SBBillVendorAccount {
2186
+ id?: number;
2187
+ accountNumber?: string;
2188
+ accountId?: string;
2189
+ }
2190
+ interface SBBillEmployee {
2191
+ id?: number;
2192
+ firstName?: string;
2193
+ lastName?: string;
2194
+ name?: string;
2195
+ email?: string;
1566
2196
  }
1567
- /**
1568
- * An individual line item on a bill.
1569
- */
1570
2197
  interface SBBillLineItem extends SBEntity {
1571
2198
  description?: string;
1572
2199
  quantity: number;
@@ -1574,70 +2201,64 @@ interface SBBillLineItem extends SBEntity {
1574
2201
  total: number;
1575
2202
  categoryId?: number;
1576
2203
  }
1577
- /**
1578
- * A tax line on a bill.
1579
- */
1580
2204
  interface SBBillTax {
1581
2205
  name: string;
1582
2206
  amount: number;
1583
2207
  rate?: number;
1584
2208
  }
1585
- /**
1586
- * A file attachment associated with a bill (e.g., invoice PDF, supporting documents).
1587
- */
1588
2209
  interface SBBillAttachment extends SBEntity {
1589
2210
  name: string;
1590
2211
  url: string;
1591
2212
  mimeType?: string;
1592
2213
  size?: number;
1593
2214
  }
1594
- /**
1595
- * An approval record for a bill, representing one approver's decision.
1596
- */
1597
2215
  interface SBBillApproval extends SBEntity {
1598
- approverId: number;
2216
+ approverId?: number;
1599
2217
  approverName?: string;
1600
2218
  status: BillApprovalStatus;
1601
2219
  comment?: string;
1602
2220
  respondedAt?: string;
1603
2221
  }
2222
+ /**
2223
+ * Single entry in the bill's Status transition history.
2224
+ */
2225
+ interface SBBillStatusHistoryItem {
2226
+ fromStatus: SBBillStatus;
2227
+ toStatus: SBBillStatus;
2228
+ comment?: string;
2229
+ createdAt: string;
2230
+ }
1604
2231
  /**
1605
2232
  * Aggregated counts of bills by status for dashboard summaries.
1606
2233
  */
1607
2234
  interface SBBillStatusSummary {
1608
- draft: number;
1609
- pendingApproval: number;
1610
- approved: number;
1611
- scheduled: number;
1612
- paid: number;
1613
- overdue: number;
1614
- cancelled: number;
1615
- total: number;
2235
+ draftCount: number;
2236
+ pendingApprovalCount: number;
2237
+ readyForPaymentCount: number;
2238
+ scheduledCount: number;
2239
+ overdueCount: number;
2240
+ paidCount: number;
2241
+ totalPendingAmount: number;
2242
+ totalOverdueAmount: number;
2243
+ currency?: string;
1616
2244
  }
1617
2245
  /**
1618
- * A single entry in the bill approval history audit trail.
2246
+ * @deprecated Use {@link SBBillStatusHistoryItem}. Kept as an alias during migration.
1619
2247
  */
1620
- interface SBBillApprovalHistoryItem {
1621
- action: string;
1622
- performedBy: string;
1623
- performedAt: string;
1624
- comment?: string;
1625
- }
2248
+ type SBBillApprovalHistoryItem = SBBillStatusHistoryItem;
1626
2249
  /**
1627
2250
  * Request parameters for listing bills with filters and pagination.
1628
2251
  */
1629
2252
  interface BillListRequest extends PaginationRequest {
1630
2253
  search?: string;
1631
- status?: BillStatus;
2254
+ status?: SBBillStatus;
2255
+ paymentStatus?: SBPaymentStatus;
1632
2256
  vendorId?: number;
1633
2257
  startDate?: string;
1634
2258
  endDate?: string;
1635
2259
  minAmount?: number;
1636
2260
  maxAmount?: number;
1637
2261
  }
1638
- /**
1639
- * Request payload for creating a new bill.
1640
- */
1641
2262
  interface BillCreateRequest {
1642
2263
  title?: string;
1643
2264
  billNumber?: string;
@@ -1654,15 +2275,9 @@ interface BillCreateRequest {
1654
2275
  items?: Omit<SBBillLineItem, "id">[];
1655
2276
  taxes?: SBBillTax[];
1656
2277
  }
1657
- /**
1658
- * Request payload for updating an existing bill.
1659
- */
1660
2278
  interface BillUpdateRequest extends BillCreateRequest {
1661
2279
  id?: number;
1662
2280
  }
1663
- /**
1664
- * Request payload for batch-updating multiple bills.
1665
- */
1666
2281
  interface BillBatchUpdateRequest {
1667
2282
  id: number;
1668
2283
  title?: string;
@@ -1670,123 +2285,69 @@ interface BillBatchUpdateRequest {
1670
2285
  categoryId?: number;
1671
2286
  dueDate?: string;
1672
2287
  }
1673
- /**
1674
- * Base request for bill status transitions.
1675
- */
1676
2288
  interface BillTransitionRequest {
1677
2289
  comment?: string;
1678
2290
  }
1679
- /**
1680
- * Request payload for submitting a bill for approval.
1681
- */
1682
2291
  interface BillSubmitForApprovalRequest extends BillTransitionRequest {
1683
2292
  }
1684
- /**
1685
- * Request payload for approving a bill.
1686
- */
1687
2293
  interface BillApprovalRequest extends BillTransitionRequest {
2294
+ approved?: boolean;
2295
+ denialReason?: string;
1688
2296
  }
1689
- /**
1690
- * Request payload for scheduling a bill payment.
1691
- */
1692
2297
  interface BillSchedulePaymentRequest extends BillTransitionRequest {
1693
2298
  scheduledDate: string;
1694
2299
  paymentMethodId?: string;
1695
2300
  }
1696
- /**
1697
- * Request payload for marking a bill as paid.
1698
- */
1699
2301
  interface BillMarkPaidRequest extends BillTransitionRequest {
1700
2302
  paidDate?: string;
1701
2303
  paymentReference?: string;
1702
2304
  }
1703
- /**
1704
- * Request payload for cancelling a bill.
1705
- */
1706
2305
  interface BillCancelRequest extends BillTransitionRequest {
1707
2306
  reason?: string;
2307
+ cancelReason?: string;
1708
2308
  }
1709
- /**
1710
- * Request payload for rescheduling a bill payment.
1711
- */
1712
2309
  interface BillReschedulePaymentRequest extends BillTransitionRequest {
1713
2310
  scheduledDate: string;
1714
2311
  }
1715
- /**
1716
- * Request payload for retrying a failed bill payment.
1717
- */
1718
2312
  interface BillRetryPaymentRequest extends BillTransitionRequest {
1719
2313
  }
1720
- /**
1721
- * Response returned after a bill status transition.
1722
- */
1723
2314
  interface SBBillTransitionResponse {
1724
2315
  bill: SBBill;
1725
2316
  success: boolean;
1726
2317
  message?: string;
1727
2318
  }
1728
- /**
1729
- * Request payload for bulk-approving multiple bills.
1730
- */
1731
2319
  interface BulkBillApproveRequest {
1732
2320
  billIds: number[];
1733
2321
  comment?: string;
1734
2322
  }
1735
- /**
1736
- * Request payload for bulk-marking multiple bills as paid.
1737
- */
1738
2323
  interface BulkBillMarkPaidRequest {
1739
2324
  billIds: number[];
1740
2325
  paidDate?: string;
1741
2326
  paymentReference?: string;
1742
2327
  }
1743
- /**
1744
- * Request payload for bulk-scheduling payments for multiple bills.
1745
- */
1746
2328
  interface BulkBillSchedulePaymentRequest {
1747
2329
  billIds: number[];
1748
2330
  scheduledDate: string;
1749
2331
  }
1750
- /**
1751
- * Request payload for bulk-unscheduling payments for multiple bills.
1752
- */
1753
2332
  interface BulkBillUnscheduleRequest {
1754
2333
  billIds: number[];
1755
2334
  }
1756
- /**
1757
- * Request payload for bulk-cancelling payments for multiple bills.
1758
- */
1759
2335
  interface BulkBillCancelPaymentRequest {
1760
2336
  billIds: number[];
1761
2337
  reason?: string;
1762
2338
  }
1763
- /**
1764
- * Request payload for bulk-deleting multiple bills.
1765
- */
1766
2339
  interface BulkBillDeleteRequest {
1767
2340
  billIds: number[];
1768
2341
  }
1769
- /**
1770
- * Request payload for bulk-retrying payments for multiple bills.
1771
- */
1772
2342
  interface BulkBillRetryPaymentRequest {
1773
2343
  billIds: number[];
1774
2344
  }
1775
- /**
1776
- * Request payload for bulk-sending payment reminders for multiple bills.
1777
- */
1778
2345
  interface BulkBillRemindRequest {
1779
2346
  billIds: number[];
1780
2347
  }
1781
- /**
1782
- * Request payload for bulk-updating multiple bills.
1783
- */
1784
2348
  interface BulkBillUpdateRequest {
1785
2349
  bills: BillBatchUpdateRequest[];
1786
2350
  }
1787
- /**
1788
- * Response for bulk bill operations.
1789
- */
1790
2351
  type SBBillBulkActionResponse = SBBulkActionResponse;
1791
2352
 
1792
2353
  /**
@@ -2072,7 +2633,7 @@ declare class BillService extends BaseService {
2072
2633
  * @param options - Request options including business context and abort signal
2073
2634
  * @returns An array of allowed target statuses
2074
2635
  */
2075
- getAllowedTransitions(billId: number, options?: RequestOptions): Promise<BillStatus[]>;
2636
+ getAllowedTransitions(billId: number, options?: RequestOptions): Promise<SBBillStatus[]>;
2076
2637
  /**
2077
2638
  * Submits a bill for approval.
2078
2639
  *
@@ -4650,315 +5211,107 @@ declare class NotificationService extends BaseService {
4650
5211
  }
4651
5212
 
4652
5213
  /**
4653
- * A saved payment method for a business.
4654
- *
4655
- * Payment methods are used to pay bills and can be set as the default
4656
- * payment method for automatic payments.
4657
- */
4658
- interface SBPaymentMethod extends SBEntity, SBTimestamps {
4659
- type: string;
4660
- brand?: string;
4661
- last4?: string;
4662
- expirationMonth?: number;
4663
- expirationYear?: number;
4664
- isDefault: boolean;
4665
- billingDetails?: SBPaymentMethodBillingDetails;
4666
- stripePaymentMethodId?: string;
4667
- }
4668
- /**
4669
- * Billing details associated with a payment method.
4670
- */
4671
- interface SBPaymentMethodBillingDetails {
4672
- name?: string;
4673
- email?: string;
4674
- phone?: string;
4675
- address?: {
4676
- line1?: string;
4677
- line2?: string;
4678
- city?: string;
4679
- state?: string;
4680
- postalCode?: string;
4681
- country?: string;
4682
- };
4683
- }
4684
- /**
4685
- * Response from creating a Stripe SetupIntent for adding a new payment method.
4686
- */
4687
- interface SBPaymentMethodSetupIntentResponse {
4688
- clientSecret: string;
4689
- setupIntentId: string;
4690
- }
4691
- /**
4692
- * Request payload for creating a payment method from a completed SetupIntent.
4693
- */
4694
- interface CreatePaymentMethodRequest {
4695
- setupIntentId: string;
4696
- }
4697
- /**
4698
- * Request parameters for listing payment methods.
4699
- */
4700
- interface PaymentMethodListRequest extends PaginationRequest {
4701
- }
4702
-
4703
- /**
4704
- * Service for managing payment methods (cards, bank accounts).
4705
- *
4706
- * Provides methods to list, create, and delete payment methods,
4707
- * and to obtain setup intents for adding new payment methods securely.
4708
- */
4709
- declare class PaymentMethodService extends BaseService {
4710
- /**
4711
- * Lists payment methods for the current user.
4712
- *
4713
- * @param params - Optional filters and pagination for the payment method list
4714
- * @param options - Request options including locale and abort signal
4715
- * @returns Paginated list of payment methods
4716
- *
4717
- * @example
4718
- * ```typescript
4719
- * const { data } = await client.paymentMethods.list();
4720
- * ```
4721
- */
4722
- list(params?: PaymentMethodListRequest, options?: RequestOptions): Promise<SBListResponse<SBPaymentMethod>>;
4723
- /**
4724
- * Creates a payment method from a setup intent or token.
4725
- *
4726
- * @param data - The payment method creation data
4727
- * @param options - Request options including locale and abort signal
4728
- * @returns The created payment method
4729
- * @throws {SmartbillsValidationError} If the provided data fails validation
4730
- *
4731
- * @example
4732
- * ```typescript
4733
- * const setupIntent = await client.paymentMethods.createSetupIntent();
4734
- * const pm = await client.paymentMethods.create({ setupIntentId: setupIntent.id });
4735
- * ```
4736
- */
4737
- create(data: CreatePaymentMethodRequest, options?: RequestOptions): Promise<SBPaymentMethod>;
4738
- /**
4739
- * Creates a setup intent for adding a new payment method.
4740
- *
4741
- * @param options - Request options including locale and abort signal
4742
- * @returns The setup intent response with client secret for Stripe Elements
4743
- * @throws {SmartbillsAuthenticationError} If the user is not authenticated
4744
- */
4745
- createSetupIntent(options?: RequestOptions): Promise<SBPaymentMethodSetupIntentResponse>;
4746
- /**
4747
- * Deletes a payment method.
4748
- *
4749
- * @param id - The payment method ID
4750
- * @param options - Request options including locale and abort signal
4751
- * @throws {SmartbillsNotFoundError} If the payment method is not found
4752
- */
4753
- delete(id: number, options?: RequestOptions): Promise<void>;
4754
- }
4755
-
4756
- /**
4757
- * A receipt in the Smartbills system.
4758
- *
4759
- * Receipts are the core documents that track purchases, expenses, and transactions.
4760
- * They can be created manually, via OCR scanning, through email extraction, or
4761
- * from third-party integrations.
4762
- *
4763
- * @see {@link ReceiptCreateRequest} for creating a new receipt
4764
- * @see {@link ReceiptUpdateRequest} for updating an existing receipt
4765
- */
4766
- interface SBReceipt extends SBEntity, SBTimestamps {
4767
- type: ReceiptType;
4768
- source: ReceiptSource;
4769
- title?: string;
4770
- receiptNumber?: string;
4771
- currency?: string;
4772
- subTotal: number;
4773
- total: number;
4774
- totalDiscounts: number;
4775
- totalItems: number;
4776
- totalFees: number;
4777
- totalTaxes: number;
4778
- totalShipping: number;
4779
- totalTip: number;
4780
- date?: string;
4781
- cancelReason?: string;
4782
- originalReceiptUrl?: string;
4783
- barcode?: SBReceiptBarcode;
4784
- billingAddress?: SBBillingAddress;
4785
- business?: SBReceiptBusiness;
4786
- customer?: SBReceiptCustomer;
4787
- discounts?: SBReceiptDiscount[];
4788
- documents?: SBReceiptDocument[];
4789
- items?: SBReceiptLineItem[];
4790
- fees?: SBReceiptFee[];
4791
- payments?: SBReceiptPayment[];
4792
- refunds?: SBReceiptRefund[];
4793
- taxes?: SBReceiptTax[];
4794
- transactions?: SBReceiptTransaction[];
4795
- vendor?: SBReceiptVendor;
4796
- userId?: number;
4797
- businessId?: number;
4798
- checkoutStatus?: number;
4799
- }
4800
- /**
4801
- * A barcode associated with a receipt.
4802
- */
4803
- interface SBReceiptBarcode {
4804
- value: string;
4805
- format?: string;
4806
- }
4807
- /**
4808
- * The business information displayed on a receipt.
4809
- */
4810
- interface SBReceiptBusiness {
4811
- id?: number;
4812
- name?: string;
4813
- logo?: string;
4814
- address?: string;
4815
- }
4816
- /**
4817
- * Customer information associated with a receipt.
4818
- */
4819
- interface SBReceiptCustomer {
4820
- id?: number;
4821
- name?: string;
4822
- email?: string;
4823
- phone?: string;
4824
- }
4825
- /**
4826
- * A discount applied to a receipt.
4827
- */
4828
- interface SBReceiptDiscount {
4829
- name?: string;
4830
- amount: number;
4831
- percentage?: number;
4832
- }
4833
- /**
4834
- * A document attached to a receipt (e.g., PDF, image).
4835
- */
4836
- interface SBReceiptDocument {
4837
- id?: number;
4838
- name: string;
4839
- url?: string;
4840
- mimeType?: string;
4841
- createdAt?: string;
4842
- }
4843
- /**
4844
- * An individual line item on a receipt.
4845
- */
4846
- interface SBReceiptLineItem extends SBEntity {
4847
- name: string;
4848
- description?: string;
4849
- quantity: number;
4850
- unitPrice: number;
4851
- total: number;
4852
- sku?: string;
4853
- category?: string;
4854
- taxes?: SBReceiptTax[];
4855
- discounts?: SBReceiptDiscount[];
4856
- }
4857
- /**
4858
- * A fee applied to a receipt (e.g., service charge, delivery fee).
4859
- */
4860
- interface SBReceiptFee {
4861
- name: string;
4862
- amount: number;
4863
- }
4864
- /**
4865
- * A payment recorded against a receipt.
4866
- */
4867
- interface SBReceiptPayment extends SBEntity {
4868
- type: ReceiptPaymentType;
4869
- status: ReceiptPaymentStatus;
4870
- amount: number;
4871
- tip?: number;
4872
- billingAddress?: SBBillingAddress;
4873
- card?: SBReceiptPaymentCard;
4874
- statementDescriptor?: string;
4875
- receiptNumber?: string;
4876
- receiptUrl?: string;
4877
- }
4878
- /**
4879
- * Credit or debit card details for a receipt payment.
4880
- */
4881
- interface SBReceiptPaymentCard {
4882
- brand?: string;
4883
- last4?: string;
4884
- expirationMonth?: number;
4885
- expirationYear?: number;
4886
- }
4887
- /**
4888
- * A refund issued against a receipt.
4889
- */
4890
- interface SBReceiptRefund extends SBEntity {
4891
- note?: string;
4892
- processedAt?: string;
4893
- amount?: SBMoney;
4894
- }
4895
- /**
4896
- * A tax line on a receipt.
4897
- */
4898
- interface SBReceiptTax {
4899
- name: string;
4900
- amount: number;
4901
- rate?: number;
4902
- taxNumber?: string;
4903
- }
4904
- /**
4905
- * A transaction linked to a receipt.
5214
+ * A saved payment method for a business.
5215
+ *
5216
+ * Payment methods are used to pay bills and can be set as the default
5217
+ * payment method for automatic payments.
4906
5218
  */
4907
- interface SBReceiptTransaction extends SBEntity {
4908
- amount: number;
4909
- currency?: string;
4910
- date?: string;
5219
+ interface SBPaymentMethod extends SBEntity, SBTimestamps {
5220
+ type: string;
5221
+ brand?: string;
5222
+ last4?: string;
5223
+ expirationMonth?: number;
5224
+ expirationYear?: number;
5225
+ isDefault: boolean;
5226
+ billingDetails?: SBPaymentMethodBillingDetails;
5227
+ stripePaymentMethodId?: string;
4911
5228
  }
4912
5229
  /**
4913
- * Vendor (merchant) information displayed on a receipt.
5230
+ * Billing details associated with a payment method.
4914
5231
  */
4915
- interface SBReceiptVendor {
4916
- id?: number;
5232
+ interface SBPaymentMethodBillingDetails {
4917
5233
  name?: string;
4918
- logo?: string;
5234
+ email?: string;
5235
+ phone?: string;
5236
+ address?: {
5237
+ line1?: string;
5238
+ line2?: string;
5239
+ city?: string;
5240
+ state?: string;
5241
+ postalCode?: string;
5242
+ country?: string;
5243
+ };
4919
5244
  }
4920
5245
  /**
4921
- * Request payload for creating a new receipt.
5246
+ * Response from creating a Stripe SetupIntent for adding a new payment method.
4922
5247
  */
4923
- interface ReceiptCreateRequest {
4924
- title?: string;
4925
- receiptNumber?: string;
4926
- currency?: string;
4927
- date?: string;
4928
- subTotal?: number;
4929
- total?: number;
4930
- items?: Omit<SBReceiptLineItem, "id">[];
4931
- taxes?: SBReceiptTax[];
4932
- fees?: SBReceiptFee[];
4933
- discounts?: SBReceiptDiscount[];
4934
- payments?: Omit<SBReceiptPayment, "id">[];
5248
+ interface SBPaymentMethodSetupIntentResponse {
5249
+ clientSecret: string;
5250
+ setupIntentId: string;
4935
5251
  }
4936
5252
  /**
4937
- * Request payload for updating an existing receipt.
5253
+ * Request payload for creating a payment method from a completed SetupIntent.
4938
5254
  */
4939
- interface ReceiptUpdateRequest extends ReceiptCreateRequest {
4940
- id: number;
5255
+ interface CreatePaymentMethodRequest {
5256
+ setupIntentId: string;
4941
5257
  }
4942
5258
  /**
4943
- * Request parameters for listing receipts with filters and pagination.
5259
+ * Request parameters for listing payment methods.
4944
5260
  */
4945
- interface ReceiptListRequest {
4946
- page?: number;
4947
- limit?: number;
4948
- search?: string;
4949
- sortBy?: string;
4950
- sortDirection?: "asc" | "desc";
4951
- startDate?: string;
4952
- endDate?: string;
4953
- vendorId?: number;
4954
- businessId?: number;
5261
+ interface PaymentMethodListRequest extends PaginationRequest {
4955
5262
  }
5263
+
4956
5264
  /**
4957
- * Request payload for creating a receipt from an OCR-scanned image.
5265
+ * Service for managing payment methods (cards, bank accounts).
5266
+ *
5267
+ * Provides methods to list, create, and delete payment methods,
5268
+ * and to obtain setup intents for adding new payment methods securely.
4958
5269
  */
4959
- interface ReceiptOCRCreateRequest {
4960
- file: File | Blob;
4961
- businessId?: number;
5270
+ declare class PaymentMethodService extends BaseService {
5271
+ /**
5272
+ * Lists payment methods for the current user.
5273
+ *
5274
+ * @param params - Optional filters and pagination for the payment method list
5275
+ * @param options - Request options including locale and abort signal
5276
+ * @returns Paginated list of payment methods
5277
+ *
5278
+ * @example
5279
+ * ```typescript
5280
+ * const { data } = await client.paymentMethods.list();
5281
+ * ```
5282
+ */
5283
+ list(params?: PaymentMethodListRequest, options?: RequestOptions): Promise<SBListResponse<SBPaymentMethod>>;
5284
+ /**
5285
+ * Creates a payment method from a setup intent or token.
5286
+ *
5287
+ * @param data - The payment method creation data
5288
+ * @param options - Request options including locale and abort signal
5289
+ * @returns The created payment method
5290
+ * @throws {SmartbillsValidationError} If the provided data fails validation
5291
+ *
5292
+ * @example
5293
+ * ```typescript
5294
+ * const setupIntent = await client.paymentMethods.createSetupIntent();
5295
+ * const pm = await client.paymentMethods.create({ setupIntentId: setupIntent.id });
5296
+ * ```
5297
+ */
5298
+ create(data: CreatePaymentMethodRequest, options?: RequestOptions): Promise<SBPaymentMethod>;
5299
+ /**
5300
+ * Creates a setup intent for adding a new payment method.
5301
+ *
5302
+ * @param options - Request options including locale and abort signal
5303
+ * @returns The setup intent response with client secret for Stripe Elements
5304
+ * @throws {SmartbillsAuthenticationError} If the user is not authenticated
5305
+ */
5306
+ createSetupIntent(options?: RequestOptions): Promise<SBPaymentMethodSetupIntentResponse>;
5307
+ /**
5308
+ * Deletes a payment method.
5309
+ *
5310
+ * @param id - The payment method ID
5311
+ * @param options - Request options including locale and abort signal
5312
+ * @throws {SmartbillsNotFoundError} If the payment method is not found
5313
+ */
5314
+ delete(id: number, options?: RequestOptions): Promise<void>;
4962
5315
  }
4963
5316
 
4964
5317
  /**
@@ -6925,150 +7278,8 @@ declare class LoyaltyService extends BaseService {
6925
7278
  * @param id - The loyalty program ID
6926
7279
  * @param options - Request options including locale and abort signal
6927
7280
  * @throws {SmartbillsNotFoundError} If the loyalty program is not found
6928
- */
6929
- delete(id: string, options?: RequestOptions): Promise<void>;
6930
- }
6931
-
6932
- declare enum InvoiceStatus {
6933
- DRAFT = "Draft",
6934
- SENT = "Sent",
6935
- VIEWED = "Viewed",
6936
- PARTIALLY_PAID = "PartiallyPaid",
6937
- PAID = "Paid",
6938
- MARKED_PAID = "MarkedPaid",
6939
- OVERDUE = "Overdue",
6940
- CANCELLED = "Cancelled",
6941
- VOID = "Void"
6942
- }
6943
- interface SBInvoiceCustomer {
6944
- id?: number;
6945
- firstName?: string;
6946
- lastName?: string;
6947
- email?: string;
6948
- phoneNumber?: string;
6949
- company?: string;
6950
- }
6951
- interface SBInvoiceLineItemTax {
6952
- id?: number;
6953
- name?: string;
6954
- rate?: number;
6955
- amount?: SBMoney;
6956
- taxId?: number;
6957
- }
6958
- interface SBInvoiceLineItem {
6959
- id?: number;
6960
- description?: string;
6961
- quantity?: number;
6962
- unitPrice?: number;
6963
- price?: SBMoney;
6964
- subTotal?: SBMoney;
6965
- total?: SBMoney;
6966
- amount?: number;
6967
- productId?: number;
6968
- product?: {
6969
- id?: number;
6970
- name?: string;
6971
- sku?: string;
6972
- };
6973
- taxable?: boolean;
6974
- taxIds?: number[];
6975
- taxes?: SBInvoiceLineItemTax[];
6976
- }
6977
- interface SBInvoice extends SBEntity, SBTimestamps {
6978
- invoiceNumber?: string;
6979
- billStatus?: string;
6980
- dueDate?: string;
6981
- date?: string;
6982
- billingPeriodStartDate?: string;
6983
- billingPeriodEndDate?: string;
6984
- autoPaymentDate?: string;
6985
- amountDue?: SBMoney;
6986
- balanceForward?: SBMoney;
6987
- isOverdue?: boolean;
6988
- isPaid?: boolean;
6989
- paymentLinkToken?: string;
6990
- paymentLinkUrl?: string;
6991
- stripePaymentIntentId?: string;
6992
- sentAt?: string;
6993
- viewedAt?: string;
6994
- voidedAt?: string;
6995
- paidOn?: string;
6996
- customerId?: number;
6997
- vendorId?: number;
6998
- total?: SBMoney;
6999
- subTotal?: SBMoney;
7000
- totalTaxes?: SBMoney;
7001
- totalDiscounts?: SBMoney;
7002
- totalFees?: SBMoney;
7003
- totalBeforeTax?: SBMoney;
7004
- currency?: string;
7005
- hostedUrl?: string;
7006
- shortUrl?: string;
7007
- note?: string;
7008
- lineItems?: SBInvoiceLineItem[];
7009
- billingAddress?: SBAddress;
7010
- shippingAddress?: SBAddress;
7011
- reminders?: InvoiceReminder[];
7012
- customer?: SBInvoiceCustomer;
7013
- }
7014
- interface InvoiceListRequest extends PaginationRequest {
7015
- status?: string;
7016
- customerId?: number;
7017
- dateFrom?: string;
7018
- dateTo?: string;
7019
- minAmount?: number;
7020
- maxAmount?: number;
7021
- search?: string;
7022
- }
7023
- declare enum InvoiceReminderFrequency {
7024
- ONCE = "ONCE",
7025
- WEEKLY = "WEEKLY",
7026
- BIWEEKLY = "BIWEEKLY",
7027
- MONTHLY = "MONTHLY"
7028
- }
7029
- declare enum InvoiceReminderTiming {
7030
- BEFORE_DUE = "BEFORE_DUE",
7031
- ON_DUE = "ON_DUE",
7032
- AFTER_DUE = "AFTER_DUE"
7033
- }
7034
- interface InvoiceReminder {
7035
- id?: number;
7036
- enabled: boolean;
7037
- timing: InvoiceReminderTiming;
7038
- daysOffset: number;
7039
- frequency: InvoiceReminderFrequency;
7040
- maxReminders: number;
7041
- message?: string;
7042
- }
7043
- interface InvoiceCreateRequest {
7044
- invoiceNumber?: string;
7045
- date?: string;
7046
- dueDate?: string;
7047
- billingPeriodStartDate?: string;
7048
- billingPeriodEndDate?: string;
7049
- autoPaymentDate?: string;
7050
- amountDue?: SBMoney;
7051
- balanceForward?: SBMoney;
7052
- paymentLinkUrl?: string;
7053
- customerId?: number;
7054
- vendorId?: number;
7055
- currency?: string;
7056
- note?: string;
7057
- lineItems?: Omit<SBInvoiceLineItem, "id" | "product" | "taxes" | "price" | "subTotal" | "total">[];
7058
- billingAddress?: SBAddress;
7059
- shippingAddress?: SBAddress;
7060
- reminders?: InvoiceReminder[];
7061
- }
7062
- type InvoiceUpdateRequest = Partial<InvoiceCreateRequest>;
7063
- interface InvoiceSummary {
7064
- totalRevenue: number;
7065
- outstanding: number;
7066
- overdueCount: number;
7067
- paidThisMonth: number;
7068
- totalCount: number;
7069
- draftCount: number;
7070
- sentCount: number;
7071
- paidCount: number;
7281
+ */
7282
+ delete(id: string, options?: RequestOptions): Promise<void>;
7072
7283
  }
7073
7284
 
7074
7285
  declare class InvoiceService extends BaseService {
@@ -7081,9 +7292,15 @@ declare class InvoiceService extends BaseService {
7081
7292
  void(id: number, options?: RequestOptions): Promise<SBInvoice>;
7082
7293
  markPaid(id: number, options?: RequestOptions): Promise<SBInvoice>;
7083
7294
  duplicate(id: number, options?: RequestOptions): Promise<SBInvoice>;
7295
+ getNextInvoiceNumber(customerId?: number, options?: RequestOptions): Promise<NextInvoiceNumberResponse>;
7084
7296
  getSummary(options?: RequestOptions): Promise<InvoiceSummary>;
7085
7297
  downloadPdf(id: number, options?: RequestOptions): Promise<Blob>;
7086
- getByPaymentToken(token: string): Promise<SBInvoice>;
7298
+ /**
7299
+ * Fetch a public invoice by its short code — the URL-friendly identifier
7300
+ * that doubles as the authorization to view + pay (lives at
7301
+ * `https://invoice.smartbills.ca/i/{shortCode}`).
7302
+ */
7303
+ getByShortcode(shortCode: string): Promise<PublicInvoiceResponse>;
7087
7304
  }
7088
7305
 
7089
7306
  declare enum ConnectedAccountStatus {
@@ -7098,35 +7315,68 @@ declare enum ConnectedAccountType {
7098
7315
  STANDARD = "STANDARD",
7099
7316
  CUSTOM = "CUSTOM"
7100
7317
  }
7318
+ declare enum LateFeeType {
7319
+ PERCENTAGE = "Percentage",
7320
+ FIXED = "Fixed"
7321
+ }
7322
+ declare enum LateFeeFrequency {
7323
+ ONE_TIME = "OneTime",
7324
+ RECURRING = "Recurring"
7325
+ }
7326
+ interface ConnectedAccountLateFeeSettings {
7327
+ enabled: boolean;
7328
+ type: LateFeeType;
7329
+ amount: number;
7330
+ percentage: number;
7331
+ currency: string;
7332
+ gracePeriodDays: number;
7333
+ frequency: LateFeeFrequency;
7334
+ }
7335
+ interface ConnectedAccountProcessing {
7336
+ chargesEnabled: boolean;
7337
+ payoutsEnabled: boolean;
7338
+ detailsSubmitted: boolean;
7339
+ disabledReason?: string;
7340
+ }
7341
+ interface ConnectedAccountRequirements {
7342
+ currentlyDue?: string[];
7343
+ pastDue?: string[];
7344
+ }
7345
+ interface ConnectedAccountBankAccount {
7346
+ last4?: string;
7347
+ bankName?: string;
7348
+ currency?: string;
7349
+ country?: string;
7350
+ routingLast4?: string;
7351
+ }
7352
+ interface ConnectedAccountFees {
7353
+ percent: number;
7354
+ fixedAmount: number;
7355
+ currency: string;
7356
+ }
7357
+ interface ConnectedAccountSettings {
7358
+ acceptedPaymentMethods: string;
7359
+ defaultPaymentTermsDays: number;
7360
+ smsNotificationsEnabled: boolean;
7361
+ automaticTaxEnabled: boolean;
7362
+ lateFee?: ConnectedAccountLateFeeSettings;
7363
+ }
7101
7364
  interface SBConnectedAccount extends SBEntity, SBTimestamps {
7102
7365
  businessId: number;
7103
7366
  stripeAccountId?: string;
7104
7367
  accountType: ConnectedAccountType;
7105
7368
  status: ConnectedAccountStatus;
7106
- chargesEnabled: boolean;
7107
- payoutsEnabled: boolean;
7108
- detailsSubmitted: boolean;
7109
7369
  businessName?: string;
7110
7370
  businessUrl?: string;
7111
7371
  country?: string;
7112
7372
  defaultCurrency?: string;
7113
7373
  email?: string;
7114
- applicationFeePercent: number;
7115
- applicationFeeFixedAmount: number;
7116
- applicationFeeCurrency: string;
7117
- disabledReason?: string;
7118
- currentlyDue?: string;
7119
- pastDue?: string;
7120
- bankAccountLast4?: string;
7121
- bankAccountBankName?: string;
7122
- bankAccountCurrency?: string;
7123
- bankAccountCountry?: string;
7124
- bankAccountRoutingLast4?: string;
7125
7374
  stripeDashboardUrl?: string;
7126
- acceptedPaymentMethods: string;
7127
- defaultPaymentTermsDays: number;
7128
- smsNotificationsEnabled: boolean;
7129
- automaticTaxEnabled: boolean;
7375
+ processing?: ConnectedAccountProcessing;
7376
+ requirements?: ConnectedAccountRequirements;
7377
+ bankAccount?: ConnectedAccountBankAccount;
7378
+ fees?: ConnectedAccountFees;
7379
+ settings?: ConnectedAccountSettings;
7130
7380
  }
7131
7381
  interface ConnectedAccountOnboardingRequest {
7132
7382
  returnUrl: string;
@@ -7146,11 +7396,21 @@ interface FeeConfigurationRequest {
7146
7396
  applicationFeeFixedAmount: number;
7147
7397
  applicationFeeCurrency: string;
7148
7398
  }
7399
+ interface ConnectedAccountLateFeeSettingsRequest {
7400
+ enabled?: boolean;
7401
+ type?: LateFeeType;
7402
+ amount?: number;
7403
+ percentage?: number;
7404
+ currency?: string;
7405
+ gracePeriodDays?: number;
7406
+ frequency?: LateFeeFrequency;
7407
+ }
7149
7408
  interface ConnectedAccountSettingsRequest {
7150
7409
  acceptedPaymentMethods?: string;
7151
7410
  defaultPaymentTermsDays?: number;
7152
7411
  smsNotificationsEnabled?: boolean;
7153
7412
  automaticTaxEnabled?: boolean;
7413
+ lateFee?: ConnectedAccountLateFeeSettingsRequest;
7154
7414
  }
7155
7415
 
7156
7416
  declare class ConnectedAccountService extends BaseService {
@@ -7244,21 +7504,6 @@ interface RefundCreateRequest {
7244
7504
  reason?: string;
7245
7505
  notes?: string;
7246
7506
  }
7247
- interface SBDispute extends SBEntity, SBTimestamps {
7248
- invoicePaymentId: number;
7249
- stripeDisputeId?: string;
7250
- amount: number;
7251
- currency: string;
7252
- reason?: string;
7253
- status: string;
7254
- evidenceDueBy?: string;
7255
- isEvidenceSubmitted: boolean;
7256
- }
7257
- interface DisputeEvidenceRequest {
7258
- uncategorizedText?: string;
7259
- customerCommunication?: string;
7260
- serviceDocumentation?: string;
7261
- }
7262
7507
  interface LedgerSummary {
7263
7508
  grossRevenue: number;
7264
7509
  smartbillsFees: number;
@@ -7308,18 +7553,299 @@ declare class InvoicePaymentService extends BaseService {
7308
7553
  cancel(id: number, options?: RequestOptions): Promise<SBInvoicePayment>;
7309
7554
  createRefund(paymentId: number, data: RefundCreateRequest, options?: RequestOptions): Promise<SBRefund>;
7310
7555
  listRefunds(paymentId: number, options?: RequestOptions): Promise<SBRefund[]>;
7311
- listDisputes(params?: {
7312
- page?: number;
7313
- pageSize?: number;
7314
- }, options?: RequestOptions): Promise<SBDispute[]>;
7315
- submitEvidence(disputeId: number, data: DisputeEvidenceRequest, options?: RequestOptions): Promise<SBDispute>;
7316
- acceptDispute(disputeId: number, options?: RequestOptions): Promise<SBDispute>;
7317
7556
  getLedgerSummary(from: string, to: string, options?: RequestOptions): Promise<LedgerSummary>;
7318
7557
  getLedgerEntries(params?: Record<string, unknown>, options?: RequestOptions): Promise<LedgerEntry[]>;
7319
7558
  getPayouts(params?: Record<string, unknown>, options?: RequestOptions): Promise<Payout[]>;
7320
7559
  exportLedgerCsv(from: string, to: string, options?: RequestOptions): Promise<Blob>;
7321
7560
  }
7322
7561
 
7562
+ /**
7563
+ * Credit-note types — provider-agnostic. Mirrors `Smartbills.Core.DTO.CreditNotes` server-side.
7564
+ *
7565
+ * Two outcomes are supported (mutually exclusive per CN):
7566
+ * - "Refund" → triggers a Stripe refund through the Payments microservice.
7567
+ * - "CustomerBalance" → adds to a smartbills-side customer credit balance the customer
7568
+ * can apply to a future invoice via `applyCreditToInvoice`.
7569
+ *
7570
+ * Stripe's native CreditNote API is not used (would require creating Stripe Invoices,
7571
+ * which incur a per-invoice fee).
7572
+ */
7573
+ type CreditNoteType = "Refund" | "CustomerBalance";
7574
+ type CreditNoteStatus = "Draft" | "Issued" | "Voided";
7575
+ type CreditNoteReason = "Duplicate" | "Fraudulent" | "OrderChange" | "ProductUnsatisfactory" | "Other";
7576
+ type CustomerCreditLedgerSource = "CreditNote" | "Application" | "Reversal";
7577
+ interface CreditNoteLineItemRequest {
7578
+ invoiceLineItemId?: number | null;
7579
+ description?: string;
7580
+ quantity?: number;
7581
+ unitAmount: number;
7582
+ taxAmount?: number;
7583
+ }
7584
+ interface CreditNoteCreateRequest {
7585
+ type: CreditNoteType;
7586
+ reason: CreditNoteReason;
7587
+ /** Either supply lineItems or a flat amount in cents. lineItems take precedence. */
7588
+ lineItems?: CreditNoteLineItemRequest[];
7589
+ /** Smallest currency unit (cents). Used when lineItems are not provided. */
7590
+ amount?: number;
7591
+ currency?: string;
7592
+ memo?: string;
7593
+ }
7594
+ interface ApplyCustomerCreditRequest {
7595
+ /** Smallest currency unit (cents). */
7596
+ amount: number;
7597
+ currency?: string;
7598
+ notes?: string;
7599
+ }
7600
+ interface SBCreditNoteLineItem {
7601
+ id: number;
7602
+ sbCreditNoteId: number;
7603
+ invoiceLineItemId?: number | null;
7604
+ description?: string;
7605
+ quantity: number;
7606
+ unitAmount: number;
7607
+ currency: string;
7608
+ subtotal: number;
7609
+ taxAmount: number;
7610
+ total: number;
7611
+ }
7612
+ interface SBCreditNote {
7613
+ id: number;
7614
+ businessId?: number | null;
7615
+ merchantId?: number | null;
7616
+ customerId?: number | null;
7617
+ invoiceId: number;
7618
+ number: string;
7619
+ reason: CreditNoteReason;
7620
+ type: CreditNoteType;
7621
+ status: CreditNoteStatus;
7622
+ /** Total in dollars (matches server-side decimal storage). */
7623
+ totalAmount: number;
7624
+ totalCurrency: string;
7625
+ memo?: string;
7626
+ issuedAt?: string | null;
7627
+ voidedAt?: string | null;
7628
+ /** Set asynchronously once the agnostic payment.refunded webhook lands. */
7629
+ relatedRefundId?: number | null;
7630
+ customerCreditEntryId?: number | null;
7631
+ createdAt: string;
7632
+ lineItems: SBCreditNoteLineItem[];
7633
+ }
7634
+ interface CustomerCreditLedgerEntry {
7635
+ id: number;
7636
+ amountChange: number;
7637
+ currency: string;
7638
+ source: CustomerCreditLedgerSource;
7639
+ sourceCreditNoteId?: number | null;
7640
+ appliedToInvoiceId?: number | null;
7641
+ notes?: string;
7642
+ createdAt: string;
7643
+ }
7644
+ interface CustomerCreditBalance {
7645
+ customerId: number;
7646
+ /** Sum of ledger entries in the requested currency (or all if none specified). */
7647
+ balance: number;
7648
+ currency: string;
7649
+ entries: CustomerCreditLedgerEntry[];
7650
+ }
7651
+
7652
+ /**
7653
+ * Smartbills-owned credit notes. See `entities/credit-notes/models.ts` for the type-vs-status
7654
+ * model. All routes are tenant-scoped under `/v1/businesses/{businessId}`.
7655
+ */
7656
+ declare class CreditNoteService extends BaseService {
7657
+ /** Issue a credit note against an invoice. Returns the persisted CN; for refund-type CNs,
7658
+ * the `relatedRefundId` is back-filled asynchronously when the Stripe webhook lands. */
7659
+ issue(invoiceId: number, data: CreditNoteCreateRequest, options?: RequestOptions): Promise<SBCreditNote>;
7660
+ listByInvoice(invoiceId: number, options?: RequestOptions): Promise<SBCreditNote[]>;
7661
+ getById(id: number, options?: RequestOptions): Promise<SBCreditNote>;
7662
+ /** Void an issued CN. Allowed only when no money has moved (refund still pending) or
7663
+ * when a customer-balance credit hasn't been applied to another invoice yet. */
7664
+ void(id: number, options?: RequestOptions): Promise<SBCreditNote>;
7665
+ getCustomerCreditBalance(customerId: number, currency?: string, options?: RequestOptions): Promise<CustomerCreditBalance>;
7666
+ /** Apply a positive customer credit balance to an outstanding invoice. */
7667
+ applyCreditToInvoice(invoiceId: number, data: ApplyCustomerCreditRequest, options?: RequestOptions): Promise<void>;
7668
+ }
7669
+
7670
+ /**
7671
+ * A payment received against an invoice — flat read view exposed at
7672
+ * `GET /v1/businesses/{businessId}/payments`. Mirrors the same shape used inside
7673
+ * `SBInvoiceResponse.payments[]`, so a single component can render either source.
7674
+ */
7675
+ interface SBPayment extends SBEntity {
7676
+ type: ReceiptPaymentType;
7677
+ status: ReceiptPaymentStatus;
7678
+ amount: SBMoney;
7679
+ total?: SBMoney;
7680
+ approuved?: SBMoney;
7681
+ refunded?: SBMoney;
7682
+ applicationFee?: SBMoney;
7683
+ tip?: SBMoney;
7684
+ card?: SBPaymentCardSnippet;
7685
+ external?: SBPaymentExternalSnippet;
7686
+ paymentMethodId?: number;
7687
+ paidAt?: string;
7688
+ receiptNumber?: string;
7689
+ receiptUrl?: string;
7690
+ note?: string;
7691
+ }
7692
+ interface SBPaymentCardSnippet {
7693
+ brand?: string;
7694
+ last4?: string;
7695
+ expirationMonth?: number;
7696
+ expirationYear?: number;
7697
+ }
7698
+ interface SBPaymentExternalSnippet {
7699
+ source?: string;
7700
+ sourceId?: string;
7701
+ type?: string;
7702
+ fee?: number;
7703
+ }
7704
+ /** Filters accepted by `GET /v1/businesses/{businessId}/payments`. */
7705
+ interface PaymentListRequest extends PaginationRequest {
7706
+ invoiceId?: number;
7707
+ status?: ReceiptPaymentStatus;
7708
+ type?: ReceiptPaymentType;
7709
+ currency?: string;
7710
+ fromDate?: string;
7711
+ toDate?: string;
7712
+ minAmount?: number;
7713
+ maxAmount?: number;
7714
+ }
7715
+
7716
+ /**
7717
+ * Read-side service over `SBPayment` for the dashboard's top-level Payments tab.
7718
+ * Backed by `GET /v1/businesses/{businessId}/payments` (and `/{paymentId}` for
7719
+ * detail). Payments are also nested inside their parent invoice via
7720
+ * `SBInvoiceResponse.payments[]`; this service just flattens them so a Payments
7721
+ * page doesn't have to fan out across invoices.
7722
+ */
7723
+ declare class PaymentService extends BaseService {
7724
+ list(params?: PaymentListRequest, options?: RequestOptions): Promise<SBListResponse<SBPayment>>;
7725
+ getById(paymentId: number, options?: RequestOptions): Promise<SBPayment>;
7726
+ }
7727
+
7728
+ /**
7729
+ * Wire format for PaymentIntent / Charge / Statement enums is CONSTANT_CASE strings,
7730
+ * controlled by the API's JsonStringEnumConverter using ConstantCasePropertyNameResolver
7731
+ * (see Smartbills.API/Program.cs). The enum values below mirror what the JSON body
7732
+ * actually carries, NOT the .NET PascalCase identifier.
7733
+ */
7734
+ declare enum PaymentIntentStatus {
7735
+ REQUIRES_PAYMENT_METHOD = "REQUIRES_PAYMENT_METHOD",
7736
+ REQUIRES_CONFIRMATION = "REQUIRES_CONFIRMATION",
7737
+ REQUIRES_ACTION = "REQUIRES_ACTION",
7738
+ PROCESSING = "PROCESSING",
7739
+ REQUIRES_CAPTURE = "REQUIRES_CAPTURE",
7740
+ CANCELED = "CANCELED",
7741
+ SUCCEEDED = "SUCCEEDED",
7742
+ FAILED = "FAILED",
7743
+ PENDING = "PENDING",
7744
+ REFUNDED = "REFUNDED",
7745
+ PARTIALLY_REFUNDED = "PARTIALLY_REFUNDED",
7746
+ DISPUTED = "DISPUTED",
7747
+ EXPIRED = "EXPIRED"
7748
+ }
7749
+ declare enum ChargeStatus {
7750
+ PENDING = "PENDING",
7751
+ SUCCEEDED = "SUCCEEDED",
7752
+ FAILED = "FAILED"
7753
+ }
7754
+ interface SBCharge extends SBEntity, SBTimestamps {
7755
+ paymentIntentId: number;
7756
+ stripeChargeId?: string;
7757
+ amount: number;
7758
+ currency: string;
7759
+ status: ChargeStatus | string;
7760
+ failureCode?: string;
7761
+ failureMessage?: string;
7762
+ paymentMethodType?: string;
7763
+ paymentMethodBrand?: string;
7764
+ paymentMethodLast4?: string;
7765
+ riskLevel?: string;
7766
+ riskScore?: number;
7767
+ captured: boolean;
7768
+ capturedAt?: string;
7769
+ refunded: boolean;
7770
+ amountRefunded: number;
7771
+ stripeProcessingFee?: number;
7772
+ netAmount: number;
7773
+ stripeBalanceTransactionId?: string;
7774
+ }
7775
+ interface SBPaymentIntent extends SBEntity, SBTimestamps {
7776
+ connectedAccountId: number;
7777
+ businessId: number;
7778
+ invoiceId: number;
7779
+ externalInvoiceId?: string;
7780
+ customerId?: number;
7781
+ status: PaymentIntentStatus | string;
7782
+ amount: number;
7783
+ tipAmount: number;
7784
+ applicationFeeAmount: number;
7785
+ totalStripeProcessingFees?: number;
7786
+ netAmount: number;
7787
+ currency: string;
7788
+ stripePaymentIntentId?: string;
7789
+ stripeCheckoutSessionId?: string;
7790
+ checkoutUrl?: string;
7791
+ customerEmail?: string;
7792
+ customerName?: string;
7793
+ paymentMethodType?: string;
7794
+ paymentMethodBrand?: string;
7795
+ paymentMethodLast4?: string;
7796
+ failureCode?: string;
7797
+ failureMessage?: string;
7798
+ clientSecret?: string;
7799
+ paidAt?: string;
7800
+ canceledAt?: string;
7801
+ charges?: SBCharge[];
7802
+ disputeCount?: number;
7803
+ }
7804
+ interface PaymentIntentListRequest {
7805
+ status?: PaymentIntentStatus | string;
7806
+ dateFrom?: string;
7807
+ dateTo?: string;
7808
+ customerId?: number;
7809
+ search?: string;
7810
+ page?: number;
7811
+ pageSize?: number;
7812
+ }
7813
+ /**
7814
+ * Server-computed aggregation across the requested period. Sourced from
7815
+ * <c>GET /v1/businesses/{businessId}/payment-intents/summary</c>. Amounts are in cents
7816
+ * (Stripe convention) — the dashboard divides by 100 before rendering.
7817
+ */
7818
+ interface SBPaymentIntentSummary {
7819
+ totalGross: number;
7820
+ totalNet: number;
7821
+ totalStripeProcessingFees: number;
7822
+ totalApplicationFees: number;
7823
+ totalRefunded: number;
7824
+ count: number;
7825
+ succeededCount: number;
7826
+ failedCount: number;
7827
+ currency: string;
7828
+ }
7829
+
7830
+ /**
7831
+ * Read/write surface for `SBPaymentIntent` rows in the Smartbills.Payments service,
7832
+ * fronted by the API's <c>PaymentIntentsProxyController</c>. Backs the dashboard's
7833
+ * Stripe-side payments view (gross/net/fees/refunds), distinct from the
7834
+ * <c>PaymentService</c> which reads <c>SBPayment</c> rows recorded against invoices.
7835
+ */
7836
+ declare class PaymentIntentService extends BaseService {
7837
+ list(params?: PaymentIntentListRequest, options?: RequestOptions): Promise<PagedResult<SBPaymentIntent>>;
7838
+ getSummary(params: {
7839
+ dateFrom?: string;
7840
+ dateTo?: string;
7841
+ }, options?: RequestOptions): Promise<SBPaymentIntentSummary>;
7842
+ getById(id: number, options?: RequestOptions): Promise<SBPaymentIntent>;
7843
+ cancel(id: number, options?: RequestOptions): Promise<SBPaymentIntent>;
7844
+ listCharges(id: number, options?: RequestOptions): Promise<SBCharge[]>;
7845
+ createRefund(paymentIntentId: number, data: RefundCreateRequest, options?: RequestOptions): Promise<SBRefund>;
7846
+ listRefunds(paymentIntentId: number, options?: RequestOptions): Promise<SBRefund[]>;
7847
+ }
7848
+
7323
7849
  declare enum PayoutStatus {
7324
7850
  PAID = "paid",
7325
7851
  PENDING = "pending",
@@ -7389,6 +7915,212 @@ declare class PayoutService extends BaseService {
7389
7915
  getBalance(options?: RequestOptions): Promise<SBBalance>;
7390
7916
  }
7391
7917
 
7918
+ /**
7919
+ * Stripe-side dispute (chargeback) details exposed by Smartbills.Payments. Each row mirrors
7920
+ * Stripe's `dispute` object plus a few hydrated fields from the originating PaymentIntent so
7921
+ * the dashboard can render dispute context without a second lookup.
7922
+ */
7923
+ interface SBDispute {
7924
+ id: number;
7925
+ chargeId: number;
7926
+ paymentIntentId: number;
7927
+ stripeDisputeId?: string;
7928
+ amount: number;
7929
+ currency: string;
7930
+ reason?: string;
7931
+ status: string;
7932
+ evidenceDueBy?: string;
7933
+ isEvidenceSubmitted: boolean;
7934
+ createdAt: string;
7935
+ customerName?: string;
7936
+ customerEmail?: string;
7937
+ paymentMethodBrand?: string;
7938
+ paymentMethodLast4?: string;
7939
+ paymentPaidAt?: string;
7940
+ invoiceId?: number;
7941
+ }
7942
+ interface SBDisputeStats {
7943
+ /** Disputes that need merchant evidence (NeedsResponse + WarningNeedsResponse). */
7944
+ needsResponseCount: number;
7945
+ /** Total $ at risk across active disputes (cents). */
7946
+ amountAtRisk: number;
7947
+ currency: string;
7948
+ /** Dispute rate over the last 12 months (% as decimal). */
7949
+ disputeRate: number;
7950
+ totalCount: number;
7951
+ wonCount: number;
7952
+ lostCount: number;
7953
+ underReviewCount: number;
7954
+ }
7955
+ interface SBDisputeListResponse {
7956
+ data: SBDispute[];
7957
+ page: number;
7958
+ pageSize: number;
7959
+ totalCount: number;
7960
+ totalPages: number;
7961
+ stats: SBDisputeStats;
7962
+ }
7963
+ interface DisputeListRequest {
7964
+ status?: string;
7965
+ page?: number;
7966
+ pageSize?: number;
7967
+ }
7968
+ /**
7969
+ * One of Stripe's named evidence slots. Every slot accepts either text or a previously-uploaded
7970
+ * Stripe File ID (one per slot). The slot enum is shared with the backend so the client and
7971
+ * server agree on the S3 key prefix and the field that gets mapped to Stripe's
7972
+ * `DisputeEvidenceOptions`.
7973
+ */
7974
+ declare enum DisputeEvidenceSlot {
7975
+ CustomerCommunication = "CustomerCommunication",
7976
+ Receipt = "Receipt",
7977
+ ServiceDocumentation = "ServiceDocumentation",
7978
+ ShippingDocumentation = "ShippingDocumentation",
7979
+ RefundPolicy = "RefundPolicy",
7980
+ CancellationPolicy = "CancellationPolicy",
7981
+ CustomerSignature = "CustomerSignature",
7982
+ DuplicateChargeDocumentation = "DuplicateChargeDocumentation",
7983
+ Uncategorized = "Uncategorized"
7984
+ }
7985
+ interface DisputeEvidenceUploadUrlRequest {
7986
+ slot: DisputeEvidenceSlot;
7987
+ fileName: string;
7988
+ contentType?: string;
7989
+ }
7990
+ interface DisputeEvidenceUploadUrlResponse {
7991
+ uploadUrl: string;
7992
+ key: string;
7993
+ expires: string;
7994
+ }
7995
+ interface DisputeEvidenceFinalizeRequest {
7996
+ slot: DisputeEvidenceSlot;
7997
+ key: string;
7998
+ fileName: string;
7999
+ }
8000
+ interface DisputeEvidenceFinalizeResponse {
8001
+ /** Stripe File ID (file_xxx) — pass into the matching evidence slot when submitting. */
8002
+ stripeFileId: string;
8003
+ slot: DisputeEvidenceSlot;
8004
+ fileName: string;
8005
+ size: number;
8006
+ }
8007
+ /**
8008
+ * Stripe's evidence schema. Each free-text field has a corresponding `*FileId` slot — set one or
8009
+ * the other, not both, per Stripe's API contract. `submit: false` saves the evidence as a draft.
8010
+ */
8011
+ interface DisputeEvidenceRequest {
8012
+ uncategorizedText?: string;
8013
+ customerCommunication?: string;
8014
+ serviceDocumentation?: string;
8015
+ refundPolicy?: string;
8016
+ refundPolicyDisclosure?: string;
8017
+ refundRefusalExplanation?: string;
8018
+ cancellationPolicy?: string;
8019
+ cancellationPolicyDisclosure?: string;
8020
+ cancellationRebuttal?: string;
8021
+ accessActivityLog?: string;
8022
+ billingAddress?: string;
8023
+ customerName?: string;
8024
+ customerEmailAddress?: string;
8025
+ customerPurchaseIp?: string;
8026
+ productDescription?: string;
8027
+ duplicateChargeExplanation?: string;
8028
+ serviceDate?: string;
8029
+ shippingAddress?: string;
8030
+ shippingCarrier?: string;
8031
+ shippingDate?: string;
8032
+ shippingTrackingNumber?: string;
8033
+ customerCommunicationFileId?: string;
8034
+ receiptFileId?: string;
8035
+ serviceDocumentationFileId?: string;
8036
+ shippingDocumentationFileId?: string;
8037
+ refundPolicyFileId?: string;
8038
+ cancellationPolicyFileId?: string;
8039
+ customerSignatureFileId?: string;
8040
+ duplicateChargeDocumentationFileId?: string;
8041
+ uncategorizedFileId?: string;
8042
+ submit?: boolean;
8043
+ }
8044
+
8045
+ /**
8046
+ * Stripe disputes (chargebacks) for the active business. Backed by Smartbills.Payments via
8047
+ * the API's <c>DisputesProxyController</c>. Evidence file uploads use a two-step flow
8048
+ * (presigned PUT to S3 → finalize that streams the bytes into Stripe's File API as
8049
+ * `dispute_evidence`); the merchant collects file IDs across slots and submits them all in
8050
+ * the final <c>POST /evidence</c>.
8051
+ */
8052
+ declare class DisputeService extends BaseService {
8053
+ list(params?: DisputeListRequest, options?: RequestOptions): Promise<SBDisputeListResponse>;
8054
+ getById(disputeId: number, options?: RequestOptions): Promise<SBDispute>;
8055
+ submitEvidence(disputeId: number, data: DisputeEvidenceRequest, options?: RequestOptions): Promise<SBDispute>;
8056
+ accept(disputeId: number, options?: RequestOptions): Promise<SBDispute>;
8057
+ /**
8058
+ * Step 1 of the evidence file upload — returns a presigned PUT URL the dashboard uses to
8059
+ * stream the file directly to S3. URL expires in 15 minutes; the dashboard should not cache it.
8060
+ */
8061
+ createEvidenceUploadUrl(disputeId: number, data: DisputeEvidenceUploadUrlRequest, options?: RequestOptions): Promise<DisputeEvidenceUploadUrlResponse>;
8062
+ /**
8063
+ * Step 2 — once the file is in S3, the API streams it into Stripe's File API on the
8064
+ * connected account and returns the resulting Stripe File ID. The dashboard then sets that
8065
+ * ID on the matching slot in <c>DisputeEvidenceRequest</c> when submitting.
8066
+ */
8067
+ finalizeEvidence(disputeId: number, data: DisputeEvidenceFinalizeRequest, options?: RequestOptions): Promise<DisputeEvidenceFinalizeResponse>;
8068
+ /**
8069
+ * Convenience — runs the full upload+finalize flow against a browser File. The dashboard
8070
+ * uses this from a drag-and-drop dropzone; tests use the explicit two-call form.
8071
+ */
8072
+ uploadEvidenceFile(disputeId: number, slot: DisputeEvidenceUploadUrlRequest["slot"], file: File, options?: RequestOptions): Promise<DisputeEvidenceFinalizeResponse>;
8073
+ }
8074
+
8075
+ declare enum StatementStatus {
8076
+ PENDING = "PENDING",
8077
+ GENERATED = "GENERATED",
8078
+ SENT = "SENT",
8079
+ FAILED = "FAILED"
8080
+ }
8081
+ interface SBStatement extends SBEntity, SBTimestamps {
8082
+ businessId: number;
8083
+ periodStart: string;
8084
+ periodEnd: string;
8085
+ periodType: string;
8086
+ totalGross: number;
8087
+ totalStripeProcessingFees: number;
8088
+ totalApplicationFees: number;
8089
+ totalRefunded: number;
8090
+ totalNet: number;
8091
+ transactionCount: number;
8092
+ refundCount: number;
8093
+ currency: string;
8094
+ status: StatementStatus | string;
8095
+ pdfStorageKey?: string;
8096
+ generatedAt?: string;
8097
+ emailSentAt?: string;
8098
+ emailRecipient?: string;
8099
+ emailDeliveryAttempts: number;
8100
+ }
8101
+ interface StatementListRequest {
8102
+ status?: StatementStatus;
8103
+ fromDate?: string;
8104
+ toDate?: string;
8105
+ page?: number;
8106
+ pageSize?: number;
8107
+ }
8108
+ interface StatementListResponse {
8109
+ items: SBStatement[];
8110
+ totalCount: number;
8111
+ page: number;
8112
+ pageSize: number;
8113
+ totalPages: number;
8114
+ }
8115
+
8116
+ declare class StatementService extends BaseService {
8117
+ list(params?: StatementListRequest, options?: RequestOptions): Promise<StatementListResponse>;
8118
+ getById(id: number, options?: RequestOptions): Promise<SBStatement>;
8119
+ /** Returns a Blob for download. Callers are responsible for rendering or saving it. */
8120
+ downloadPdf(id: number, options?: RequestOptions): Promise<Blob>;
8121
+ resendEmail(id: number, options?: RequestOptions): Promise<SBStatement>;
8122
+ }
8123
+
7392
8124
  /**
7393
8125
  * Configuration options for initializing a {@link SmartbillsClient}.
7394
8126
  */
@@ -7472,7 +8204,12 @@ declare class SmartbillsClient {
7472
8204
  readonly invoices: InvoiceService;
7473
8205
  readonly connectedAccounts: ConnectedAccountService;
7474
8206
  readonly invoicePayments: InvoicePaymentService;
8207
+ readonly creditNotes: CreditNoteService;
8208
+ readonly payments: PaymentService;
8209
+ readonly paymentIntents: PaymentIntentService;
7475
8210
  readonly payouts: PayoutService;
8211
+ readonly disputes: DisputeService;
8212
+ readonly statements: StatementService;
7476
8213
  /**
7477
8214
  * Creates a new Smartbills client instance.
7478
8215
  *
@@ -7665,5 +8402,5 @@ declare function isRetryableError(error: unknown): boolean;
7665
8402
  declare function uploadFileToS3(uploadUrl: string, file: Blob | ArrayBuffer, contentType: string): Promise<void>;
7666
8403
  declare function uploadFileUriToS3(uploadUrl: string, fileUri: string, contentType: string): Promise<void>;
7667
8404
 
7668
- export { AccessToken, AppInstallationService, AppInstallationStatus, ApprobationService, AttachmentService, AuthorizedSenderService, BaseService, BillApprovalStatus, BillApprovalType, BillService, BillStatus, BillingService, BusinessService, BusinessUserService, CategoryService, CheckoutDocumentType, CheckoutPaymentStatus, CheckoutService, CheckoutStatus, ConnectAccountStatus, ConnectService, ConnectedAccountService, ConnectedAccountStatus, ConnectedAccountType, CustomerService, DEFAULT_BASE_URL, DepartmentService, EmailAccountService, EmailAccountStatus, EmailAccountSyncStatus, EmailAccountType, EmailForwardingService, EmployeeService, ErrorCode, ExpenseItemStatus, ExpenseJobService, ExpenseJobStatus, ExpenseReportAuditLogAction, ExpenseReportExpenseService, ExpenseReportPaymentService, ExpenseReportService, ExpenseReportStatus, ExpenseService, ExpenseSplitType, HttpClient, IntegrationService, IntegrationStatus, InvitationService, InvitationStatus, InvoicePaymentService, InvoicePaymentStatus, InvoiceReminderFrequency, InvoiceReminderTiming, InvoiceService, InvoiceStatus, LocationService, LoyaltyService, MailboxType, MembershipRole, MembershipService, NotificationService, NotificationType, PayerType, PaymentMethodService, PayoutInterval, PayoutService, PayoutStatus, ProductService, PromoCodeService, ReceiptPaymentStatus, ReceiptPaymentType, ReceiptService, ReceiptSource, ReceiptType, ReportingService, SmartbillsApiError, SmartbillsAuthenticationError, SmartbillsClient, SmartbillsConflictError, SmartbillsError, SmartbillsNetworkError, SmartbillsNotFoundError, SmartbillsPermissionError, SmartbillsQuotaError, SmartbillsRateLimitError, SmartbillsValidationError, SyncTriggerType, TableService, TaxService, TransactionService, TransactionType, UserService, VendorConnectionService, VendorConnectionStatus, VendorService, WorkflowService, WorkflowTriggerType, isApiError, isAuthenticationError, isConflictError, isNetworkError, isNotFoundError, isPermissionError, isQuotaError, isRateLimitError, isRetryableError, isSmartbillsError, isValidationError, uploadFileToS3, uploadFileUriToS3 };
7669
- export type { AddExpenseToReportRequest, AddExpensesToReportBatchRequest, ApprobationListRequest, AssociateExpenseReportUpdateRequest, AttachmentListRequest, AttachmentRenameRequest, BalanceAmount, BillApprovalRequest, BillBatchUpdateRequest, BillCancelRequest, BillCreateRequest, BillListRequest, BillMarkPaidRequest, BillReschedulePaymentRequest, BillRetryPaymentRequest, BillSchedulePaymentRequest, BillSubmitForApprovalRequest, BillTransitionRequest, BillUpdateRequest, BillingInvoiceListRequest, BulkApproveApprobationsRequest, BulkAssignCategoryRequest, BulkAssignExpenseReportRequest, BulkAssignPayerTypeRequest, BulkAssignReportCategoryRequest, BulkAssignVendorRequest, BulkBillApproveRequest, BulkBillCancelPaymentRequest, BulkBillDeleteRequest, BulkBillMarkPaidRequest, BulkBillRemindRequest, BulkBillRetryPaymentRequest, BulkBillSchedulePaymentRequest, BulkBillUnscheduleRequest, BulkBillUpdateRequest, BulkDeleteExpenseReportsRequest, BulkDeleteExpensesRequest, BulkDeleteVendorsRequest, BulkMarkReimbursedApprobationsRequest, BulkPlanReimbursementApprobationsRequest, BulkRecallExpenseReportsRequest, BulkRejectApprobationsRequest, BulkRemoveReportExpensesRequest, BulkRequestChangesApprobationsRequest, BulkRevertToReviewApprobationsRequest, BulkSetNoteRequest, BulkSubmitExpenseReportsRequest, BusinessBatchUpdateRequest, BusinessBrandCreateRequest, BusinessBrandUpdateRequest, BusinessCreateRequest, BusinessUpdateRequest, CategoryCreateRequest, CategoryListRequest, CategoryUpdateRequest, CheckoutLineItem, ConfirmUploadFileRequest, ConfirmUploadRequest, ConnectOnboardingRequest, ConnectedAccountOnboardingRequest, ConnectedAccountOnboardingResult, ConnectedAccountSettingsRequest, CreateAuthorizedSenderRequest, CreateCheckoutPaymentIntentRequest, CreatePaymentMethodRequest, CreatePayoutRequest, CreatePortalSessionRequest, CredentialProvider, CustomerCreateRequest, CustomerListRequest, CustomerUpdateRequest, DepartmentCreateRequest, DepartmentListRequest, DepartmentUpdateRequest, DisputeEvidenceRequest, EditExpenseInReportRequest, EmailAccountImapCreateRequest, EmailAccountListRequest, EmailAccountOAuth2CreateRequest, EmailAccountUpdateRequest, EmailForwardingConfigRequest, EmployeeBulkAssignManagerRequest, EmployeeCreateRequest, EmployeeListRequest, EmployeeSetManagerRequest, EmployeeUpdateRequest, ErrorCodeType, ExpenseAttachmentDownloadRequest, ExpenseCategoryUpdateRequest, ExpenseExportRequest, ExpenseJobListRequest, ExpenseListRequest, ExpenseNoteUpdateRequest, ExpenseOverTimeRequest, ExpensePayerTypeUpdateRequest, ExpenseReportApproveRequest, ExpenseReportAssignLedgerAccountRequest, ExpenseReportCommentCreateRequest, ExpenseReportCreateRequest, ExpenseReportExportRequest, ExpenseReportListRequest, ExpenseReportPartialReimburseRequest, ExpenseReportPlanReimbursementRequest, ExpenseReportRecallRequest, ExpenseReportReimburseRequest, ExpenseReportRejectRequest, ExpenseReportRequestChangesRequest, ExpenseReportUpdateRequest, ExpenseReviewUpdateRequest, ExpenseSplitItem, ExpenseSplitLineItem, ExpenseSplitRequest, FeeConfigurationRequest, HistoricalSyncRequest, HttpClientConfig, IntegrationCallbackRequest, IntegrationListRequest, InvitationCreateRequest, InvitationListRequest, InvoiceCreateRequest, InvoiceListRequest, InvoicePaymentCreateRequest, InvoicePaymentFilterRequest, InvoiceReminder, InvoiceSummary, InvoiceUpdateRequest, LedgerEntry, LedgerSummary, LocationBatchCreateRequest, LocationBatchUpdateRequest, LocationCreateRequest, LocationImageUrlRequest, LocationListRequest, LocationUpdateRequest, LoyaltyProgramCreateRequest, LoyaltyProgramListRequest, LoyaltyProgramStatus, LoyaltyProgramUpdateRequest, LoyaltyRewardType, LoyaltyRuleType, MailboxUpdateRequest, MembershipCreateRequest, MembershipEmailInviteRequest, MembershipListRequest, MembershipRoleUpdateRequest, NotificationListRequest, PagedResult, PaginateBusinessRequest, PaginateTransactionRequest, PaginationRequest, PaymentMethodListRequest, Payout, PayoutListRequest, PayoutListResponse, PayoutSchedule, PresignedUploadFileRequest, PresignedUploadFileResponse, PresignedUploadRequest, PresignedUploadResponse, ProductCreateRequest, ProductListRequest, ProductUpdateRequest, ReceiptCreateRequest, ReceiptListRequest, ReceiptOCRCreateRequest, ReceiptUpdateRequest, RefundCheckoutPaymentRequest, RefundCreateRequest, ReportDateRange, ReportingRequest, RequestOptions, SBAddress, SBAppInstallation, SBApprobationSummary, SBAttachment, SBAuthorizedSender, SBBalance, SBBatchResponse, SBBill, SBBillApproval, SBBillApprovalHistoryItem, SBBillAttachment, SBBillBulkActionResponse, SBBillLineItem, SBBillStatusSummary, SBBillTax, SBBillTransitionResponse, SBBillingAddress, SBBillingInvoice, SBBillingInvoiceLine, SBBillingPaymentMethod, SBBillingPlan, SBBillingUsage, SBBulkActionResponse, SBBulkActionResult, SBBusiness, SBBusinessBrand, SBBusinessPlan, SBCategory, SBCategoryRuleData, SBCheckoutLineItem, SBCheckoutPayment, SBCheckoutPaymentDispute, SBCheckoutPaymentRefund, SBCheckoutTax, SBCheckoutTransactionResponse, SBConnectAccount, SBConnectAccountRequirements, SBConnectDashboardResponse, SBConnectOnboardingResponse, SBConnectedAccount, SBCoordinate, SBCreateCheckoutPaymentIntentResponse, SBCustomer, SBDepartment, SBDepartmentMember, SBDispute, SBDowngradeValidation, SBEmailAccount, SBEmailAccountAuthorizeResponse, SBEmailForwardingConfig, SBEmployee, SBEmployeeCategoryBreakdownReport, SBEmployeeDepartment, SBEmployeeLocation, SBEmployeeManager, SBEntity, SBExpenseBulkActionResponse, SBExpenseByCategoryReport, SBExpenseByDayReport, SBExpenseByEmployeeReport, SBExpenseByVendorReport, SBExpenseJob, SBExpenseMonthlySummary, SBExpenseOverTimeDataPoint, SBExpenseOverTimeReport, SBExpenseReport, SBExpenseReportAuditLogEntry, SBExpenseReportBulkActionResponse, SBExpenseReportComment, SBExpenseReportItem, SBExpenseReportSummary, SBExpenseReportTimelineEntry, SBExpenseValidateResponse, SBFileDownloadResponse, SBHistoricalSyncResponse, SBIntegration, SBIntegrationAuthorizeResponse, SBInvitation, SBInvoice, SBInvoiceCustomer, SBInvoiceLineItem, SBInvoiceLineItemTax, SBInvoicePayment, SBItemVariationRuleData, SBListResponse, SBLocation, SBLocationImage, SBLoyaltyProgram, SBLoyaltyRule, SBLoyaltyRuleBase, SBMailbox, SBMarketplaceApp, SBMembership, SBMembershipBusinessSummary, SBMembershipUserSummary, SBMerchantLedger, SBMoney, SBNotification, SBPagination, SBPaymentMethod, SBPaymentMethodBillingDetails, SBPaymentMethodSetupIntentResponse, SBPayout, SBPortalSession, SBProduct, SBProductImage, SBPromoCode, SBReceipt, SBReceiptBarcode, SBReceiptBusiness, SBReceiptCustomer, SBReceiptDiscount, SBReceiptDocument, SBReceiptFee, SBReceiptLineItem, SBReceiptPayment, SBReceiptPaymentCard, SBReceiptRefund, SBReceiptTax, SBReceiptTransaction, SBReceiptVendor, SBRefund, SBSessionTokenResponse, SBSetupIntent, SBSharedMailbox, SBSpendRuleData, SBSubscription, SBSyncSession, SBTable, SBTableColumn, SBTableRow, SBTax, SBTaxByCategoryReport, SBTaxByTypeReport, SBTaxByVendorReport, SBTaxSummaryReport, SBTimestamps, SBTransaction, SBTransactionAttachment, SBTransactionMerchant, SBTransactionTax, SBTransactionUploadResponse, SBTransactionVendor, SBUpcomingInvoice, SBUserAccount, SBValidateEmailResponse, SBValidateSharedMailboxResponse, SBVendor, SBVendorBulkActionResponse, SBVendorConnectResponse, SBVendorConnection, SBVendorImportResult, SBVisitRuleData, SBWorkflow, SBWorkflowCondition, SBWorkflowStep, SBWorkflowTestResponse, SmartbillsClientOptions, SmartbillsFieldError, SubmitDisputeEvidenceRequest, SyncSessionListRequest, TableCreateRequest, TableListRequest, TableUpdateRequest, TaxCreateRequest, TaxListRequest, TaxUpdateRequest, TransactionBatchUpdateRequest, TransactionCreateRequest, TransactionFeeRequest, TransactionLineItemRequest, TransactionMerchantRequest, TransactionTaxRequest, TransactionUpdateRequest, UpdateInstallationStatusRequest, UpdatePayoutScheduleRequest, UpgradeSubscriptionRequest, UsageHistoryRequest, UserUpdateRequest, VendorBatchUpdateRequest, VendorConnectRequest, VendorCreateRequest, VendorListRequest, VendorMergeRequest, VendorUpdateRequest, WorkflowCreateRequest, WorkflowListRequest, WorkflowTestRequest, WorkflowUpdateRequest };
8405
+ export { AccessToken, AppInstallationService, AppInstallationStatus, ApprobationService, AttachmentService, AuthorizedSenderService, BaseService, BillApprovalStatus, BillApprovalType, BillService, SBBillStatus as BillStatus, BillingService, BusinessService, BusinessUserService, CategoryService, ChargeStatus, CheckoutDocumentType, CheckoutPaymentStatus, CheckoutService, CheckoutStatus, ConnectAccountStatus, ConnectService, ConnectedAccountService, ConnectedAccountStatus, ConnectedAccountType, CreditNoteService, CustomerService, DEFAULT_BASE_URL, DepartmentService, DisputeEvidenceSlot, DisputeService, EmailAccountService, EmailAccountStatus, EmailAccountSyncStatus, EmailAccountType, EmailForwardingService, EmployeeService, ErrorCode, ExpenseItemStatus, ExpenseJobService, ExpenseJobStatus, ExpenseReportAuditLogAction, ExpenseReportExpenseService, ExpenseReportPaymentService, ExpenseReportService, ExpenseReportStatus, ExpenseService, ExpenseSplitType, HttpClient, IntegrationService, IntegrationStatus, InvitationService, InvitationStatus, InvoicePaymentService, InvoicePaymentStatus, InvoiceReminderFrequency, InvoiceReminderTiming, InvoiceService, LateFeeFrequency, LateFeeType, LocationService, LoyaltyService, MailboxType, MembershipRole, MembershipService, NotificationService, NotificationType, PayerType, PaymentIntentService, PaymentIntentStatus, PaymentMethodService, PaymentService, PaymentTerms, PayoutInterval, PayoutService, PayoutStatus, ProductService, PromoCodeService, ReceiptPaymentStatus, ReceiptPaymentType, ReceiptService, ReceiptSource, ReceiptType, ReportingService, SBBillStatus, SBInvoiceStatus, SBPaymentStatus, SmartbillsApiError, SmartbillsAuthenticationError, SmartbillsClient, SmartbillsConflictError, SmartbillsError, SmartbillsNetworkError, SmartbillsNotFoundError, SmartbillsPermissionError, SmartbillsQuotaError, SmartbillsRateLimitError, SmartbillsValidationError, StatementService, StatementStatus, SyncTriggerType, TableService, TaxService, TransactionService, TransactionType, UserService, VendorConnectionService, VendorConnectionStatus, VendorService, WorkflowService, WorkflowTriggerType, isApiError, isAuthenticationError, isConflictError, isNetworkError, isNotFoundError, isPermissionError, isQuotaError, isRateLimitError, isRetryableError, isSmartbillsError, isValidationError, uploadFileToS3, uploadFileUriToS3 };
8406
+ export type { AddExpenseToReportRequest, AddExpensesToReportBatchRequest, ApplyCustomerCreditRequest, ApprobationListRequest, AssociateExpenseReportUpdateRequest, AttachmentListRequest, AttachmentRenameRequest, BalanceAmount, BillApprovalRequest, BillBatchUpdateRequest, BillCancelRequest, BillCreateRequest, BillListRequest, BillMarkPaidRequest, BillReschedulePaymentRequest, BillRetryPaymentRequest, BillSchedulePaymentRequest, BillSubmitForApprovalRequest, BillTransitionRequest, BillUpdateRequest, BillingInvoiceListRequest, BulkApproveApprobationsRequest, BulkAssignCategoryRequest, BulkAssignExpenseReportRequest, BulkAssignPayerTypeRequest, BulkAssignReportCategoryRequest, BulkAssignVendorRequest, BulkBillApproveRequest, BulkBillCancelPaymentRequest, BulkBillDeleteRequest, BulkBillMarkPaidRequest, BulkBillRemindRequest, BulkBillRetryPaymentRequest, BulkBillSchedulePaymentRequest, BulkBillUnscheduleRequest, BulkBillUpdateRequest, BulkDeleteExpenseReportsRequest, BulkDeleteExpensesRequest, BulkDeleteVendorsRequest, BulkMarkReimbursedApprobationsRequest, BulkPlanReimbursementApprobationsRequest, BulkRecallExpenseReportsRequest, BulkRejectApprobationsRequest, BulkRemoveReportExpensesRequest, BulkRequestChangesApprobationsRequest, BulkRevertToReviewApprobationsRequest, BulkSetNoteRequest, BulkSubmitExpenseReportsRequest, BusinessBatchUpdateRequest, BusinessBrandCreateRequest, BusinessBrandUpdateRequest, BusinessCreateRequest, BusinessUpdateRequest, CategoryCreateRequest, CategoryListRequest, CategoryUpdateRequest, CheckoutLineItem, ConfirmUploadFileRequest, ConfirmUploadRequest, ConnectOnboardingRequest, ConnectedAccountBankAccount, ConnectedAccountFees, ConnectedAccountLateFeeSettings, ConnectedAccountLateFeeSettingsRequest, ConnectedAccountOnboardingRequest, ConnectedAccountOnboardingResult, ConnectedAccountProcessing, ConnectedAccountRequirements, ConnectedAccountSettings, ConnectedAccountSettingsRequest, CreateAuthorizedSenderRequest, CreateCheckoutPaymentIntentRequest, CreatePaymentMethodRequest, CreatePayoutRequest, CreatePortalSessionRequest, CredentialProvider, CreditNoteCreateRequest, CreditNoteLineItemRequest, CreditNoteReason, CreditNoteStatus, CreditNoteType, CustomerCreateRequest, CustomerCreditBalance, CustomerCreditLedgerEntry, CustomerCreditLedgerSource, CustomerListRequest, CustomerUpdateRequest, DepartmentCreateRequest, DepartmentListRequest, DepartmentUpdateRequest, DisputeEvidenceFinalizeRequest, DisputeEvidenceFinalizeResponse, DisputeEvidenceRequest, DisputeEvidenceUploadUrlRequest, DisputeEvidenceUploadUrlResponse, DisputeListRequest, EditExpenseInReportRequest, EmailAccountImapCreateRequest, EmailAccountListRequest, EmailAccountOAuth2CreateRequest, EmailAccountUpdateRequest, EmailForwardingConfigRequest, EmployeeBulkAssignManagerRequest, EmployeeCreateRequest, EmployeeListRequest, EmployeeSetManagerRequest, EmployeeUpdateRequest, ErrorCodeType, ExpenseAttachmentDownloadRequest, ExpenseCategoryUpdateRequest, ExpenseExportRequest, ExpenseJobListRequest, ExpenseListRequest, ExpenseNoteUpdateRequest, ExpenseOverTimeRequest, ExpensePayerTypeUpdateRequest, ExpenseReportApproveRequest, ExpenseReportAssignLedgerAccountRequest, ExpenseReportCommentCreateRequest, ExpenseReportCreateRequest, ExpenseReportExportRequest, ExpenseReportListRequest, ExpenseReportPartialReimburseRequest, ExpenseReportPlanReimbursementRequest, ExpenseReportRecallRequest, ExpenseReportReimburseRequest, ExpenseReportRejectRequest, ExpenseReportRequestChangesRequest, ExpenseReportUpdateRequest, ExpenseReviewUpdateRequest, ExpenseSplitItem, ExpenseSplitLineItem, ExpenseSplitRequest, FeeConfigurationRequest, HistoricalSyncRequest, HttpClientConfig, IntegrationCallbackRequest, IntegrationListRequest, InvitationCreateRequest, InvitationListRequest, InvoiceCreateRequest, InvoiceDiscountCreateRequest, InvoiceFeeCreateRequest, InvoiceListRequest, InvoicePaymentCreateRequest, InvoicePaymentFilterRequest, InvoiceReminder, InvoiceSummary, InvoiceUpdateRequest, LedgerEntry, LedgerSummary, LocationBatchCreateRequest, LocationBatchUpdateRequest, LocationCreateRequest, LocationImageUrlRequest, LocationListRequest, LocationUpdateRequest, LoyaltyProgramCreateRequest, LoyaltyProgramListRequest, LoyaltyProgramStatus, LoyaltyProgramUpdateRequest, LoyaltyRewardType, LoyaltyRuleType, MailboxUpdateRequest, MembershipCreateRequest, MembershipEmailInviteRequest, MembershipListRequest, MembershipRoleUpdateRequest, NextInvoiceNumberResponse, NotificationListRequest, PagedResult, PaginateBusinessRequest, PaginateTransactionRequest, PaginationRequest, PaymentIntentListRequest, PaymentListRequest, PaymentMethodListRequest, Payout, PayoutListRequest, PayoutListResponse, PayoutSchedule, PresignedUploadFileRequest, PresignedUploadFileResponse, PresignedUploadRequest, PresignedUploadResponse, PreviewPlanChangeRequest, ProductCreateRequest, ProductListRequest, ProductUpdateRequest, PublicInvoiceCustomer, PublicInvoiceLineItem, PublicInvoiceMerchant, PublicInvoiceMerchantRating, PublicInvoiceMerchantSocial, PublicInvoicePayment, PublicInvoicePaymentCardSnippet, PublicInvoiceResponse, ReceiptCreateRequest, ReceiptListRequest, ReceiptOCRCreateRequest, ReceiptUpdateRequest, RefundCheckoutPaymentRequest, RefundCreateRequest, ReportDateRange, ReportingRequest, RequestOptions, SBAddress, SBAppInstallation, SBApprobationSummary, SBAttachment, SBAuthorizedSender, SBBalance, SBBatchResponse, SBBill, SBBillApproval, SBBillApprovalHistoryItem, SBBillAttachment, SBBillBulkActionResponse, SBBillEmployee, SBBillLineItem, SBBillStatusHistoryItem, SBBillStatusSummary, SBBillTax, SBBillTransitionResponse, SBBillVendor, SBBillVendorAccount, SBBillingAddress, SBBillingInvoice, SBBillingInvoiceLine, SBBillingPaymentMethod, SBBillingPlan, SBBillingUsage, SBBulkActionResponse, SBBulkActionResult, SBBusiness, SBBusinessBrand, SBBusinessPlan, SBCategory, SBCategoryRuleData, SBCharge, SBCheckoutLineItem, SBCheckoutPayment, SBCheckoutPaymentDispute, SBCheckoutPaymentRefund, SBCheckoutTax, SBCheckoutTransactionResponse, SBConnectAccount, SBConnectAccountRequirements, SBConnectDashboardResponse, SBConnectOnboardingResponse, SBConnectedAccount, SBCoordinate, SBCreateCheckoutPaymentIntentResponse, SBCreditNote, SBCreditNoteLineItem, SBCustomer, SBDepartment, SBDepartmentMember, SBDispute, SBDisputeListResponse, SBDisputeStats, SBDowngradeValidation, SBEmailAccount, SBEmailAccountAuthorizeResponse, SBEmailForwardingConfig, SBEmployee, SBEmployeeCategoryBreakdownReport, SBEmployeeDepartment, SBEmployeeLocation, SBEmployeeManager, SBEntity, SBExpenseBulkActionResponse, SBExpenseByCategoryReport, SBExpenseByDayReport, SBExpenseByEmployeeReport, SBExpenseByVendorReport, SBExpenseJob, SBExpenseMonthlySummary, SBExpenseOverTimeDataPoint, SBExpenseOverTimeReport, SBExpenseReport, SBExpenseReportAuditLogEntry, SBExpenseReportBulkActionResponse, SBExpenseReportComment, SBExpenseReportItem, SBExpenseReportSummary, SBExpenseReportTimelineEntry, SBExpenseValidateResponse, SBFileDownloadResponse, SBHistoricalSyncResponse, SBIntegration, SBIntegrationAuthorizeResponse, SBInvitation, SBInvoice, SBInvoiceCustomer, SBInvoiceEmployee, SBInvoiceLineItem, SBInvoiceLineItemTax, SBInvoiceMerchant, SBInvoicePayment, SBInvoiceRecurring, SBInvoiceStripeLinks, SBItemVariationRuleData, SBListResponse, SBLocation, SBLocationImage, SBLoyaltyProgram, SBLoyaltyRule, SBLoyaltyRuleBase, SBMailbox, SBMarketplaceApp, SBMembership, SBMembershipBusinessSummary, SBMembershipUserSummary, SBMerchantLedger, SBMoney, SBNotification, SBPagination, SBPayment, SBPaymentCardSnippet, SBPaymentExternalSnippet, SBPaymentIntent, SBPaymentIntentSummary, SBPaymentMethod, SBPaymentMethodBankAccountInfo, SBPaymentMethodBillingDetails, SBPaymentMethodCardInfo, SBPaymentMethodInfo, SBPaymentMethodSetupIntentResponse, SBPayout, SBPlanChangePreview, SBPlanChangePreviewLineItem, SBPortalSession, SBProduct, SBProductImage, SBPromoCode, SBReceipt, SBReceiptBarcode, SBReceiptBusiness, SBReceiptCustomer, SBReceiptDiscount, SBReceiptDocument, SBReceiptFee, SBReceiptLineItem, SBReceiptPayment, SBReceiptPaymentCard, SBReceiptRefund, SBReceiptTax, SBReceiptTransaction, SBReceiptVendor, SBRefund, SBSessionTokenResponse, SBSetupIntent, SBSharedMailbox, SBSpendRuleData, SBStatement, SBSubscription, SBSyncSession, SBTable, SBTableColumn, SBTableRow, SBTax, SBTaxByCategoryReport, SBTaxByTypeReport, SBTaxByVendorReport, SBTaxSummaryReport, SBTimestamps, SBTransaction, SBTransactionAttachment, SBTransactionMerchant, SBTransactionTax, SBTransactionUploadResponse, SBTransactionVendor, SBUpcomingInvoice, SBUserAccount, SBValidateEmailResponse, SBValidateSharedMailboxResponse, SBVendor, SBVendorBulkActionResponse, SBVendorConnectResponse, SBVendorConnection, SBVendorImportResult, SBVisitRuleData, SBWorkflow, SBWorkflowCondition, SBWorkflowStep, SBWorkflowTestResponse, SmartbillsClientOptions, SmartbillsFieldError, StatementListRequest, StatementListResponse, SubmitDisputeEvidenceRequest, SyncSessionListRequest, TableCreateRequest, TableListRequest, TableUpdateRequest, TaxCreateRequest, TaxListRequest, TaxUpdateRequest, TransactionBatchUpdateRequest, TransactionCreateRequest, TransactionFeeRequest, TransactionLineItemRequest, TransactionMerchantRequest, TransactionTaxRequest, TransactionUpdateRequest, UpdateInstallationStatusRequest, UpdatePayoutScheduleRequest, UpgradeSubscriptionRequest, UsageHistoryRequest, UserUpdateRequest, VendorBatchUpdateRequest, VendorConnectRequest, VendorCreateRequest, VendorListRequest, VendorMergeRequest, VendorUpdateRequest, WorkflowCreateRequest, WorkflowListRequest, WorkflowTestRequest, WorkflowUpdateRequest };