@billkit-eu/sdk 0.7.1 → 0.8.1
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/CHANGELOG.md +23 -1
- package/README.md +6 -2
- package/dist/index.cjs +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -15
- package/dist/index.d.ts +66 -15
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/resources.ts +72 -13
- package/src/version.ts +1 -1
package/package.json
CHANGED
package/src/index.ts
CHANGED
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
|
-
|
|
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,8 +237,11 @@ export interface CreateProductParams extends IdempotencyOptions {
|
|
|
221
237
|
|
|
222
238
|
export interface UpdateProductParams extends IdempotencyOptions {
|
|
223
239
|
name?: string;
|
|
224
|
-
|
|
225
|
-
|
|
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;
|
|
242
|
+
/** `null` empties the list. 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. */
|
|
243
|
+
marketing_features?: string[] | null;
|
|
244
|
+
/** Replaces the stored object whole; send `{}` to empty it. */
|
|
226
245
|
metadata?: Record<string, string>;
|
|
227
246
|
/** Set false to stop selling a product without deleting history. */
|
|
228
247
|
active?: boolean;
|
|
@@ -254,6 +273,9 @@ export interface UpdateProductParams extends IdempotencyOptions {
|
|
|
254
273
|
* the price is still `"unspecified"` and never changed again, because
|
|
255
274
|
* flipping it would restate whether tax was inside or on top of an amount
|
|
256
275
|
* somebody has already paid.
|
|
276
|
+
*
|
|
277
|
+
* Only the two refund windows accept `null`, which clears the price's
|
|
278
|
+
* override. The API refuses a `null` on any other field here with a 400.
|
|
257
279
|
*/
|
|
258
280
|
export interface UpdatePriceParams extends IdempotencyOptions {
|
|
259
281
|
/** `false` withdraws the price from sale, `true` puts it back. */
|
|
@@ -266,9 +288,13 @@ export interface UpdatePriceParams extends IdempotencyOptions {
|
|
|
266
288
|
"creditcard" | "directdebit" | "ideal" | "eps" | "applepay" | "paypal" | (string & {})
|
|
267
289
|
>;
|
|
268
290
|
refund_on_cancel?: "none" | "full" | "prorated";
|
|
269
|
-
/**
|
|
270
|
-
|
|
271
|
-
|
|
291
|
+
/**
|
|
292
|
+
* `0` disables refunds for that charge type; `N > 0` is an N-day window.
|
|
293
|
+
* `null` drops the price's override. 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.
|
|
294
|
+
*/
|
|
295
|
+
refund_window_initial_days?: number | null;
|
|
296
|
+
/** As {@link UpdatePriceParams.refund_window_initial_days}, for renewals. */
|
|
297
|
+
refund_window_renewal_days?: number | null;
|
|
272
298
|
}
|
|
273
299
|
|
|
274
300
|
/**
|
|
@@ -604,7 +630,8 @@ export interface CreateWebhookEndpointParams extends IdempotencyOptions {
|
|
|
604
630
|
export interface UpdateWebhookEndpointParams extends IdempotencyOptions {
|
|
605
631
|
url?: string;
|
|
606
632
|
enabled_events?: string[];
|
|
607
|
-
|
|
633
|
+
/** 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. */
|
|
634
|
+
description?: string | null;
|
|
608
635
|
status?: string;
|
|
609
636
|
}
|
|
610
637
|
|
|
@@ -651,10 +678,14 @@ export interface CreateCouponParams extends IdempotencyOptions {
|
|
|
651
678
|
|
|
652
679
|
export interface UpdateCouponParams extends IdempotencyOptions {
|
|
653
680
|
active?: boolean;
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
681
|
+
/** `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. */
|
|
682
|
+
max_redemptions?: number | null;
|
|
683
|
+
/** 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. */
|
|
684
|
+
redeem_by?: number | null;
|
|
685
|
+
/** `null` lifts the price restriction. 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. */
|
|
686
|
+
applies_to_price_ids?: string[] | null;
|
|
687
|
+
/** `null` lifts the minimum. 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. */
|
|
688
|
+
min_amount_cents?: number | null;
|
|
658
689
|
}
|
|
659
690
|
|
|
660
691
|
export interface ValidateCouponParams {
|
|
@@ -682,7 +713,8 @@ export interface CreateTaxRateParams extends IdempotencyOptions {
|
|
|
682
713
|
|
|
683
714
|
export interface UpdateTaxRateParams extends IdempotencyOptions {
|
|
684
715
|
rate_basis_points?: number;
|
|
685
|
-
|
|
716
|
+
/** 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. */
|
|
717
|
+
display_name?: string | null;
|
|
686
718
|
inclusive?: boolean;
|
|
687
719
|
active?: boolean;
|
|
688
720
|
}
|
|
@@ -1096,6 +1128,20 @@ export class OneShotPayments extends BaseResource {
|
|
|
1096
1128
|
retrieve<T = unknown>(id: string): Promise<T> {
|
|
1097
1129
|
return this.get<T>(`/v1/checkout/one_shot/${p(id)}`);
|
|
1098
1130
|
}
|
|
1131
|
+
|
|
1132
|
+
/** List one-off charges, newest first. Filter by `customer_id` and `status`. */
|
|
1133
|
+
list<T = unknown>(params: OneShotPaymentsListParams = {}): Promise<ListResponseEnvelope<T>> {
|
|
1134
|
+
return this.get<ListResponseEnvelope<T>>("/v1/checkout/one_shot", params);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
iter<T = unknown>(
|
|
1138
|
+
options: { pageSize?: number; customer_id?: string; status?: string } = {},
|
|
1139
|
+
): AsyncIterableIterator<T> {
|
|
1140
|
+
return paginate<T>((page) => this.get("/v1/checkout/one_shot", page), {
|
|
1141
|
+
pageSize: options.pageSize,
|
|
1142
|
+
filters: { customer_id: options.customer_id, status: options.status },
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1099
1145
|
}
|
|
1100
1146
|
|
|
1101
1147
|
export class Subscriptions extends BaseResource {
|
|
@@ -1780,7 +1826,20 @@ export class AuditLogs extends BaseResource {
|
|
|
1780
1826
|
* refunds and disputes are separate flows.
|
|
1781
1827
|
*/
|
|
1782
1828
|
export class Payments extends BaseResource {
|
|
1783
|
-
/**
|
|
1829
|
+
/**
|
|
1830
|
+
* Expandable: `customer`, `subscription`, `refund_eligibility`. The last
|
|
1831
|
+
* is retrieve-only (`list` refuses it with a `400`) and attaches
|
|
1832
|
+
* `refund_eligibility: { object: "refund_eligibility", eligible,
|
|
1833
|
+
* amount_cents, currency, days_remaining, window_ends_at, reason }`:
|
|
1834
|
+
* whether `refunds.create` for the remaining balance would succeed now,
|
|
1835
|
+
* applying the refund window and the price's refund policy, which
|
|
1836
|
+
* `amount_refundable_cents` does not. When `eligible` is false, `reason`
|
|
1837
|
+
* is one of `not_paid`, `unrefundable_type`, `window_expired`,
|
|
1838
|
+
* `fully_refunded`, `disputed`, `operation_pending` or
|
|
1839
|
+
* `plan_change_pending` (a plan change is settling: the full balance
|
|
1840
|
+
* cannot be refunded yet, a partial refund still can); treat any other
|
|
1841
|
+
* value as "not refundable".
|
|
1842
|
+
*/
|
|
1784
1843
|
retrieve<T = unknown>(id: string, options: ExpandOptions = {}): Promise<T> {
|
|
1785
1844
|
return this.get<T>(`/v1/payments/${p(id)}`, options);
|
|
1786
1845
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.8.1";
|