@delopay/sdk 0.266.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.
@@ -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) {
@@ -5716,6 +5802,60 @@ var BuyerConversations = class {
5716
5802
  }
5717
5803
  };
5718
5804
 
5805
+ // src/resources/buyerEvidenceReviews.ts
5806
+ var BuyerEvidenceReviews = class {
5807
+ constructor(request) {
5808
+ this.request = request;
5809
+ }
5810
+ /**
5811
+ * The shop's cases with buyer evidence, the nearest target first.
5812
+ * `merchant_id` and `reviewer` are ignored here. `GET /buyer-evidence`
5813
+ */
5814
+ async list(params) {
5815
+ return this.request("GET", "/buyer-evidence", {
5816
+ query: params
5817
+ });
5818
+ }
5819
+ /** One case's evidence with its history and files. `GET /buyer-evidence/{id}` */
5820
+ async retrieve(evidenceId) {
5821
+ return this.request("GET", `/buyer-evidence/${encodeURIComponent(evidenceId)}`);
5822
+ }
5823
+ /** Download a file of a case's evidence. */
5824
+ async downloadFile(evidenceId, fileId) {
5825
+ return this.request(
5826
+ "GET",
5827
+ `/buyer-evidence/${encodeURIComponent(evidenceId)}/files/${encodeURIComponent(fileId)}`,
5828
+ { responseType: "blob" }
5829
+ );
5830
+ }
5831
+ /** Ask the buyer for more, by a cut-off. Refused once a result closed the review. */
5832
+ async requestInformation(evidenceId, params) {
5833
+ return this.request(
5834
+ "POST",
5835
+ `/buyer-evidence/${encodeURIComponent(evidenceId)}/information-requests`,
5836
+ { body: params }
5837
+ );
5838
+ }
5839
+ /** An answer the buyer sees. */
5840
+ async reply(evidenceId, params) {
5841
+ return this.request("POST", `/buyer-evidence/${encodeURIComponent(evidenceId)}/replies`, {
5842
+ body: params
5843
+ });
5844
+ }
5845
+ /** Record the result, which closes the review. */
5846
+ async review(evidenceId, params) {
5847
+ return this.request("POST", `/buyer-evidence/${encodeURIComponent(evidenceId)}/reviews`, {
5848
+ body: params
5849
+ });
5850
+ }
5851
+ /** A note the shop's team and DeloPay read, never the buyer. */
5852
+ async note(evidenceId, params) {
5853
+ return this.request("POST", `/buyer-evidence/${encodeURIComponent(evidenceId)}/notes`, {
5854
+ body: params
5855
+ });
5856
+ }
5857
+ };
5858
+
5719
5859
  // src/resources/checkoutRecovery.ts
5720
5860
  var CheckoutRecovery = class {
5721
5861
  constructor(request) {
@@ -7333,6 +7473,17 @@ var BuyerAccount = class {
7333
7473
  async getSession(options) {
7334
7474
  return this.request("GET", "/buyer-account/session", { ...options });
7335
7475
  }
7476
+ /**
7477
+ * What the buyer is mailed about: a reply from a shop's team they have not
7478
+ * read, and news in their refund requests and disputes.
7479
+ */
7480
+ async noticeSettings(options) {
7481
+ return this.request("GET", "/buyer-account/notice-settings", { ...options });
7482
+ }
7483
+ /** Turn either mail on or off for the buyer, at every shop. */
7484
+ async setNoticeSettings(params, options) {
7485
+ return this.request("PUT", "/buyer-account/notice-settings", { body: params, ...options });
7486
+ }
7336
7487
  /** End the current session. */
7337
7488
  async signOut(options) {
7338
7489
  return this.request("DELETE", "/buyer-account/session", { ...options });
@@ -7467,6 +7618,78 @@ var BuyerAccount = class {
7467
7618
  ...options
7468
7619
  });
7469
7620
  }
7621
+ /**
7622
+ * A case's evidence: what may be handed in and by when, the files saved
7623
+ * and handed in, and what the reviewer said. Opened on the first read
7624
+ * while the case still waits.
7625
+ * The case is one of a confirmed record's, named by the `record` its
7626
+ * purchases carry and the case id the case list shows.
7627
+ */
7628
+ async caseEvidence(record, caseId, options) {
7629
+ return this.request(
7630
+ "GET",
7631
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence`,
7632
+ { ...options }
7633
+ );
7634
+ }
7635
+ /**
7636
+ * Upload a file for a case. It is saved, not handed in, until a
7637
+ * submission takes it. Uploading again with the same `clientUploadId`
7638
+ * returns the file the first upload stored, also after the cut-off.
7639
+ */
7640
+ async uploadEvidenceFile(record, caseId, file, clientUploadId, options) {
7641
+ const { fileName, ...extras } = options ?? {};
7642
+ const form = new FormData();
7643
+ form.append("client_upload_id", clientUploadId);
7644
+ if (fileName === void 0) form.append("file", file);
7645
+ else form.append("file", file, fileName);
7646
+ return this.request(
7647
+ "POST",
7648
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/files`,
7649
+ { body: form, ...extras }
7650
+ );
7651
+ }
7652
+ /** Download a file of the case's evidence. */
7653
+ async downloadEvidenceFile(record, caseId, fileId, options) {
7654
+ return this.request(
7655
+ "GET",
7656
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
7657
+ {
7658
+ responseType: "blob",
7659
+ ...options
7660
+ }
7661
+ );
7662
+ }
7663
+ /** Remove a saved file. A file a submission took stays. */
7664
+ async removeEvidenceFile(record, caseId, fileId, options) {
7665
+ return this.request(
7666
+ "DELETE",
7667
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
7668
+ {
7669
+ ...options
7670
+ }
7671
+ );
7672
+ }
7673
+ /**
7674
+ * Hand in an explanation, saved files or both, while the buyer's window
7675
+ * is open. Sending again with the same `client_submission_id` returns the
7676
+ * submission the first send stored.
7677
+ */
7678
+ async submitEvidence(record, caseId, params, options) {
7679
+ return this.request(
7680
+ "POST",
7681
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/submissions`,
7682
+ { body: params, ...options }
7683
+ );
7684
+ }
7685
+ /** Ask for more time, once until the cut-off is next set. */
7686
+ async requestEvidenceExtension(record, caseId, params, options) {
7687
+ return this.request(
7688
+ "POST",
7689
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/extension-requests`,
7690
+ { body: params, ...options }
7691
+ );
7692
+ }
7470
7693
  };
7471
7694
 
7472
7695
  // src/resources/buyerPortal.ts
@@ -7485,6 +7708,74 @@ var BuyerPortal = class {
7485
7708
  async listCases(options) {
7486
7709
  return this.request("GET", "/buyer-portal/cases", { ...options });
7487
7710
  }
7711
+ /**
7712
+ * A case's evidence: what may be handed in and by when, the files saved
7713
+ * and handed in, and what the reviewer said. Opened on the first read
7714
+ * while the case still waits.
7715
+ */
7716
+ async caseEvidence(caseId, options) {
7717
+ return this.request("GET", `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence`, {
7718
+ ...options
7719
+ });
7720
+ }
7721
+ /**
7722
+ * Upload a file for a case. It is saved, not handed in, until a
7723
+ * submission takes it. Uploading again with the same `clientUploadId`
7724
+ * returns the file the first upload stored, also after the cut-off.
7725
+ */
7726
+ async uploadEvidenceFile(caseId, file, clientUploadId, options) {
7727
+ const { fileName, ...extras } = options ?? {};
7728
+ const form = new FormData();
7729
+ form.append("client_upload_id", clientUploadId);
7730
+ if (fileName === void 0) form.append("file", file);
7731
+ else form.append("file", file, fileName);
7732
+ return this.request(
7733
+ "POST",
7734
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files`,
7735
+ { body: form, ...extras }
7736
+ );
7737
+ }
7738
+ /** Download a file of the case's evidence. */
7739
+ async downloadEvidenceFile(caseId, fileId, options) {
7740
+ return this.request(
7741
+ "GET",
7742
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
7743
+ {
7744
+ responseType: "blob",
7745
+ ...options
7746
+ }
7747
+ );
7748
+ }
7749
+ /** Remove a saved file. A file a submission took stays. */
7750
+ async removeEvidenceFile(caseId, fileId, options) {
7751
+ return this.request(
7752
+ "DELETE",
7753
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
7754
+ {
7755
+ ...options
7756
+ }
7757
+ );
7758
+ }
7759
+ /**
7760
+ * Hand in an explanation, saved files or both, while the buyer's window
7761
+ * is open. Sending again with the same `client_submission_id` returns the
7762
+ * submission the first send stored.
7763
+ */
7764
+ async submitEvidence(caseId, params, options) {
7765
+ return this.request(
7766
+ "POST",
7767
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/submissions`,
7768
+ { body: params, ...options }
7769
+ );
7770
+ }
7771
+ /** Ask for more time, once until the cut-off is next set. */
7772
+ async requestEvidenceExtension(caseId, params, options) {
7773
+ return this.request(
7774
+ "POST",
7775
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/extension-requests`,
7776
+ { body: params, ...options }
7777
+ );
7778
+ }
7488
7779
  /**
7489
7780
  * The buyer's conversations with the shop, the latest message first. A
7490
7781
  * portal link for the whole merchant lists one per shop and mode.
@@ -8646,7 +8937,9 @@ var Delopay = class {
8646
8937
  this.availabilityOverrides = new AvailabilityOverrides(request);
8647
8938
  this.sellToRestrictions = new SellToRestrictions(request);
8648
8939
  this.buyerBlocklist = new BuyerBlocklist(request);
8940
+ this.shopLabels = new ShopLabels(request);
8649
8941
  this.buyerConversations = new BuyerConversations(request);
8942
+ this.buyerEvidence = new BuyerEvidenceReviews(request);
8650
8943
  this.checkoutRecovery = new CheckoutRecovery(request);
8651
8944
  this.costRules = new CostRules(request);
8652
8945
  this.externalRecords = new ExternalRecords(request);
@@ -12432,15 +12725,11 @@ var CheckoutSession = class {
12432
12725
  });
12433
12726
  }
12434
12727
  /**
12435
- * The PayPal order for the payment's e-Payouts access code, from the PayPal
12436
- * SDK's `createOrder` on an experimental PayPal SDK pane — after the payment
12437
- * was confirmed through that pane, which mints the code.
12438
- *
12439
- * The router reads the order off e-Payouts' own PayPal page for the code, so
12440
- * `amount` and `currency` are what e-Payouts charges for it. Repeated calls
12441
- * answer the same order, so a cancelled PayPal popup is retried with the same
12442
- * code. When `captured` is `true` a capture was already reported: create no
12443
- * 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`.
12444
12733
  *
12445
12734
  * `POST /payment-link/{merchantId}/{paymentId}/epayouts/paypal-order`
12446
12735
  */
@@ -13463,7 +13752,9 @@ export {
13463
13752
  AvailabilityOverrides,
13464
13753
  SellToRestrictions,
13465
13754
  BuyerBlocklist,
13755
+ ShopLabels,
13466
13756
  BuyerConversations,
13757
+ BuyerEvidenceReviews,
13467
13758
  CheckoutRecovery,
13468
13759
  CostRules,
13469
13760
  ExternalRecords,
@@ -13696,4 +13987,4 @@ export {
13696
13987
  decodeNativePanes,
13697
13988
  encodeNativePanes
13698
13989
  };
13699
- //# sourceMappingURL=chunk-T7DDPU7M.js.map
13990
+ //# sourceMappingURL=chunk-HEDL3UHE.js.map