@billkit-eu/sdk 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@billkit-eu/sdk",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Official Node.js SDK for BillKit: a Stripe-Billing-shape multi-tenant SaaS API on Mollie.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
package/src/index.ts CHANGED
@@ -90,6 +90,7 @@ export type {
90
90
  IdempotencyOptions,
91
91
  InvoicesListParams,
92
92
  ListParams,
93
+ OneShotPaymentsListParams,
93
94
  PaymentsListParams,
94
95
  PriceTier,
95
96
  PricesListParams,
package/src/resources.ts CHANGED
@@ -71,6 +71,21 @@ export interface PaymentsListParams extends BaseListParams {
71
71
  expand?: string[];
72
72
  }
73
73
 
74
+ /**
75
+ * `oneShotPayments.list` params. `payments.list` lists subscription
76
+ * payments only; one-off charges are listed here, newest first.
77
+ * Failed, expired and still-open charges are included, so check `status`
78
+ * before counting a row as revenue.
79
+ */
80
+ export interface OneShotPaymentsListParams extends BaseListParams {
81
+ customer_id?: string;
82
+ /**
83
+ * One of `open`, `pending`, `authorized`, `paid`, `failed`, `expired`,
84
+ * `canceled`, `refunded`. Anything else is a `400` on `status`.
85
+ */
86
+ status?: string;
87
+ }
88
+
74
89
  /**
75
90
  * `invoices.list` params. The three id filters each narrow to one row's
76
91
  * worth of invoices: `payment_id` answers "which invoice did this charge
@@ -152,7 +167,8 @@ export interface CreateCustomerParams extends IdempotencyOptions {
152
167
 
153
168
  export interface UpdateCustomerParams extends IdempotencyOptions {
154
169
  email?: string;
155
- name?: string;
170
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
171
+ name?: string | null;
156
172
  country_code?: string;
157
173
  metadata?: Record<string, string>;
158
174
  }
@@ -221,7 +237,8 @@ export interface CreateProductParams extends IdempotencyOptions {
221
237
 
222
238
  export interface UpdateProductParams extends IdempotencyOptions {
223
239
  name?: string;
224
- description?: string;
240
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
241
+ description?: string | null;
225
242
  marketing_features?: string[];
226
243
  metadata?: Record<string, string>;
227
244
  /** Set false to stop selling a product without deleting history. */
@@ -604,7 +621,8 @@ export interface CreateWebhookEndpointParams extends IdempotencyOptions {
604
621
  export interface UpdateWebhookEndpointParams extends IdempotencyOptions {
605
622
  url?: string;
606
623
  enabled_events?: string[];
607
- description?: string;
624
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
625
+ description?: string | null;
608
626
  status?: string;
609
627
  }
610
628
 
@@ -651,8 +669,10 @@ export interface CreateCouponParams extends IdempotencyOptions {
651
669
 
652
670
  export interface UpdateCouponParams extends IdempotencyOptions {
653
671
  active?: boolean;
654
- max_redemptions?: number;
655
- redeem_by?: number;
672
+ /** `null` removes the redemption cap. An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
673
+ max_redemptions?: number | null;
674
+ /** Epoch seconds. `null` removes the expiry. An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
675
+ redeem_by?: number | null;
656
676
  applies_to_price_ids?: string[];
657
677
  min_amount_cents?: number;
658
678
  }
@@ -682,7 +702,8 @@ export interface CreateTaxRateParams extends IdempotencyOptions {
682
702
 
683
703
  export interface UpdateTaxRateParams extends IdempotencyOptions {
684
704
  rate_basis_points?: number;
685
- display_name?: string;
705
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
706
+ display_name?: string | null;
686
707
  inclusive?: boolean;
687
708
  active?: boolean;
688
709
  }
@@ -1096,6 +1117,20 @@ export class OneShotPayments extends BaseResource {
1096
1117
  retrieve<T = unknown>(id: string): Promise<T> {
1097
1118
  return this.get<T>(`/v1/checkout/one_shot/${p(id)}`);
1098
1119
  }
1120
+
1121
+ /** List one-off charges, newest first. Filter by `customer_id` and `status`. */
1122
+ list<T = unknown>(params: OneShotPaymentsListParams = {}): Promise<ListResponseEnvelope<T>> {
1123
+ return this.get<ListResponseEnvelope<T>>("/v1/checkout/one_shot", params);
1124
+ }
1125
+
1126
+ iter<T = unknown>(
1127
+ options: { pageSize?: number; customer_id?: string; status?: string } = {},
1128
+ ): AsyncIterableIterator<T> {
1129
+ return paginate<T>((page) => this.get("/v1/checkout/one_shot", page), {
1130
+ pageSize: options.pageSize,
1131
+ filters: { customer_id: options.customer_id, status: options.status },
1132
+ });
1133
+ }
1099
1134
  }
1100
1135
 
1101
1136
  export class Subscriptions extends BaseResource {
@@ -1780,7 +1815,20 @@ export class AuditLogs extends BaseResource {
1780
1815
  * refunds and disputes are separate flows.
1781
1816
  */
1782
1817
  export class Payments extends BaseResource {
1783
- /** Expandable: `customer`, `subscription`. */
1818
+ /**
1819
+ * Expandable: `customer`, `subscription`, `refund_eligibility`. The last
1820
+ * is retrieve-only (`list` refuses it with a `400`) and attaches
1821
+ * `refund_eligibility: { object: "refund_eligibility", eligible,
1822
+ * amount_cents, currency, days_remaining, window_ends_at, reason }`:
1823
+ * whether `refunds.create` for the remaining balance would succeed now,
1824
+ * applying the refund window and the price's refund policy, which
1825
+ * `amount_refundable_cents` does not. When `eligible` is false, `reason`
1826
+ * is one of `not_paid`, `unrefundable_type`, `window_expired`,
1827
+ * `fully_refunded`, `disputed`, `operation_pending` or
1828
+ * `plan_change_pending` (a plan change is settling: the full balance
1829
+ * cannot be refunded yet, a partial refund still can); treat any other
1830
+ * value as "not refundable".
1831
+ */
1784
1832
  retrieve<T = unknown>(id: string, options: ExpandOptions = {}): Promise<T> {
1785
1833
  return this.get<T>(`/v1/payments/${p(id)}`, options);
1786
1834
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.7.1";
1
+ export const VERSION = "0.8.0";