@delopay/sdk 0.265.0 → 0.267.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.js CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  BUILTIN_PAYMENT_ICON_KEYS,
24
24
  BuyerBlocklist,
25
25
  BuyerConversations,
26
+ BuyerEvidenceReviews,
26
27
  CARD_FIELD_CHROMES,
27
28
  CARD_FIELD_FONT_SIZES,
28
29
  CARD_FIELD_WEIGHTS,
@@ -250,7 +251,7 @@ import {
250
251
  visibleCustomFields,
251
252
  whopAccentSwatch,
252
253
  whopCardElement
253
- } from "./chunk-SW4N2WY4.js";
254
+ } from "./chunk-C7D3FUJ2.js";
254
255
  export {
255
256
  AIRWALLEX_AUTOFILL_TREATMENTS,
256
257
  AIRWALLEX_CARD_LAYOUTS,
@@ -276,6 +277,7 @@ export {
276
277
  BUILTIN_PAYMENT_ICON_KEYS,
277
278
  BuyerBlocklist,
278
279
  BuyerConversations,
280
+ BuyerEvidenceReviews,
279
281
  CARD_FIELD_CHROMES,
280
282
  CARD_FIELD_FONT_SIZES,
281
283
  CARD_FIELD_WEIGHTS,
package/dist/internal.cjs CHANGED
@@ -47,6 +47,7 @@ __export(internal_exports, {
47
47
  BUILTIN_PAYMENT_ICON_KEYS: () => BUILTIN_PAYMENT_ICON_KEYS,
48
48
  BuyerBlocklist: () => BuyerBlocklist,
49
49
  BuyerConversations: () => BuyerConversations,
50
+ BuyerEvidenceReviews: () => BuyerEvidenceReviews,
50
51
  CARD_FIELD_CHROMES: () => CARD_FIELD_CHROMES,
51
52
  CARD_FIELD_FONT_SIZES: () => CARD_FIELD_FONT_SIZES,
52
53
  CARD_FIELD_WEIGHTS: () => CARD_FIELD_WEIGHTS,
@@ -1934,6 +1935,23 @@ var Disputes = class {
1934
1935
  async accept(disputeId) {
1935
1936
  return this.request("POST", `/disputes/accept/${encodeURIComponent(disputeId)}`);
1936
1937
  }
1938
+ /**
1939
+ * Correct the exchange rate of a dispute the processor reported in another
1940
+ * currency, or record its final settled amount. Until it is settled, the
1941
+ * reserved amount is an estimate and no other dispute on the same payment
1942
+ * attempt can take a new reservation. Signed-in users with the
1943
+ * external-record permission only.
1944
+ *
1945
+ * @param disputeId - The dispute to reconcile.
1946
+ * @param request - `correct_rate` with the processor's rate, or `settle`
1947
+ * with the final amount and a reason.
1948
+ * @returns The updated dispute.
1949
+ */
1950
+ async reconcile(disputeId, request) {
1951
+ return this.request("POST", `/disputes/${encodeURIComponent(disputeId)}/reconcile`, {
1952
+ body: request
1953
+ });
1954
+ }
1937
1955
  /**
1938
1956
  * Submit evidence to challenge a dispute.
1939
1957
  *
@@ -5991,6 +6009,60 @@ var BuyerConversations = class {
5991
6009
  }
5992
6010
  };
5993
6011
 
6012
+ // src/resources/buyerEvidenceReviews.ts
6013
+ var BuyerEvidenceReviews = class {
6014
+ constructor(request) {
6015
+ this.request = request;
6016
+ }
6017
+ /**
6018
+ * The shop's cases with buyer evidence, the nearest target first.
6019
+ * `merchant_id` and `reviewer` are ignored here. `GET /buyer-evidence`
6020
+ */
6021
+ async list(params) {
6022
+ return this.request("GET", "/buyer-evidence", {
6023
+ query: params
6024
+ });
6025
+ }
6026
+ /** One case's evidence with its history and files. `GET /buyer-evidence/{id}` */
6027
+ async retrieve(evidenceId) {
6028
+ return this.request("GET", `/buyer-evidence/${encodeURIComponent(evidenceId)}`);
6029
+ }
6030
+ /** Download a file of a case's evidence. */
6031
+ async downloadFile(evidenceId, fileId) {
6032
+ return this.request(
6033
+ "GET",
6034
+ `/buyer-evidence/${encodeURIComponent(evidenceId)}/files/${encodeURIComponent(fileId)}`,
6035
+ { responseType: "blob" }
6036
+ );
6037
+ }
6038
+ /** Ask the buyer for more, by a cut-off. Refused once a result closed the review. */
6039
+ async requestInformation(evidenceId, params) {
6040
+ return this.request(
6041
+ "POST",
6042
+ `/buyer-evidence/${encodeURIComponent(evidenceId)}/information-requests`,
6043
+ { body: params }
6044
+ );
6045
+ }
6046
+ /** An answer the buyer sees. */
6047
+ async reply(evidenceId, params) {
6048
+ return this.request("POST", `/buyer-evidence/${encodeURIComponent(evidenceId)}/replies`, {
6049
+ body: params
6050
+ });
6051
+ }
6052
+ /** Record the result, which closes the review. */
6053
+ async review(evidenceId, params) {
6054
+ return this.request("POST", `/buyer-evidence/${encodeURIComponent(evidenceId)}/reviews`, {
6055
+ body: params
6056
+ });
6057
+ }
6058
+ /** A note the shop's team and DeloPay read, never the buyer. */
6059
+ async note(evidenceId, params) {
6060
+ return this.request("POST", `/buyer-evidence/${encodeURIComponent(evidenceId)}/notes`, {
6061
+ body: params
6062
+ });
6063
+ }
6064
+ };
6065
+
5994
6066
  // src/resources/checkoutRecovery.ts
5995
6067
  var CheckoutRecovery = class {
5996
6068
  constructor(request) {
@@ -7608,6 +7680,17 @@ var BuyerAccount = class {
7608
7680
  async getSession(options) {
7609
7681
  return this.request("GET", "/buyer-account/session", { ...options });
7610
7682
  }
7683
+ /**
7684
+ * What the buyer is mailed about: a reply from a shop's team they have not
7685
+ * read, and news in their refund requests and disputes.
7686
+ */
7687
+ async noticeSettings(options) {
7688
+ return this.request("GET", "/buyer-account/notice-settings", { ...options });
7689
+ }
7690
+ /** Turn either mail on or off for the buyer, at every shop. */
7691
+ async setNoticeSettings(params, options) {
7692
+ return this.request("PUT", "/buyer-account/notice-settings", { body: params, ...options });
7693
+ }
7611
7694
  /** End the current session. */
7612
7695
  async signOut(options) {
7613
7696
  return this.request("DELETE", "/buyer-account/session", { ...options });
@@ -7742,6 +7825,78 @@ var BuyerAccount = class {
7742
7825
  ...options
7743
7826
  });
7744
7827
  }
7828
+ /**
7829
+ * A case's evidence: what may be handed in and by when, the files saved
7830
+ * and handed in, and what the reviewer said. Opened on the first read
7831
+ * while the case still waits.
7832
+ * The case is one of a confirmed record's, named by the `record` its
7833
+ * purchases carry and the case id the case list shows.
7834
+ */
7835
+ async caseEvidence(record, caseId, options) {
7836
+ return this.request(
7837
+ "GET",
7838
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence`,
7839
+ { ...options }
7840
+ );
7841
+ }
7842
+ /**
7843
+ * Upload a file for a case. It is saved, not handed in, until a
7844
+ * submission takes it. Uploading again with the same `clientUploadId`
7845
+ * returns the file the first upload stored, also after the cut-off.
7846
+ */
7847
+ async uploadEvidenceFile(record, caseId, file, clientUploadId, options) {
7848
+ const { fileName, ...extras } = options ?? {};
7849
+ const form = new FormData();
7850
+ form.append("client_upload_id", clientUploadId);
7851
+ if (fileName === void 0) form.append("file", file);
7852
+ else form.append("file", file, fileName);
7853
+ return this.request(
7854
+ "POST",
7855
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/files`,
7856
+ { body: form, ...extras }
7857
+ );
7858
+ }
7859
+ /** Download a file of the case's evidence. */
7860
+ async downloadEvidenceFile(record, caseId, fileId, options) {
7861
+ return this.request(
7862
+ "GET",
7863
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
7864
+ {
7865
+ responseType: "blob",
7866
+ ...options
7867
+ }
7868
+ );
7869
+ }
7870
+ /** Remove a saved file. A file a submission took stays. */
7871
+ async removeEvidenceFile(record, caseId, fileId, options) {
7872
+ return this.request(
7873
+ "DELETE",
7874
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
7875
+ {
7876
+ ...options
7877
+ }
7878
+ );
7879
+ }
7880
+ /**
7881
+ * Hand in an explanation, saved files or both, while the buyer's window
7882
+ * is open. Sending again with the same `client_submission_id` returns the
7883
+ * submission the first send stored.
7884
+ */
7885
+ async submitEvidence(record, caseId, params, options) {
7886
+ return this.request(
7887
+ "POST",
7888
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/submissions`,
7889
+ { body: params, ...options }
7890
+ );
7891
+ }
7892
+ /** Ask for more time, once until the cut-off is next set. */
7893
+ async requestEvidenceExtension(record, caseId, params, options) {
7894
+ return this.request(
7895
+ "POST",
7896
+ `/buyer-account/records/${encodeURIComponent(record)}/cases/${encodeURIComponent(caseId)}/evidence/extension-requests`,
7897
+ { body: params, ...options }
7898
+ );
7899
+ }
7745
7900
  };
7746
7901
 
7747
7902
  // src/resources/buyerPortal.ts
@@ -7760,6 +7915,74 @@ var BuyerPortal = class {
7760
7915
  async listCases(options) {
7761
7916
  return this.request("GET", "/buyer-portal/cases", { ...options });
7762
7917
  }
7918
+ /**
7919
+ * A case's evidence: what may be handed in and by when, the files saved
7920
+ * and handed in, and what the reviewer said. Opened on the first read
7921
+ * while the case still waits.
7922
+ */
7923
+ async caseEvidence(caseId, options) {
7924
+ return this.request("GET", `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence`, {
7925
+ ...options
7926
+ });
7927
+ }
7928
+ /**
7929
+ * Upload a file for a case. It is saved, not handed in, until a
7930
+ * submission takes it. Uploading again with the same `clientUploadId`
7931
+ * returns the file the first upload stored, also after the cut-off.
7932
+ */
7933
+ async uploadEvidenceFile(caseId, file, clientUploadId, options) {
7934
+ const { fileName, ...extras } = options ?? {};
7935
+ const form = new FormData();
7936
+ form.append("client_upload_id", clientUploadId);
7937
+ if (fileName === void 0) form.append("file", file);
7938
+ else form.append("file", file, fileName);
7939
+ return this.request(
7940
+ "POST",
7941
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files`,
7942
+ { body: form, ...extras }
7943
+ );
7944
+ }
7945
+ /** Download a file of the case's evidence. */
7946
+ async downloadEvidenceFile(caseId, fileId, options) {
7947
+ return this.request(
7948
+ "GET",
7949
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
7950
+ {
7951
+ responseType: "blob",
7952
+ ...options
7953
+ }
7954
+ );
7955
+ }
7956
+ /** Remove a saved file. A file a submission took stays. */
7957
+ async removeEvidenceFile(caseId, fileId, options) {
7958
+ return this.request(
7959
+ "DELETE",
7960
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/files/${encodeURIComponent(fileId)}`,
7961
+ {
7962
+ ...options
7963
+ }
7964
+ );
7965
+ }
7966
+ /**
7967
+ * Hand in an explanation, saved files or both, while the buyer's window
7968
+ * is open. Sending again with the same `client_submission_id` returns the
7969
+ * submission the first send stored.
7970
+ */
7971
+ async submitEvidence(caseId, params, options) {
7972
+ return this.request(
7973
+ "POST",
7974
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/submissions`,
7975
+ { body: params, ...options }
7976
+ );
7977
+ }
7978
+ /** Ask for more time, once until the cut-off is next set. */
7979
+ async requestEvidenceExtension(caseId, params, options) {
7980
+ return this.request(
7981
+ "POST",
7982
+ `/buyer-portal/cases/${encodeURIComponent(caseId)}/evidence/extension-requests`,
7983
+ { body: params, ...options }
7984
+ );
7985
+ }
7763
7986
  /**
7764
7987
  * The buyer's conversations with the shop, the latest message first. A
7765
7988
  * portal link for the whole merchant lists one per shop and mode.
@@ -8922,6 +9145,7 @@ var Delopay = class {
8922
9145
  this.sellToRestrictions = new SellToRestrictions(request);
8923
9146
  this.buyerBlocklist = new BuyerBlocklist(request);
8924
9147
  this.buyerConversations = new BuyerConversations(request);
9148
+ this.buyerEvidence = new BuyerEvidenceReviews(request);
8925
9149
  this.checkoutRecovery = new CheckoutRecovery(request);
8926
9150
  this.costRules = new CostRules(request);
8927
9151
  this.externalRecords = new ExternalRecords(request);
@@ -14041,6 +14265,82 @@ var AdminPortal = class {
14041
14265
  query: params
14042
14266
  });
14043
14267
  }
14268
+ // --- Buyer evidence review --------------------------------------------------
14269
+ /**
14270
+ * DeloPay's review queue of buyers' evidence, the nearest target first,
14271
+ * across merchants unless `merchant_id` narrows it.
14272
+ */
14273
+ async listBuyerEvidence(params) {
14274
+ return this.request("GET", "/admin-portal/buyer-evidence", {
14275
+ query: params
14276
+ });
14277
+ }
14278
+ /** One case's evidence with every step and file, internal ones included. */
14279
+ async getBuyerEvidence(evidenceId) {
14280
+ return this.request("GET", `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}`);
14281
+ }
14282
+ /** Download a file of a case's evidence. */
14283
+ async downloadBuyerEvidenceFile(evidenceId, fileId) {
14284
+ return this.request(
14285
+ "GET",
14286
+ `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/files/${encodeURIComponent(fileId)}`,
14287
+ { responseType: "blob" }
14288
+ );
14289
+ }
14290
+ /**
14291
+ * Ask the buyer for more, by a cut-off. Refused once a result has closed
14292
+ * the review.
14293
+ */
14294
+ async requestBuyerEvidenceInformation(evidenceId, params) {
14295
+ return this.request(
14296
+ "POST",
14297
+ `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/information-requests`,
14298
+ { body: params }
14299
+ );
14300
+ }
14301
+ /** An answer the buyer sees. */
14302
+ async replyToBuyerEvidence(evidenceId, params) {
14303
+ return this.request(
14304
+ "POST",
14305
+ `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/replies`,
14306
+ { body: params }
14307
+ );
14308
+ }
14309
+ /**
14310
+ * Record the result, which closes the review. It never refunds a payment
14311
+ * and never decides a dispute with the payment provider.
14312
+ */
14313
+ async reviewBuyerEvidence(evidenceId, params) {
14314
+ return this.request(
14315
+ "POST",
14316
+ `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/reviews`,
14317
+ { body: params }
14318
+ );
14319
+ }
14320
+ /** Move the buyer's cut-off, with a reason the buyer sees. */
14321
+ async moveBuyerEvidenceDeadline(evidenceId, params) {
14322
+ return this.request(
14323
+ "PUT",
14324
+ `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/deadline`,
14325
+ { body: params }
14326
+ );
14327
+ }
14328
+ /** Make a user responsible for the review: an id, `me`, or `null` for nobody. */
14329
+ async assignBuyerEvidence(evidenceId, params) {
14330
+ return this.request(
14331
+ "PUT",
14332
+ `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/reviewer`,
14333
+ { body: params }
14334
+ );
14335
+ }
14336
+ /** An internal note, never shown to the buyer. */
14337
+ async noteBuyerEvidence(evidenceId, params) {
14338
+ return this.request(
14339
+ "POST",
14340
+ `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/notes`,
14341
+ { body: params }
14342
+ );
14343
+ }
14044
14344
  async analytics(params) {
14045
14345
  return this.request("GET", "/admin-portal/analytics", {
14046
14346
  query: params
@@ -15374,6 +15674,7 @@ var DelopayInternal = class extends Delopay {
15374
15674
  BUILTIN_PAYMENT_ICON_KEYS,
15375
15675
  BuyerBlocklist,
15376
15676
  BuyerConversations,
15677
+ BuyerEvidenceReviews,
15377
15678
  CARD_FIELD_CHROMES,
15378
15679
  CARD_FIELD_FONT_SIZES,
15379
15680
  CARD_FIELD_WEIGHTS,