@delopay/sdk 0.267.0 → 0.270.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.
@@ -2640,6 +2640,35 @@ var Payments = class {
2640
2640
  body: params
2641
2641
  });
2642
2642
  }
2643
+ /**
2644
+ * Abort a payment nobody has paid. The payment becomes `aborted`: its hosted
2645
+ * checkout stops taking payments, a confirm is refused, and it can no longer
2646
+ * be reactivated. Every processor object a buyer could still pay is closed
2647
+ * where the processor allows it, and a `payment_aborted` webhook is sent.
2648
+ *
2649
+ * A success the processor confirms later still moves the payment to
2650
+ * `succeeded`, so the order can be fulfilled or refunded. Aborting an
2651
+ * aborted payment returns it unchanged. A payment that took money, holds an
2652
+ * authorisation or awaits a merchant decision is refused with `IR_16`
2653
+ * (HTTP 400).
2654
+ *
2655
+ * `POST /payments/{paymentId}/abort`
2656
+ *
2657
+ * @param paymentId - The payment intent ID to abort.
2658
+ * @param params - Optional `reason`, at most 255 characters, stored as the
2659
+ * attempt's cancellation reason (`merchant_aborted` when absent).
2660
+ * @returns The payment, with status `aborted`.
2661
+ *
2662
+ * @example
2663
+ * ```typescript
2664
+ * const payment = await delopay.payments.abort('pay_123', { reason: 'order_cancelled' });
2665
+ * ```
2666
+ */
2667
+ async abort(paymentId, params) {
2668
+ return this.request("POST", `/payments/${encodeURIComponent(paymentId)}/abort`, {
2669
+ body: params ?? {}
2670
+ });
2671
+ }
2643
2672
  /**
2644
2673
  * List payment intents, optionally filtered by customer or date range.
2645
2674
  *
@@ -5649,6 +5678,63 @@ var BuyerBlocklist = class {
5649
5678
  }
5650
5679
  };
5651
5680
 
5681
+ // src/resources/shopLabels.ts
5682
+ var labelsPath = (merchantId) => `/account/${encodeURIComponent(merchantId)}/business-profile/labels`;
5683
+ var ShopLabels = class {
5684
+ constructor(request) {
5685
+ this.request = request;
5686
+ }
5687
+ /**
5688
+ * Every label of the merchant, ordered by name, each with the ids of the
5689
+ * shops that carry it. A shop with several labels appears under each of
5690
+ * them; a shop with none appears under no label. A caller limited to one
5691
+ * shop sees every label but only its own shop in `profile_ids`.
5692
+ * `GET /account/{merchantId}/business-profile/labels`
5693
+ */
5694
+ async list(merchantId) {
5695
+ return this.request("GET", labelsPath(merchantId));
5696
+ }
5697
+ /**
5698
+ * Create a label. The name is trimmed and inner whitespace collapsed; a
5699
+ * name that differs from an existing label only in letter case is refused
5700
+ * (`IR_38`), so one category is never spelled two ways. A merchant holds at
5701
+ * most 200 labels.
5702
+ * `POST /account/{merchantId}/business-profile/labels`
5703
+ */
5704
+ async create(merchantId, params) {
5705
+ return this.request("POST", labelsPath(merchantId), { body: params });
5706
+ }
5707
+ /**
5708
+ * Rename a label on every shop that carries it.
5709
+ * `PATCH /account/{merchantId}/business-profile/labels/{labelId}`
5710
+ */
5711
+ async update(merchantId, labelId, params) {
5712
+ return this.request("PATCH", `${labelsPath(merchantId)}/${encodeURIComponent(labelId)}`, {
5713
+ body: params
5714
+ });
5715
+ }
5716
+ /**
5717
+ * Delete a label and remove it from every shop. The shops are unchanged.
5718
+ * `DELETE /account/{merchantId}/business-profile/labels/{labelId}`
5719
+ */
5720
+ async delete(merchantId, labelId) {
5721
+ return this.request("DELETE", `${labelsPath(merchantId)}/${encodeURIComponent(labelId)}`);
5722
+ }
5723
+ /**
5724
+ * Replace the labels of one shop: `label_ids` is the complete set
5725
+ * afterwards, so a label left out is removed from the shop and an empty
5726
+ * list removes them all. At most 20 per shop.
5727
+ * `PUT /account/{merchantId}/business-profile/{profileId}/labels`
5728
+ */
5729
+ async setForShop(merchantId, profileId, params) {
5730
+ return this.request(
5731
+ "PUT",
5732
+ `/account/${encodeURIComponent(merchantId)}/business-profile/${encodeURIComponent(profileId)}/labels`,
5733
+ { body: params }
5734
+ );
5735
+ }
5736
+ };
5737
+
5652
5738
  // src/resources/buyerConversations.ts
5653
5739
  var BuyerConversations = class {
5654
5740
  constructor(request) {
@@ -8851,6 +8937,7 @@ var Delopay = class {
8851
8937
  this.availabilityOverrides = new AvailabilityOverrides(request);
8852
8938
  this.sellToRestrictions = new SellToRestrictions(request);
8853
8939
  this.buyerBlocklist = new BuyerBlocklist(request);
8940
+ this.shopLabels = new ShopLabels(request);
8854
8941
  this.buyerConversations = new BuyerConversations(request);
8855
8942
  this.buyerEvidence = new BuyerEvidenceReviews(request);
8856
8943
  this.checkoutRecovery = new CheckoutRecovery(request);
@@ -12638,15 +12725,11 @@ var CheckoutSession = class {
12638
12725
  });
12639
12726
  }
12640
12727
  /**
12641
- * The PayPal order for the payment's e-Payouts access code, from the PayPal
12642
- * SDK's `createOrder` on an experimental PayPal SDK pane — after the payment
12643
- * was confirmed through that pane, which mints the code.
12644
- *
12645
- * The router reads the order off e-Payouts' own PayPal page for the code, so
12646
- * `amount` and `currency` are what e-Payouts charges for it. Repeated calls
12647
- * answer the same order, so a cancelled PayPal popup is retried with the same
12648
- * code. When `captured` is `true` a capture was already reported: create no
12649
- * order and wait for the payment's status instead.
12728
+ * The PayPal order e-Payouts created for the payment, for the PayPal SDK's
12729
+ * `createOrder` on the PayPal Express or Pay with card pane, after the payment
12730
+ * was confirmed through that pane. Return `order_id` from `createOrder` and
12731
+ * send the buyer to `approve_url` once PayPal approved it; without an order,
12732
+ * or when PayPal's button cannot be drawn, send the buyer to `redirect_url`.
12650
12733
  *
12651
12734
  * `POST /payment-link/{merchantId}/{paymentId}/epayouts/paypal-order`
12652
12735
  */
@@ -13669,6 +13752,7 @@ export {
13669
13752
  AvailabilityOverrides,
13670
13753
  SellToRestrictions,
13671
13754
  BuyerBlocklist,
13755
+ ShopLabels,
13672
13756
  BuyerConversations,
13673
13757
  BuyerEvidenceReviews,
13674
13758
  CheckoutRecovery,
@@ -13903,4 +13987,4 @@ export {
13903
13987
  decodeNativePanes,
13904
13988
  encodeNativePanes
13905
13989
  };
13906
- //# sourceMappingURL=chunk-C7D3FUJ2.js.map
13990
+ //# sourceMappingURL=chunk-HEDL3UHE.js.map