@delopay/sdk 0.235.0 → 0.238.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.
@@ -2963,6 +2963,44 @@ var Refunds = class {
2963
2963
  return this.request("POST", "/refunds/list", { body: params });
2964
2964
  }
2965
2965
  // --- OLAP extensions (Task 4.3) ---
2966
+ /**
2967
+ * Refund requests buyers raised from the customer portal, newest first.
2968
+ * Limited to the caller's shop when the caller is scoped to one.
2969
+ * `GET /refund-requests`
2970
+ */
2971
+ async listRequests(params) {
2972
+ return this.request("GET", "/refund-requests", {
2973
+ query: params
2974
+ });
2975
+ }
2976
+ /**
2977
+ * Approve a buyer's refund request with a refund of its payment that has
2978
+ * succeeded, made with `create()` after the buyer asked. Approving records
2979
+ * the decision and moves no money. A refund that is still `pending` or in
2980
+ * `review` is refused: check it again later with `retrieve()` under the same
2981
+ * refund ID and approve once it has succeeded, rather than creating another
2982
+ * refund. `POST /refund-requests/{id}/approve`
2983
+ *
2984
+ * @example
2985
+ * ```typescript
2986
+ * const refund = await delopay.refunds.create({ payment_id: request.payment_id, amount: request.amount });
2987
+ * if (refund.status === 'succeeded') {
2988
+ * await delopay.refunds.approveRequest(request.id, { refund_id: refund.refund_id });
2989
+ * }
2990
+ * // Otherwise keep refund.refund_id, check it with retrieve() and approve once it has succeeded.
2991
+ * ```
2992
+ */
2993
+ async approveRequest(requestId, params) {
2994
+ return this.request("POST", `/refund-requests/${encodeURIComponent(requestId)}/approve`, {
2995
+ body: params
2996
+ });
2997
+ }
2998
+ /** Decline a buyer's refund request. The buyer sees the reply. `POST /refund-requests/{id}/decline` */
2999
+ async declineRequest(requestId, params) {
3000
+ return this.request("POST", `/refund-requests/${encodeURIComponent(requestId)}/decline`, {
3001
+ body: params
3002
+ });
3003
+ }
2966
3004
  /** List refunds (profile-scoped). `POST /refunds/profile/list` */
2967
3005
  async listByProfile(params) {
2968
3006
  return this.request("POST", "/refunds/profile/list", { body: params });
@@ -6727,6 +6765,29 @@ var BuyerPortal = class {
6727
6765
  async getSession(options) {
6728
6766
  return this.request("GET", "/buyer-portal/session", { ...options });
6729
6767
  }
6768
+ /** The buyer's contact and billing details, and what they may change. */
6769
+ async getProfile(options) {
6770
+ return this.request("GET", "/buyer-portal/profile", { ...options });
6771
+ }
6772
+ /**
6773
+ * Change the buyer's contact and billing details. Fields left out stay as
6774
+ * they are; the merchant decides whether buyers may change them at all.
6775
+ */
6776
+ async updateProfile(params, options) {
6777
+ return this.request("POST", "/buyer-portal/profile", { body: params, ...options });
6778
+ }
6779
+ /**
6780
+ * Ask the shop for a refund of one of the buyer's purchases, named by its
6781
+ * `id` from `listPurchases()`. Nothing is refunded until the shop approves
6782
+ * the request with a refund.
6783
+ */
6784
+ async createRefundRequest(purchaseId, params, options) {
6785
+ return this.request(
6786
+ "POST",
6787
+ `/buyer-portal/purchases/${encodeURIComponent(purchaseId)}/refund-requests`,
6788
+ { body: params, ...options }
6789
+ );
6790
+ }
6730
6791
  async listInvoices(params, options) {
6731
6792
  return this.request("GET", "/buyer-portal/invoices", {
6732
6793
  query: params,
@@ -12645,4 +12706,4 @@ export {
12645
12706
  decodeNativePanes,
12646
12707
  encodeNativePanes
12647
12708
  };
12648
- //# sourceMappingURL=chunk-FRH5BWGL.js.map
12709
+ //# sourceMappingURL=chunk-H7EC7OQF.js.map