@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.
package/dist/index.cjs CHANGED
@@ -44,6 +44,7 @@ __export(index_exports, {
44
44
  BUILTIN_PAYMENT_ICON_KEYS: () => BUILTIN_PAYMENT_ICON_KEYS,
45
45
  BuyerBlocklist: () => BuyerBlocklist,
46
46
  BuyerConversations: () => BuyerConversations,
47
+ BuyerEvidenceReviews: () => BuyerEvidenceReviews,
47
48
  CARD_FIELD_CHROMES: () => CARD_FIELD_CHROMES,
48
49
  CARD_FIELD_FONT_SIZES: () => CARD_FIELD_FONT_SIZES,
49
50
  CARD_FIELD_WEIGHTS: () => CARD_FIELD_WEIGHTS,
@@ -134,6 +135,7 @@ __export(index_exports, {
134
135
  SellToRestrictions: () => SellToRestrictions,
135
136
  Settings: () => Settings,
136
137
  Settlement: () => Settlement,
138
+ ShopLabels: () => ShopLabels,
137
139
  Subscriptions: () => Subscriptions,
138
140
  UNKNOWN_SECTION_ORDER: () => UNKNOWN_SECTION_ORDER,
139
141
  WCAG_AA_TEXT: () => WCAG_AA_TEXT,
@@ -2916,6 +2918,35 @@ var Payments = class {
2916
2918
  body: params
2917
2919
  });
2918
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
+ }
2919
2950
  /**
2920
2951
  * List payment intents, optionally filtered by customer or date range.
2921
2952
  *
@@ -5925,6 +5956,63 @@ var BuyerBlocklist = class {
5925
5956
  }
5926
5957
  };
5927
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
+
5928
6016
  // src/resources/buyerConversations.ts
5929
6017
  var BuyerConversations = class {
5930
6018
  constructor(request) {
@@ -5992,6 +6080,60 @@ var BuyerConversations = class {
5992
6080
  }
5993
6081
  };
5994
6082
 
6083
+ // src/resources/buyerEvidenceReviews.ts
6084
+ var BuyerEvidenceReviews = class {
6085
+ constructor(request) {
6086
+ this.request = request;
6087
+ }
6088
+ /**
6089
+ * The shop's cases with buyer evidence, the nearest target first.
6090
+ * `merchant_id` and `reviewer` are ignored here. `GET /buyer-evidence`
6091
+ */
6092
+ async list(params) {
6093
+ return this.request("GET", "/buyer-evidence", {
6094
+ query: params
6095
+ });
6096
+ }
6097
+ /** One case's evidence with its history and files. `GET /buyer-evidence/{id}` */
6098
+ async retrieve(evidenceId) {
6099
+ return this.request("GET", `/buyer-evidence/${encodeURIComponent(evidenceId)}`);
6100
+ }
6101
+ /** Download a file of a case's evidence. */
6102
+ async downloadFile(evidenceId, fileId) {
6103
+ return this.request(
6104
+ "GET",
6105
+ `/buyer-evidence/${encodeURIComponent(evidenceId)}/files/${encodeURIComponent(fileId)}`,
6106
+ { responseType: "blob" }
6107
+ );
6108
+ }
6109
+ /** Ask the buyer for more, by a cut-off. Refused once a result closed the review. */
6110
+ async requestInformation(evidenceId, params) {
6111
+ return this.request(
6112
+ "POST",
6113
+ `/buyer-evidence/${encodeURIComponent(evidenceId)}/information-requests`,
6114
+ { body: params }
6115
+ );
6116
+ }
6117
+ /** An answer the buyer sees. */
6118
+ async reply(evidenceId, params) {
6119
+ return this.request("POST", `/buyer-evidence/${encodeURIComponent(evidenceId)}/replies`, {
6120
+ body: params
6121
+ });
6122
+ }
6123
+ /** Record the result, which closes the review. */
6124
+ async review(evidenceId, params) {
6125
+ return this.request("POST", `/buyer-evidence/${encodeURIComponent(evidenceId)}/reviews`, {
6126
+ body: params
6127
+ });
6128
+ }
6129
+ /** A note the shop's team and DeloPay read, never the buyer. */
6130
+ async note(evidenceId, params) {
6131
+ return this.request("POST", `/buyer-evidence/${encodeURIComponent(evidenceId)}/notes`, {
6132
+ body: params
6133
+ });
6134
+ }
6135
+ };
6136
+
5995
6137
  // src/resources/checkoutRecovery.ts
5996
6138
  var CheckoutRecovery = class {
5997
6139
  constructor(request) {
@@ -7609,6 +7751,17 @@ var BuyerAccount = class {
7609
7751
  async getSession(options) {
7610
7752
  return this.request("GET", "/buyer-account/session", { ...options });
7611
7753
  }
7754
+ /**
7755
+ * What the buyer is mailed about: a reply from a shop's team they have not
7756
+ * read, and news in their refund requests and disputes.
7757
+ */
7758
+ async noticeSettings(options) {
7759
+ return this.request("GET", "/buyer-account/notice-settings", { ...options });
7760
+ }
7761
+ /** Turn either mail on or off for the buyer, at every shop. */
7762
+ async setNoticeSettings(params, options) {
7763
+ return this.request("PUT", "/buyer-account/notice-settings", { body: params, ...options });
7764
+ }
7612
7765
  /** End the current session. */
7613
7766
  async signOut(options) {
7614
7767
  return this.request("DELETE", "/buyer-account/session", { ...options });
@@ -7743,6 +7896,78 @@ var BuyerAccount = class {
7743
7896
  ...options
7744
7897
  });
7745
7898
  }
7899
+ /**
7900
+ * A case's evidence: what may be handed in and by when, the files saved
7901
+ * and handed in, and what the reviewer said. Opened on the first read
7902
+ * while the case still waits.
7903
+ * The case is one of a confirmed record's, named by the `record` its
7904
+ * purchases carry and the case id the case list shows.
7905
+ */
7906
+ async caseEvidence(record, caseId, options) {
7907
+ return this.request(
7908
+ "GET",
7909
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence`,
7910
+ { ...options }
7911
+ );
7912
+ }
7913
+ /**
7914
+ * Upload a file for a case. It is saved, not handed in, until a
7915
+ * submission takes it. Uploading again with the same `clientUploadId`
7916
+ * returns the file the first upload stored, also after the cut-off.
7917
+ */
7918
+ async uploadEvidenceFile(record, caseId, file, clientUploadId, options) {
7919
+ const { fileName, ...extras } = options ?? {};
7920
+ const form = new FormData();
7921
+ form.append("client_upload_id", clientUploadId);
7922
+ if (fileName === void 0) form.append("file", file);
7923
+ else form.append("file", file, fileName);
7924
+ return this.request(
7925
+ "POST",
7926
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/files`,
7927
+ { body: form, ...extras }
7928
+ );
7929
+ }
7930
+ /** Download a file of the case's evidence. */
7931
+ async downloadEvidenceFile(record, caseId, fileId, options) {
7932
+ return this.request(
7933
+ "GET",
7934
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
7935
+ {
7936
+ responseType: "blob",
7937
+ ...options
7938
+ }
7939
+ );
7940
+ }
7941
+ /** Remove a saved file. A file a submission took stays. */
7942
+ async removeEvidenceFile(record, caseId, fileId, options) {
7943
+ return this.request(
7944
+ "DELETE",
7945
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
7946
+ {
7947
+ ...options
7948
+ }
7949
+ );
7950
+ }
7951
+ /**
7952
+ * Hand in an explanation, saved files or both, while the buyer's window
7953
+ * is open. Sending again with the same `client_submission_id` returns the
7954
+ * submission the first send stored.
7955
+ */
7956
+ async submitEvidence(record, caseId, params, options) {
7957
+ return this.request(
7958
+ "POST",
7959
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/submissions`,
7960
+ { body: params, ...options }
7961
+ );
7962
+ }
7963
+ /** Ask for more time, once until the cut-off is next set. */
7964
+ async requestEvidenceExtension(record, caseId, params, options) {
7965
+ return this.request(
7966
+ "POST",
7967
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/extension-requests`,
7968
+ { body: params, ...options }
7969
+ );
7970
+ }
7746
7971
  };
7747
7972
 
7748
7973
  // src/resources/buyerPortal.ts
@@ -7761,6 +7986,74 @@ var BuyerPortal = class {
7761
7986
  async listCases(options) {
7762
7987
  return this.request("GET", "/buyer-portal/cases", { ...options });
7763
7988
  }
7989
+ /**
7990
+ * A case's evidence: what may be handed in and by when, the files saved
7991
+ * and handed in, and what the reviewer said. Opened on the first read
7992
+ * while the case still waits.
7993
+ */
7994
+ async caseEvidence(caseId, options) {
7995
+ return this.request("GET", `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence`, {
7996
+ ...options
7997
+ });
7998
+ }
7999
+ /**
8000
+ * Upload a file for a case. It is saved, not handed in, until a
8001
+ * submission takes it. Uploading again with the same `clientUploadId`
8002
+ * returns the file the first upload stored, also after the cut-off.
8003
+ */
8004
+ async uploadEvidenceFile(caseId, file, clientUploadId, options) {
8005
+ const { fileName, ...extras } = options ?? {};
8006
+ const form = new FormData();
8007
+ form.append("client_upload_id", clientUploadId);
8008
+ if (fileName === void 0) form.append("file", file);
8009
+ else form.append("file", file, fileName);
8010
+ return this.request(
8011
+ "POST",
8012
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files`,
8013
+ { body: form, ...extras }
8014
+ );
8015
+ }
8016
+ /** Download a file of the case's evidence. */
8017
+ async downloadEvidenceFile(caseId, fileId, options) {
8018
+ return this.request(
8019
+ "GET",
8020
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
8021
+ {
8022
+ responseType: "blob",
8023
+ ...options
8024
+ }
8025
+ );
8026
+ }
8027
+ /** Remove a saved file. A file a submission took stays. */
8028
+ async removeEvidenceFile(caseId, fileId, options) {
8029
+ return this.request(
8030
+ "DELETE",
8031
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
8032
+ {
8033
+ ...options
8034
+ }
8035
+ );
8036
+ }
8037
+ /**
8038
+ * Hand in an explanation, saved files or both, while the buyer's window
8039
+ * is open. Sending again with the same `client_submission_id` returns the
8040
+ * submission the first send stored.
8041
+ */
8042
+ async submitEvidence(caseId, params, options) {
8043
+ return this.request(
8044
+ "POST",
8045
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/submissions`,
8046
+ { body: params, ...options }
8047
+ );
8048
+ }
8049
+ /** Ask for more time, once until the cut-off is next set. */
8050
+ async requestEvidenceExtension(caseId, params, options) {
8051
+ return this.request(
8052
+ "POST",
8053
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/extension-requests`,
8054
+ { body: params, ...options }
8055
+ );
8056
+ }
7764
8057
  /**
7765
8058
  * The buyer's conversations with the shop, the latest message first. A
7766
8059
  * portal link for the whole merchant lists one per shop and mode.
@@ -8922,7 +9215,9 @@ var Delopay = class {
8922
9215
  this.availabilityOverrides = new AvailabilityOverrides(request);
8923
9216
  this.sellToRestrictions = new SellToRestrictions(request);
8924
9217
  this.buyerBlocklist = new BuyerBlocklist(request);
9218
+ this.shopLabels = new ShopLabels(request);
8925
9219
  this.buyerConversations = new BuyerConversations(request);
9220
+ this.buyerEvidence = new BuyerEvidenceReviews(request);
8926
9221
  this.checkoutRecovery = new CheckoutRecovery(request);
8927
9222
  this.costRules = new CostRules(request);
8928
9223
  this.externalRecords = new ExternalRecords(request);
@@ -12708,15 +13003,11 @@ var CheckoutSession = class {
12708
13003
  });
12709
13004
  }
12710
13005
  /**
12711
- * The PayPal order for the payment's e-Payouts access code, from the PayPal
12712
- * SDK's `createOrder` on an experimental PayPal SDK pane — after the payment
12713
- * was confirmed through that pane, which mints the code.
12714
- *
12715
- * The router reads the order off e-Payouts' own PayPal page for the code, so
12716
- * `amount` and `currency` are what e-Payouts charges for it. Repeated calls
12717
- * answer the same order, so a cancelled PayPal popup is retried with the same
12718
- * code. When `captured` is `true` a capture was already reported: create no
12719
- * 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`.
12720
13011
  *
12721
13012
  * `POST /payment-link/{merchantId}/{paymentId}/epayouts/paypal-order`
12722
13013
  */
@@ -13743,6 +14034,7 @@ var encodeNativePanes = encodePanes;
13743
14034
  BUILTIN_PAYMENT_ICON_KEYS,
13744
14035
  BuyerBlocklist,
13745
14036
  BuyerConversations,
14037
+ BuyerEvidenceReviews,
13746
14038
  CARD_FIELD_CHROMES,
13747
14039
  CARD_FIELD_FONT_SIZES,
13748
14040
  CARD_FIELD_WEIGHTS,
@@ -13833,6 +14125,7 @@ var encodeNativePanes = encodePanes;
13833
14125
  SellToRestrictions,
13834
14126
  Settings,
13835
14127
  Settlement,
14128
+ ShopLabels,
13836
14129
  Subscriptions,
13837
14130
  UNKNOWN_SECTION_ORDER,
13838
14131
  WCAG_AA_TEXT,