@delopay/sdk 0.31.0 → 0.33.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/dist/index.cjs CHANGED
@@ -2594,55 +2594,85 @@ var Subscriptions = class {
2594
2594
  constructor(request) {
2595
2595
  this.request = request;
2596
2596
  }
2597
- /** Create and immediately confirm a subscription. `POST /subscriptions` */
2598
- async createAndConfirm(params) {
2599
- return this.request("POST", "/subscriptions", { body: params });
2597
+ /**
2598
+ * Create and immediately confirm a subscription. `POST /subscriptions`
2599
+ *
2600
+ * For billing processors that require buyer approval (e.g. PayPal), the
2601
+ * response carries a `redirect_url` the customer must be sent to.
2602
+ */
2603
+ async createAndConfirm(params, options) {
2604
+ return this.request("POST", "/subscriptions", { body: params, ...options });
2600
2605
  }
2601
- /** Create a subscription (without confirming). `POST /subscriptions/create` */
2602
- async create(params) {
2603
- return this.request("POST", "/subscriptions/create", { body: params });
2606
+ /** Create a subscription without confirming it. `POST /subscriptions/create` */
2607
+ async create(params, options) {
2608
+ return this.request("POST", "/subscriptions/create", { body: params, ...options });
2604
2609
  }
2605
2610
  /** Retrieve a subscription by ID. `GET /subscriptions/{subscriptionId}` */
2606
- async retrieve(subscriptionId) {
2607
- return this.request("GET", `/subscriptions/${encodeURIComponent(subscriptionId)}`);
2611
+ async retrieve(subscriptionId, options) {
2612
+ return this.request("GET", `/subscriptions/${encodeURIComponent(subscriptionId)}`, {
2613
+ ...options
2614
+ });
2608
2615
  }
2609
- /** Confirm a subscription. `POST /subscriptions/{subscriptionId}/confirm` */
2610
- async confirm(subscriptionId, params) {
2616
+ /**
2617
+ * Confirm a previously created subscription. `POST /subscriptions/{subscriptionId}/confirm`
2618
+ *
2619
+ * Like {@link createAndConfirm}, the response may carry a `redirect_url` for
2620
+ * processors that require buyer approval.
2621
+ */
2622
+ async confirm(subscriptionId, params, options) {
2611
2623
  return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/confirm`, {
2612
- body: params
2624
+ body: params,
2625
+ ...options
2613
2626
  });
2614
2627
  }
2615
- /** Update a subscription. `PUT /subscriptions/{subscriptionId}/update` */
2616
- async update(subscriptionId, params) {
2628
+ /** Update a subscription's plan/price. `PUT /subscriptions/{subscriptionId}/update` */
2629
+ async update(subscriptionId, params, options) {
2617
2630
  return this.request("PUT", `/subscriptions/${encodeURIComponent(subscriptionId)}/update`, {
2618
- body: params
2631
+ body: params,
2632
+ ...options
2619
2633
  });
2620
2634
  }
2621
- /** List subscriptions. `GET /subscriptions/list` */
2622
- async list(params) {
2635
+ /** List subscriptions for the profile. `GET /subscriptions/list` */
2636
+ async list(params, options) {
2623
2637
  return this.request("GET", "/subscriptions/list", {
2624
- query: params
2638
+ query: params,
2639
+ ...options
2625
2640
  });
2626
2641
  }
2627
- /** Get subscription estimate. `GET /subscriptions/estimate` */
2628
- async getEstimate(params) {
2629
- return this.request("GET", "/subscriptions/estimate", { query: params });
2642
+ /** Estimate the cost of a subscription before creating it. `GET /subscriptions/estimate` */
2643
+ async getEstimate(params, options) {
2644
+ return this.request("GET", "/subscriptions/estimate", {
2645
+ query: params,
2646
+ ...options
2647
+ });
2630
2648
  }
2631
- /** Get subscription items. `GET /subscriptions/items` */
2632
- async getItems(params) {
2633
- return this.request("GET", "/subscriptions/items", { query: params });
2649
+ /** List purchasable subscription items (plans/addons). `GET /subscriptions/items` */
2650
+ async getItems(params, options) {
2651
+ return this.request("GET", "/subscriptions/items", {
2652
+ query: params,
2653
+ ...options
2654
+ });
2634
2655
  }
2635
2656
  /** Pause a subscription. `POST /subscriptions/{subscriptionId}/pause` */
2636
- async pause(subscriptionId) {
2637
- return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/pause`);
2657
+ async pause(subscriptionId, params, options) {
2658
+ return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/pause`, {
2659
+ body: params,
2660
+ ...options
2661
+ });
2638
2662
  }
2639
- /** Resume a subscription. `POST /subscriptions/{subscriptionId}/resume` */
2640
- async resume(subscriptionId) {
2641
- return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/resume`);
2663
+ /** Resume a paused subscription. `POST /subscriptions/{subscriptionId}/resume` */
2664
+ async resume(subscriptionId, params, options) {
2665
+ return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/resume`, {
2666
+ body: params,
2667
+ ...options
2668
+ });
2642
2669
  }
2643
2670
  /** Cancel a subscription. `POST /subscriptions/{subscriptionId}/cancel` */
2644
- async cancel(subscriptionId) {
2645
- return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`);
2671
+ async cancel(subscriptionId, params, options) {
2672
+ return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {
2673
+ body: params,
2674
+ ...options
2675
+ });
2646
2676
  }
2647
2677
  };
2648
2678