@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/internal.cjs CHANGED
@@ -151,6 +151,7 @@ __export(internal_exports, {
151
151
  SellToRestrictions: () => SellToRestrictions,
152
152
  Settings: () => Settings,
153
153
  Settlement: () => Settlement,
154
+ ShopLabels: () => ShopLabels,
154
155
  Subscriptions: () => Subscriptions,
155
156
  UNKNOWN_SECTION_ORDER: () => UNKNOWN_SECTION_ORDER,
156
157
  WCAG_AA_TEXT: () => WCAG_AA_TEXT,
@@ -2933,6 +2934,35 @@ var Payments = class {
2933
2934
  body: params
2934
2935
  });
2935
2936
  }
2937
+ /**
2938
+ * Abort a payment nobody has paid. The payment becomes `aborted`: its hosted
2939
+ * checkout stops taking payments, a confirm is refused, and it can no longer
2940
+ * be reactivated. Every processor object a buyer could still pay is closed
2941
+ * where the processor allows it, and a `payment_aborted` webhook is sent.
2942
+ *
2943
+ * A success the processor confirms later still moves the payment to
2944
+ * `succeeded`, so the order can be fulfilled or refunded. Aborting an
2945
+ * aborted payment returns it unchanged. A payment that took money, holds an
2946
+ * authorisation or awaits a merchant decision is refused with `IR_16`
2947
+ * (HTTP 400).
2948
+ *
2949
+ * `POST /payments/{paymentId}/abort`
2950
+ *
2951
+ * @param paymentId - The payment intent ID to abort.
2952
+ * @param params - Optional `reason`, at most 255 characters, stored as the
2953
+ * attempt's cancellation reason (`merchant_aborted` when absent).
2954
+ * @returns The payment, with status `aborted`.
2955
+ *
2956
+ * @example
2957
+ * ```typescript
2958
+ * const payment = await delopay.payments.abort('pay_123', { reason: 'order_cancelled' });
2959
+ * ```
2960
+ */
2961
+ async abort(paymentId, params) {
2962
+ return this.request("POST", `/payments/${encodeURIComponent(paymentId)}/abort`, {
2963
+ body: params ?? {}
2964
+ });
2965
+ }
2936
2966
  /**
2937
2967
  * List payment intents, optionally filtered by customer or date range.
2938
2968
  *
@@ -5942,6 +5972,63 @@ var BuyerBlocklist = class {
5942
5972
  }
5943
5973
  };
5944
5974
 
5975
+ // src/resources/shopLabels.ts
5976
+ var labelsPath = (merchantId) => `/account/${encodeURIComponent(merchantId)}/business-profile/labels`;
5977
+ var ShopLabels = class {
5978
+ constructor(request) {
5979
+ this.request = request;
5980
+ }
5981
+ /**
5982
+ * Every label of the merchant, ordered by name, each with the ids of the
5983
+ * shops that carry it. A shop with several labels appears under each of
5984
+ * them; a shop with none appears under no label. A caller limited to one
5985
+ * shop sees every label but only its own shop in `profile_ids`.
5986
+ * `GET /account/{merchantId}/business-profile/labels`
5987
+ */
5988
+ async list(merchantId) {
5989
+ return this.request("GET", labelsPath(merchantId));
5990
+ }
5991
+ /**
5992
+ * Create a label. The name is trimmed and inner whitespace collapsed; a
5993
+ * name that differs from an existing label only in letter case is refused
5994
+ * (`IR_38`), so one category is never spelled two ways. A merchant holds at
5995
+ * most 200 labels.
5996
+ * `POST /account/{merchantId}/business-profile/labels`
5997
+ */
5998
+ async create(merchantId, params) {
5999
+ return this.request("POST", labelsPath(merchantId), { body: params });
6000
+ }
6001
+ /**
6002
+ * Rename a label on every shop that carries it.
6003
+ * `PATCH /account/{merchantId}/business-profile/labels/{labelId}`
6004
+ */
6005
+ async update(merchantId, labelId, params) {
6006
+ return this.request("PATCH", `${labelsPath(merchantId)}/${encodeURIComponent(labelId)}`, {
6007
+ body: params
6008
+ });
6009
+ }
6010
+ /**
6011
+ * Delete a label and remove it from every shop. The shops are unchanged.
6012
+ * `DELETE /account/{merchantId}/business-profile/labels/{labelId}`
6013
+ */
6014
+ async delete(merchantId, labelId) {
6015
+ return this.request("DELETE", `${labelsPath(merchantId)}/${encodeURIComponent(labelId)}`);
6016
+ }
6017
+ /**
6018
+ * Replace the labels of one shop: `label_ids` is the complete set
6019
+ * afterwards, so a label left out is removed from the shop and an empty
6020
+ * list removes them all. At most 20 per shop.
6021
+ * `PUT /account/{merchantId}/business-profile/{profileId}/labels`
6022
+ */
6023
+ async setForShop(merchantId, profileId, params) {
6024
+ return this.request(
6025
+ "PUT",
6026
+ `/account/${encodeURIComponent(merchantId)}/business-profile/${encodeURIComponent(profileId)}/labels`,
6027
+ { body: params }
6028
+ );
6029
+ }
6030
+ };
6031
+
5945
6032
  // src/resources/buyerConversations.ts
5946
6033
  var BuyerConversations = class {
5947
6034
  constructor(request) {
@@ -9144,6 +9231,7 @@ var Delopay = class {
9144
9231
  this.availabilityOverrides = new AvailabilityOverrides(request);
9145
9232
  this.sellToRestrictions = new SellToRestrictions(request);
9146
9233
  this.buyerBlocklist = new BuyerBlocklist(request);
9234
+ this.shopLabels = new ShopLabels(request);
9147
9235
  this.buyerConversations = new BuyerConversations(request);
9148
9236
  this.buyerEvidence = new BuyerEvidenceReviews(request);
9149
9237
  this.checkoutRecovery = new CheckoutRecovery(request);
@@ -12931,15 +13019,11 @@ var CheckoutSession = class {
12931
13019
  });
12932
13020
  }
12933
13021
  /**
12934
- * The PayPal order for the payment's e-Payouts access code, from the PayPal
12935
- * SDK's `createOrder` on an experimental PayPal SDK pane — after the payment
12936
- * was confirmed through that pane, which mints the code.
12937
- *
12938
- * The router reads the order off e-Payouts' own PayPal page for the code, so
12939
- * `amount` and `currency` are what e-Payouts charges for it. Repeated calls
12940
- * answer the same order, so a cancelled PayPal popup is retried with the same
12941
- * code. When `captured` is `true` a capture was already reported: create no
12942
- * order and wait for the payment's status instead.
13022
+ * The PayPal order e-Payouts created for the payment, for the PayPal SDK's
13023
+ * `createOrder` on the PayPal Express or Pay with card pane, after the payment
13024
+ * was confirmed through that pane. Return `order_id` from `createOrder` and
13025
+ * send the buyer to `approve_url` once PayPal approved it; without an order,
13026
+ * or when PayPal's button cannot be drawn, send the buyer to `redirect_url`.
12943
13027
  *
12944
13028
  * `POST /payment-link/{merchantId}/{paymentId}/epayouts/paypal-order`
12945
13029
  */
@@ -15778,6 +15862,7 @@ var DelopayInternal = class extends Delopay {
15778
15862
  SellToRestrictions,
15779
15863
  Settings,
15780
15864
  Settlement,
15865
+ ShopLabels,
15781
15866
  Subscriptions,
15782
15867
  UNKNOWN_SECTION_ORDER,
15783
15868
  WCAG_AA_TEXT,