@billkit-eu/sdk 0.4.0 → 0.6.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.4.0",
3
+ "version": "0.6.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
@@ -82,6 +82,7 @@ export type {
82
82
  CreateUsageRecordParams,
83
83
  CreateWebhookEndpointParams,
84
84
  CreditNotesListParams,
85
+ CustomerListParams,
85
86
  EventsListParams,
86
87
  IdempotencyOptions,
87
88
  ListParams,
package/src/resources.ts CHANGED
@@ -257,7 +257,9 @@ export interface CreatePriceParams extends IdempotencyOptions {
257
257
  metadata?: Record<string, string>;
258
258
  trial_days?: number;
259
259
  trial_verification_cents?: number;
260
- payment_methods?: Array<"creditcard" | "directdebit" | "ideal" | "applepay" | (string & {})>;
260
+ payment_methods?: Array<
261
+ "creditcard" | "directdebit" | "ideal" | "eps" | "applepay" | "paypal" | (string & {})
262
+ >;
261
263
  /**
262
264
  * What a cancellation refunds without being asked. `"none"` (the default)
263
265
  * nothing; `"full"` the whole last charge; `"prorated"` the unused part
@@ -371,8 +373,21 @@ export interface CreateCheckoutSessionParams extends IdempotencyOptions {
371
373
  * Pin the Mollie payment method. `undefined` lets Mollie pick from
372
374
  * the customer's available methods; when set, must be in the price's
373
375
  * `payment_methods` allowlist.
376
+ *
377
+ * Subscription-starting only, so this is deliberately NARROWER than the
378
+ * one-shot union: `bancontact` and `banktransfer` are absent because
379
+ * neither can mint the mandate a renewal needs. Mollie refuses the
380
+ * latter outright with "The payment method does not support sequence
381
+ * type".
374
382
  */
375
- method?: "creditcard" | "directdebit" | "ideal" | "applepay" | (string & {});
383
+ method?:
384
+ | "creditcard"
385
+ | "directdebit"
386
+ | "ideal"
387
+ | "eps"
388
+ | "applepay"
389
+ | "paypal"
390
+ | (string & {});
376
391
  /** Optional coupon code applied at checkout; atomically claimed. */
377
392
  coupon_code?: string;
378
393
  /**
@@ -430,8 +445,12 @@ export interface CreateOneShotPaymentParams extends IdempotencyOptions {
430
445
  /**
431
446
  * Concrete Mollie method to charge with. Required, because a one-shot commits
432
447
  * up front). Validated against the tenant's capability allowlist for
433
- * `currency`; one-off methods like `bancontact`/`eps` are allowed here
434
- * even though they can't back a subscription.
448
+ * `currency`; one-off methods like `bancontact` and `banktransfer` are
449
+ * allowed here even though they can't back a subscription.
450
+ *
451
+ * `banktransfer` settles in DAYS, not seconds: the payer is handed bank
452
+ * details and Mollie holds the payment `open` for about a fortnight. Expect
453
+ * `one_shot_payment.paid` long after the call returns.
435
454
  *
436
455
  * `giropay` was removed: the scheme shut down at the end of 2024 and the
437
456
  * server now 422s it. The `(string & {})` tail keeps this open on
@@ -446,6 +465,8 @@ export interface CreateOneShotPaymentParams extends IdempotencyOptions {
446
465
  | "bancontact"
447
466
  | "eps"
448
467
  | "applepay"
468
+ | "paypal"
469
+ | "banktransfer"
449
470
  | (string & {});
450
471
  /** Where Mollie returns the payer after the hosted checkout. */
451
472
  success_url: string;
@@ -560,9 +581,18 @@ export interface UpdateTaxRateParams extends IdempotencyOptions {
560
581
  active?: boolean;
561
582
  }
562
583
 
584
+ /**
585
+ * `auditLogs.list` params. All four filters match exactly and combine.
586
+ *
587
+ * `resource_type` narrows to a kind (`"customer"`, `"price"`);
588
+ * `resource_id` narrows to one row, which is the "everything that ever
589
+ * happened to this customer" question an audit log mostly exists for.
590
+ * Pair them or use `resource_id` alone — ids are already unique.
591
+ */
563
592
  export interface AuditLogsListParams extends BaseListParams {
564
593
  action?: string;
565
594
  resource_type?: string;
595
+ resource_id?: string;
566
596
  actor_id?: string;
567
597
  }
568
598
 
@@ -1167,10 +1197,25 @@ export class WebhookEndpoints extends BaseResource {
1167
1197
  }
1168
1198
 
1169
1199
  /** Fetch one delivery row for inspection before deciding to redeliver. */
1170
- getDelivery<T = unknown>(endpointId: string, deliveryId: string): Promise<T> {
1200
+ retrieveDelivery<T = unknown>(endpointId: string, deliveryId: string): Promise<T> {
1171
1201
  return this.get<T>(`/v1/webhook_endpoints/${endpointId}/deliveries/${deliveryId}`);
1172
1202
  }
1173
1203
 
1204
+ /**
1205
+ * @deprecated Renamed to {@link WebhookEndpoints.retrieveDelivery}.
1206
+ *
1207
+ * Every other single-row fetch in every BillKit SDK is `retrieve`; this
1208
+ * one method was `get`, which meant reaching for the obvious name and
1209
+ * getting a type error. The python and php clients already spell it
1210
+ * `retrieve_delivery` / `retrieveDelivery`, so node was the outlier.
1211
+ *
1212
+ * Kept as an alias because removing it would break callers for a naming
1213
+ * preference. It will go in the next major.
1214
+ */
1215
+ getDelivery<T = unknown>(endpointId: string, deliveryId: string): Promise<T> {
1216
+ return this.retrieveDelivery<T>(endpointId, deliveryId);
1217
+ }
1218
+
1174
1219
  /**
1175
1220
  * Re-enqueue a delivery row for the dispatcher.
1176
1221
  *
@@ -1447,13 +1492,20 @@ export class AuditLogs extends BaseResource {
1447
1492
  }
1448
1493
 
1449
1494
  iter<T = unknown>(
1450
- options: { pageSize?: number; action?: string; resource_type?: string; actor_id?: string } = {},
1495
+ options: {
1496
+ pageSize?: number;
1497
+ action?: string;
1498
+ resource_type?: string;
1499
+ resource_id?: string;
1500
+ actor_id?: string;
1501
+ } = {},
1451
1502
  ): AsyncIterableIterator<T> {
1452
1503
  return paginate<T>((p) => this.get("/v1/audit_logs", p), {
1453
1504
  pageSize: options.pageSize,
1454
1505
  filters: {
1455
1506
  action: options.action,
1456
1507
  resource_type: options.resource_type,
1508
+ resource_id: options.resource_id,
1457
1509
  actor_id: options.actor_id,
1458
1510
  },
1459
1511
  });
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.4.0";
1
+ export const VERSION = "0.6.0";