@delopay/sdk 0.267.0 → 0.269.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
@@ -135,6 +135,7 @@ __export(index_exports, {
135
135
  SellToRestrictions: () => SellToRestrictions,
136
136
  Settings: () => Settings,
137
137
  Settlement: () => Settlement,
138
+ ShopLabels: () => ShopLabels,
138
139
  Subscriptions: () => Subscriptions,
139
140
  UNKNOWN_SECTION_ORDER: () => UNKNOWN_SECTION_ORDER,
140
141
  WCAG_AA_TEXT: () => WCAG_AA_TEXT,
@@ -2917,6 +2918,35 @@ var Payments = class {
2917
2918
  body: params
2918
2919
  });
2919
2920
  }
2921
+ /**
2922
+ * Abort a payment nobody has paid. The payment becomes `aborted`: its hosted
2923
+ * checkout stops taking payments, a confirm is refused, and it can no longer
2924
+ * be reactivated. Every processor object a buyer could still pay is closed
2925
+ * where the processor allows it, and a `payment_aborted` webhook is sent.
2926
+ *
2927
+ * A success the processor confirms later still moves the payment to
2928
+ * `succeeded`, so the order can be fulfilled or refunded. Aborting an
2929
+ * aborted payment returns it unchanged. A payment that took money, holds an
2930
+ * authorisation or awaits a merchant decision is refused with `IR_16`
2931
+ * (HTTP 400).
2932
+ *
2933
+ * `POST /payments/{paymentId}/abort`
2934
+ *
2935
+ * @param paymentId - The payment intent ID to abort.
2936
+ * @param params - Optional `reason`, at most 255 characters, stored as the
2937
+ * attempt's cancellation reason (`merchant_aborted` when absent).
2938
+ * @returns The payment, with status `aborted`.
2939
+ *
2940
+ * @example
2941
+ * ```typescript
2942
+ * const payment = await delopay.payments.abort('pay_123', { reason: 'order_cancelled' });
2943
+ * ```
2944
+ */
2945
+ async abort(paymentId, params) {
2946
+ return this.request("POST", `/payments/${encodeURIComponent(paymentId)}/abort`, {
2947
+ body: params ?? {}
2948
+ });
2949
+ }
2920
2950
  /**
2921
2951
  * List payment intents, optionally filtered by customer or date range.
2922
2952
  *
@@ -5926,6 +5956,63 @@ var BuyerBlocklist = class {
5926
5956
  }
5927
5957
  };
5928
5958
 
5959
+ // src/resources/shopLabels.ts
5960
+ var labelsPath = (merchantId) => `/account/${encodeURIComponent(merchantId)}/business-profile/labels`;
5961
+ var ShopLabels = class {
5962
+ constructor(request) {
5963
+ this.request = request;
5964
+ }
5965
+ /**
5966
+ * Every label of the merchant, ordered by name, each with the ids of the
5967
+ * shops that carry it. A shop with several labels appears under each of
5968
+ * them; a shop with none appears under no label. A caller limited to one
5969
+ * shop sees every label but only its own shop in `profile_ids`.
5970
+ * `GET /account/{merchantId}/business-profile/labels`
5971
+ */
5972
+ async list(merchantId) {
5973
+ return this.request("GET", labelsPath(merchantId));
5974
+ }
5975
+ /**
5976
+ * Create a label. The name is trimmed and inner whitespace collapsed; a
5977
+ * name that differs from an existing label only in letter case is refused
5978
+ * (`IR_38`), so one category is never spelled two ways. A merchant holds at
5979
+ * most 200 labels.
5980
+ * `POST /account/{merchantId}/business-profile/labels`
5981
+ */
5982
+ async create(merchantId, params) {
5983
+ return this.request("POST", labelsPath(merchantId), { body: params });
5984
+ }
5985
+ /**
5986
+ * Rename a label on every shop that carries it.
5987
+ * `PATCH /account/{merchantId}/business-profile/labels/{labelId}`
5988
+ */
5989
+ async update(merchantId, labelId, params) {
5990
+ return this.request("PATCH", `${labelsPath(merchantId)}/${encodeURIComponent(labelId)}`, {
5991
+ body: params
5992
+ });
5993
+ }
5994
+ /**
5995
+ * Delete a label and remove it from every shop. The shops are unchanged.
5996
+ * `DELETE /account/{merchantId}/business-profile/labels/{labelId}`
5997
+ */
5998
+ async delete(merchantId, labelId) {
5999
+ return this.request("DELETE", `${labelsPath(merchantId)}/${encodeURIComponent(labelId)}`);
6000
+ }
6001
+ /**
6002
+ * Replace the labels of one shop: `label_ids` is the complete set
6003
+ * afterwards, so a label left out is removed from the shop and an empty
6004
+ * list removes them all. At most 20 per shop.
6005
+ * `PUT /account/{merchantId}/business-profile/{profileId}/labels`
6006
+ */
6007
+ async setForShop(merchantId, profileId, params) {
6008
+ return this.request(
6009
+ "PUT",
6010
+ `/account/${encodeURIComponent(merchantId)}/business-profile/${encodeURIComponent(profileId)}/labels`,
6011
+ { body: params }
6012
+ );
6013
+ }
6014
+ };
6015
+
5929
6016
  // src/resources/buyerConversations.ts
5930
6017
  var BuyerConversations = class {
5931
6018
  constructor(request) {
@@ -9128,6 +9215,7 @@ var Delopay = class {
9128
9215
  this.availabilityOverrides = new AvailabilityOverrides(request);
9129
9216
  this.sellToRestrictions = new SellToRestrictions(request);
9130
9217
  this.buyerBlocklist = new BuyerBlocklist(request);
9218
+ this.shopLabels = new ShopLabels(request);
9131
9219
  this.buyerConversations = new BuyerConversations(request);
9132
9220
  this.buyerEvidence = new BuyerEvidenceReviews(request);
9133
9221
  this.checkoutRecovery = new CheckoutRecovery(request);
@@ -12915,15 +13003,11 @@ var CheckoutSession = class {
12915
13003
  });
12916
13004
  }
12917
13005
  /**
12918
- * The PayPal order for the payment's e-Payouts access code, from the PayPal
12919
- * SDK's `createOrder` on an experimental PayPal SDK pane — after the payment
12920
- * was confirmed through that pane, which mints the code.
12921
- *
12922
- * The router reads the order off e-Payouts' own PayPal page for the code, so
12923
- * `amount` and `currency` are what e-Payouts charges for it. Repeated calls
12924
- * answer the same order, so a cancelled PayPal popup is retried with the same
12925
- * code. When `captured` is `true` a capture was already reported: create no
12926
- * order and wait for the payment's status instead.
13006
+ * The PayPal order e-Payouts created for the payment, for the PayPal SDK's
13007
+ * `createOrder` on the PayPal Express or Pay with card pane, after the payment
13008
+ * was confirmed through that pane. Return `order_id` from `createOrder` and
13009
+ * send the buyer to `approve_url` once PayPal approved it; without an order,
13010
+ * or when PayPal's button cannot be drawn, send the buyer to `redirect_url`.
12927
13011
  *
12928
13012
  * `POST /payment-link/{merchantId}/{paymentId}/epayouts/paypal-order`
12929
13013
  */
@@ -14041,6 +14125,7 @@ var encodeNativePanes = encodePanes;
14041
14125
  SellToRestrictions,
14042
14126
  Settings,
14043
14127
  Settlement,
14128
+ ShopLabels,
14044
14129
  Subscriptions,
14045
14130
  UNKNOWN_SECTION_ORDER,
14046
14131
  WCAG_AA_TEXT,