@delopay/sdk 0.272.0 → 0.277.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
@@ -911,6 +911,23 @@ var Connectors = class {
911
911
  { body: params }
912
912
  );
913
913
  }
914
+ /**
915
+ * Fold copies of the same provider account into this connector (todos#395).
916
+ * `POST /account/{accountId}/connectors/{connectorId}/consolidate`
917
+ *
918
+ * The copies' shops move to the connector with their on/off state, routing,
919
+ * checkout layout, currencies, saved credentials, mandates and
920
+ * subscriptions. A copy keeps answering for the payments made on it and
921
+ * serves no shop. Send `dry_run: true` first, then confirm with the
922
+ * preview's `preview_token` and a choice for every conflict.
923
+ */
924
+ async consolidate(accountId, connectorId, params) {
925
+ return this.request(
926
+ "POST",
927
+ `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/consolidate`,
928
+ { body: params }
929
+ );
930
+ }
914
931
  /**
915
932
  * Switch a connector off, or back on, in one shop it serves.
916
933
  * `POST /account/{accountId}/connectors/{connectorId}/shops/{profileId}`
@@ -6054,6 +6071,55 @@ var BuyerConversations = class {
6054
6071
  body: params
6055
6072
  });
6056
6073
  }
6074
+ /**
6075
+ * A team member's internal note. Only the team reads it: the buyer never
6076
+ * sees a note, and a note does not move the conversation or mark it unread.
6077
+ * A closed conversation takes notes as well.
6078
+ * `POST /buyer-conversations/{id}/notes`
6079
+ */
6080
+ async addNote(id, params) {
6081
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/notes`, {
6082
+ body: params
6083
+ });
6084
+ }
6085
+ /**
6086
+ * Upload a file for the caller's next answer, under the shop's attachment
6087
+ * rules (`attachment_rules` on the conversation). It belongs to the caller
6088
+ * until an answer names it in `attachments`; one no answer took within a
6089
+ * day is cleared. Uploading again with the same `clientUploadId` returns
6090
+ * the file the first upload stored.
6091
+ * `POST /buyer-conversation-files/{conversation}`
6092
+ */
6093
+ async uploadFile(id, file, clientUploadId, fileName) {
6094
+ const form = new FormData();
6095
+ form.append("client_upload_id", clientUploadId);
6096
+ if (fileName === void 0) form.append("file", file);
6097
+ else form.append("file", file, fileName);
6098
+ return this.request("POST", `/buyer-conversation-files/${encodeURIComponent(id)}`, {
6099
+ body: form
6100
+ });
6101
+ }
6102
+ /**
6103
+ * Download a file a message of the conversation carries.
6104
+ * `GET /buyer-conversation-files/{conversation}/{file}`
6105
+ */
6106
+ async downloadFile(id, fileId) {
6107
+ return this.request(
6108
+ "GET",
6109
+ `/buyer-conversation-files/${encodeURIComponent(id)}/${encodeURIComponent(fileId)}`,
6110
+ { responseType: "blob" }
6111
+ );
6112
+ }
6113
+ /**
6114
+ * Remove a file the caller uploaded that no answer took.
6115
+ * `DELETE /buyer-conversation-files/{conversation}/{file}`
6116
+ */
6117
+ async removeFile(id, fileId) {
6118
+ return this.request(
6119
+ "DELETE",
6120
+ `/buyer-conversation-files/${encodeURIComponent(id)}/${encodeURIComponent(fileId)}`
6121
+ );
6122
+ }
6057
6123
  /**
6058
6124
  * The team has read the conversation up to its last accepted message.
6059
6125
  * `POST /buyer-conversations/{id}/read`
@@ -7846,8 +7912,9 @@ var BuyerAccount = class {
7846
7912
  });
7847
7913
  }
7848
7914
  /**
7849
- * A message from a confirmed record to one of its shops. Sending again with
7850
- * the same `client_message_id` returns the message the first send stored.
7915
+ * A message from a confirmed record to one of its shops. A message to a
7916
+ * closed conversation reopens it. Sending again with the same
7917
+ * `client_message_id` returns the message the first send stored.
7851
7918
  */
7852
7919
  async sendRecordMessage(record, message, options) {
7853
7920
  return this.request("POST", `/buyer-account/records/${encodeURIComponent(record)}/messages`, {
@@ -7869,6 +7936,53 @@ var BuyerAccount = class {
7869
7936
  }
7870
7937
  );
7871
7938
  }
7939
+ /**
7940
+ * Upload a file for the buyer's next message to one shop of a confirmed
7941
+ * record, under the shop's attachment rules (`attachment_rules` on the
7942
+ * message page). It belongs to the buyer until a message names it in
7943
+ * `attachments`; one no message took within a day is cleared. Uploading
7944
+ * again with the same `clientUploadId` returns the file the first upload
7945
+ * stored. `shop` is required here.
7946
+ */
7947
+ async uploadRecordMessageFile(record, file, clientUploadId, query, options) {
7948
+ const { fileName, ...extras } = options ?? {};
7949
+ const form = new FormData();
7950
+ form.append("client_upload_id", clientUploadId);
7951
+ if (fileName === void 0) form.append("file", file);
7952
+ else form.append("file", file, fileName);
7953
+ return this.request(
7954
+ "POST",
7955
+ `/buyer-account/records/${encodeURIComponent(record)}/messages/files`,
7956
+ {
7957
+ body: form,
7958
+ query,
7959
+ ...extras
7960
+ }
7961
+ );
7962
+ }
7963
+ /** Download a file a message of a record's conversation with one shop carries. */
7964
+ async downloadRecordMessageFile(record, fileId, query, options) {
7965
+ return this.request(
7966
+ "GET",
7967
+ `/buyer-account/records/${encodeURIComponent(record)}/messages/files/${encodeURIComponent(fileId)}`,
7968
+ {
7969
+ query,
7970
+ responseType: "blob",
7971
+ ...options
7972
+ }
7973
+ );
7974
+ }
7975
+ /** Remove a file the buyer uploaded for a record's conversation that no message took. */
7976
+ async removeRecordMessageFile(record, fileId, query, options) {
7977
+ return this.request(
7978
+ "DELETE",
7979
+ `/buyer-account/records/${encodeURIComponent(record)}/messages/files/${encodeURIComponent(fileId)}`,
7980
+ {
7981
+ query,
7982
+ ...options
7983
+ }
7984
+ );
7985
+ }
7872
7986
  /**
7873
7987
  * What the buyer spent in a period: paid purchases summed per currency,
7874
7988
  * never converted, for the whole period, per day, week or month, per shop
@@ -8074,8 +8188,9 @@ var BuyerPortal = class {
8074
8188
  });
8075
8189
  }
8076
8190
  /**
8077
- * A message to the shop. Sending again with the same `client_message_id`
8078
- * returns the message the first send stored; a closed conversation refuses it.
8191
+ * A message to the shop. A message to a closed conversation reopens it.
8192
+ * Sending again with the same `client_message_id` returns the message the
8193
+ * first send stored.
8079
8194
  */
8080
8195
  async sendMessage(message, options) {
8081
8196
  return this.request("POST", "/buyer-portal/messages", { body: message, ...options });
@@ -8090,6 +8205,40 @@ var BuyerPortal = class {
8090
8205
  ...options
8091
8206
  });
8092
8207
  }
8208
+ /**
8209
+ * Upload a file for the buyer's next message to one shop, under the shop's
8210
+ * attachment rules (`attachment_rules` on the message page). It belongs to
8211
+ * the buyer until a message names it in `attachments`; one no message took
8212
+ * within a day is cleared. Uploading again with the same `clientUploadId`
8213
+ * returns the file the first upload stored.
8214
+ */
8215
+ async uploadMessageFile(file, clientUploadId, query, options) {
8216
+ const { fileName, ...extras } = options ?? {};
8217
+ const form = new FormData();
8218
+ form.append("client_upload_id", clientUploadId);
8219
+ if (fileName === void 0) form.append("file", file);
8220
+ else form.append("file", file, fileName);
8221
+ return this.request("POST", "/buyer-portal/messages/files", {
8222
+ body: form,
8223
+ query,
8224
+ ...extras
8225
+ });
8226
+ }
8227
+ /** Download a file a message of the buyer's conversation with one shop carries. */
8228
+ async downloadMessageFile(fileId, query, options) {
8229
+ return this.request("GET", `/buyer-portal/messages/files/${encodeURIComponent(fileId)}`, {
8230
+ query,
8231
+ responseType: "blob",
8232
+ ...options
8233
+ });
8234
+ }
8235
+ /** Remove a file the buyer uploaded that no message took. */
8236
+ async removeMessageFile(fileId, query, options) {
8237
+ return this.request("DELETE", `/buyer-portal/messages/files/${encodeURIComponent(fileId)}`, {
8238
+ query,
8239
+ ...options
8240
+ });
8241
+ }
8093
8242
  /** The buyer's contact and billing details, and what they may change. */
8094
8243
  async getProfile(options) {
8095
8244
  return this.request("GET", "/buyer-portal/profile", { ...options });
@@ -12793,6 +12942,12 @@ var CheckoutSession = class {
12793
12942
  * channel the backend's locale resolution reads; a `?locale=` query is
12794
12943
  * silently ignored by this route.
12795
12944
  *
12945
+ * `cardOnly` is a direct link to the card form (`payment_method=card`):
12946
+ * when the Stripe card form being prepared is the one the link names, its
12947
+ * PaymentIntent is created for `card` alone. `cardProvider` and
12948
+ * `cardAccount` name that form's connector and account; absent or blank
12949
+ * matches any.
12950
+ *
12796
12951
  * `GET /payment-link/data/{merchantId}/{paymentId}`
12797
12952
  */
12798
12953
  async fetchCheckoutData(params, options) {
@@ -12801,7 +12956,13 @@ var CheckoutSession = class {
12801
12956
  "GET",
12802
12957
  `/payment-link/data/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
12803
12958
  {
12804
- query: { theme: params?.theme, country: country || void 0 },
12959
+ query: {
12960
+ theme: params?.theme,
12961
+ country: country || void 0,
12962
+ card_only: params?.cardOnly || void 0,
12963
+ card_provider: params?.cardOnly ? params.cardProvider?.trim() || void 0 : void 0,
12964
+ card_account: params?.cardOnly ? params.cardAccount?.trim() || void 0 : void 0
12965
+ },
12805
12966
  ...options,
12806
12967
  headers: {
12807
12968
  ...params?.locale ? {