@delopay/sdk 0.255.0 → 0.263.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.
@@ -5553,6 +5553,73 @@ var BuyerBlocklist = class {
5553
5553
  }
5554
5554
  };
5555
5555
 
5556
+ // src/resources/buyerConversations.ts
5557
+ var BuyerConversations = class {
5558
+ constructor(request) {
5559
+ this.request = request;
5560
+ }
5561
+ /**
5562
+ * One page of the inbox, the latest message first, filtered by shop,
5563
+ * status, assignee, mode or buyer. `GET /buyer-conversations`
5564
+ */
5565
+ async list(params) {
5566
+ return this.request("GET", "/buyer-conversations", {
5567
+ query: params
5568
+ });
5569
+ }
5570
+ /**
5571
+ * Starts the conversation with a buyer at one shop, or adds to the one that
5572
+ * exists, with a first message. `POST /buyer-conversations`
5573
+ */
5574
+ async start(params) {
5575
+ return this.request("POST", "/buyer-conversations", { body: params });
5576
+ }
5577
+ /**
5578
+ * One conversation and its newest messages, oldest first; `before` pages
5579
+ * back. `GET /buyer-conversations/{id}`
5580
+ */
5581
+ async retrieve(id, params) {
5582
+ return this.request("GET", `/buyer-conversations/${encodeURIComponent(id)}`, {
5583
+ query: params
5584
+ });
5585
+ }
5586
+ /**
5587
+ * A team member's answer. A closed conversation refuses it.
5588
+ * `POST /buyer-conversations/{id}/messages`
5589
+ */
5590
+ async reply(id, params) {
5591
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/messages`, {
5592
+ body: params
5593
+ });
5594
+ }
5595
+ /**
5596
+ * The team has read the conversation up to its last accepted message.
5597
+ * `POST /buyer-conversations/{id}/read`
5598
+ */
5599
+ async markRead(id) {
5600
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/read`);
5601
+ }
5602
+ /**
5603
+ * Hands the conversation to a team member, to the caller with `me`, or to
5604
+ * nobody with `null`. `POST /buyer-conversations/{id}/assign`
5605
+ */
5606
+ async assign(id, params) {
5607
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/assign`, {
5608
+ body: params
5609
+ });
5610
+ }
5611
+ /**
5612
+ * Closes or reopens the conversation. Closing moves no money and decides
5613
+ * no case; it stops new messages until reopened.
5614
+ * `POST /buyer-conversations/{id}/status`
5615
+ */
5616
+ async setStatus(id, params) {
5617
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/status`, {
5618
+ body: params
5619
+ });
5620
+ }
5621
+ };
5622
+
5556
5623
  // src/resources/checkoutRecovery.ts
5557
5624
  var CheckoutRecovery = class {
5558
5625
  constructor(request) {
@@ -6781,6 +6848,31 @@ var CheckoutMethods = class {
6781
6848
  body
6782
6849
  });
6783
6850
  }
6851
+ /**
6852
+ * What DeloPay confirms beneath each item the shop can place: the card
6853
+ * networks the card form's accounts accept, and the methods or coins a
6854
+ * provider's page offers, per account, with source and freshness. A
6855
+ * provider that answers only per order reports `context_required` until
6856
+ * `currency` and `amount` are given. A layout item's `children` narrows
6857
+ * these lists and never adds to them.
6858
+ * `GET /checkout-methods/{profile_id}/children` (`/test/children` for Test)
6859
+ */
6860
+ async children(merchantId, profileId, params = {}) {
6861
+ const { environment, ...order } = params;
6862
+ const query = { merchant_id: merchantId, ...order };
6863
+ if (environment === "test") {
6864
+ return this.request(
6865
+ "GET",
6866
+ `/checkout-methods/${encodeURIComponent(profileId)}/test/children`,
6867
+ {
6868
+ query
6869
+ }
6870
+ );
6871
+ }
6872
+ return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}/children`, {
6873
+ query
6874
+ });
6875
+ }
6784
6876
  /**
6785
6877
  * Delete the stored layout; the shop is back on the derived one.
6786
6878
  * `DELETE /checkout-methods/{profile_id}`
@@ -7138,6 +7230,108 @@ var BuyerAccount = class {
7138
7230
  ...options
7139
7231
  });
7140
7232
  }
7233
+ /**
7234
+ * The shops the buyer has purchases at, once each and by name. Pass a
7235
+ * shop's `shop` to `listPurchases` to list only that shop's purchases.
7236
+ */
7237
+ async listShops(options) {
7238
+ return this.request("GET", "/buyer-account/shops", { ...options });
7239
+ }
7240
+ /**
7241
+ * The buyer's subscriptions across shops, newest first. A record the buyer
7242
+ * has not confirmed shows what a receipt carries, without its period or
7243
+ * cancellation.
7244
+ */
7245
+ async listSubscriptions(query, options) {
7246
+ return this.request("GET", "/buyer-account/subscriptions", {
7247
+ query,
7248
+ ...options
7249
+ });
7250
+ }
7251
+ /**
7252
+ * The issued invoices of the records the buyer has confirmed through a
7253
+ * shop's own link, newest first. `unconfirmed_records` says when records
7254
+ * were left out.
7255
+ */
7256
+ async listInvoices(query, options) {
7257
+ return this.request("GET", "/buyer-account/invoices", {
7258
+ query,
7259
+ ...options
7260
+ });
7261
+ }
7262
+ /** The refund requests of the records the buyer has confirmed, newest first, with the shop's decision. */
7263
+ async listRefundRequests(query, options) {
7264
+ return this.request("GET", "/buyer-account/refund-requests", {
7265
+ query,
7266
+ ...options
7267
+ });
7268
+ }
7269
+ /**
7270
+ * The cases of the records the buyer has confirmed: the refund requests
7271
+ * they sent and the disputes about their purchases, newest first, with
7272
+ * where each stands, who acts next, the outcome and the recorded steps.
7273
+ */
7274
+ async listCases(query, options) {
7275
+ return this.request("GET", "/buyer-account/cases", {
7276
+ query,
7277
+ ...options
7278
+ });
7279
+ }
7280
+ /**
7281
+ * The conversations of the records the buyer has confirmed, the latest
7282
+ * message first. `unconfirmed_records` says when other records were left out.
7283
+ */
7284
+ async listConversations(query, options) {
7285
+ return this.request("GET", "/buyer-account/conversations", {
7286
+ query,
7287
+ ...options
7288
+ });
7289
+ }
7290
+ /**
7291
+ * The conversation of a confirmed record with one shop, and its newest
7292
+ * messages, oldest first; `before` pages back. `shop` is required here.
7293
+ */
7294
+ async listRecordMessages(record, query, options) {
7295
+ return this.request("GET", `/buyer-account/records/${encodeURIComponent(record)}/messages`, {
7296
+ query,
7297
+ ...options
7298
+ });
7299
+ }
7300
+ /**
7301
+ * A message from a confirmed record to one of its shops. Sending again with
7302
+ * the same `client_message_id` returns the message the first send stored.
7303
+ */
7304
+ async sendRecordMessage(record, message, options) {
7305
+ return this.request("POST", `/buyer-account/records/${encodeURIComponent(record)}/messages`, {
7306
+ body: message,
7307
+ ...options
7308
+ });
7309
+ }
7310
+ /**
7311
+ * The buyer has read a record's conversation with one shop up to its last
7312
+ * accepted message. Answers with the buyer's conversations as they now stand.
7313
+ */
7314
+ async markRecordMessagesRead(record, query, options) {
7315
+ return this.request(
7316
+ "POST",
7317
+ `/buyer-account/records/${encodeURIComponent(record)}/messages/read`,
7318
+ {
7319
+ query,
7320
+ ...options
7321
+ }
7322
+ );
7323
+ }
7324
+ /**
7325
+ * What the buyer spent in a period: paid purchases summed per currency,
7326
+ * never converted, for the whole period, per day, week or month, per shop
7327
+ * and per kind of purchase.
7328
+ */
7329
+ async analytics(query, options) {
7330
+ return this.request("GET", "/buyer-account/analytics", {
7331
+ query,
7332
+ ...options
7333
+ });
7334
+ }
7141
7335
  /**
7142
7336
  * Confirm the record of a shop's customer portal link for the signed-in
7143
7337
  * buyer. The link's customer must carry the address the buyer signed in
@@ -7166,6 +7360,48 @@ var BuyerPortal = class {
7166
7360
  async getSession(options) {
7167
7361
  return this.request("GET", "/buyer-portal/session", { ...options });
7168
7362
  }
7363
+ /**
7364
+ * The buyer's cases at the shop: the refund requests they sent and the
7365
+ * disputes about their purchases, newest first, with where each stands, who
7366
+ * acts next, the outcome and the recorded steps.
7367
+ */
7368
+ async listCases(options) {
7369
+ return this.request("GET", "/buyer-portal/cases", { ...options });
7370
+ }
7371
+ /**
7372
+ * The buyer's conversations with the shop, the latest message first. A
7373
+ * portal link for the whole merchant lists one per shop and mode.
7374
+ */
7375
+ async listConversations(options) {
7376
+ return this.request("GET", "/buyer-portal/conversations", { ...options });
7377
+ }
7378
+ /**
7379
+ * The conversation with one shop and its newest messages, oldest first;
7380
+ * `before` pages back. A link issued for one shop may leave `shop` out.
7381
+ */
7382
+ async listMessages(query, options) {
7383
+ return this.request("GET", "/buyer-portal/messages", {
7384
+ query,
7385
+ ...options
7386
+ });
7387
+ }
7388
+ /**
7389
+ * A message to the shop. Sending again with the same `client_message_id`
7390
+ * returns the message the first send stored; a closed conversation refuses it.
7391
+ */
7392
+ async sendMessage(message, options) {
7393
+ return this.request("POST", "/buyer-portal/messages", { body: message, ...options });
7394
+ }
7395
+ /**
7396
+ * The buyer has read the conversation with the shop up to its last accepted
7397
+ * message. Answers with the buyer's conversations as they now stand.
7398
+ */
7399
+ async markMessagesRead(query, options) {
7400
+ return this.request("POST", "/buyer-portal/messages/read", {
7401
+ query,
7402
+ ...options
7403
+ });
7404
+ }
7169
7405
  /** The buyer's contact and billing details, and what they may change. */
7170
7406
  async getProfile(options) {
7171
7407
  return this.request("GET", "/buyer-portal/profile", { ...options });
@@ -8293,6 +8529,7 @@ var Delopay = class {
8293
8529
  this.availabilityOverrides = new AvailabilityOverrides(request);
8294
8530
  this.sellToRestrictions = new SellToRestrictions(request);
8295
8531
  this.buyerBlocklist = new BuyerBlocklist(request);
8532
+ this.buyerConversations = new BuyerConversations(request);
8296
8533
  this.checkoutRecovery = new CheckoutRecovery(request);
8297
8534
  this.costRules = new CostRules(request);
8298
8535
  this.externalRecords = new ExternalRecords(request);
@@ -12579,6 +12816,9 @@ function presentationIconSrc(entry, color) {
12579
12816
  if (entry.fallback_icon) return builtinPaymentIconDataUri(entry.fallback_icon, color);
12580
12817
  return null;
12581
12818
  }
12819
+ function isConfirmedChild(child) {
12820
+ return child.source !== "merchant";
12821
+ }
12582
12822
  function isSupportedPresentation(response) {
12583
12823
  return response.contract_version === PRESENTATION_CONTRACT_VERSION;
12584
12824
  }
@@ -13106,6 +13346,7 @@ export {
13106
13346
  AvailabilityOverrides,
13107
13347
  SellToRestrictions,
13108
13348
  BuyerBlocklist,
13349
+ BuyerConversations,
13109
13350
  CheckoutRecovery,
13110
13351
  CostRules,
13111
13352
  ExternalRecords,
@@ -13304,6 +13545,7 @@ export {
13304
13545
  builtinPaymentIconDataUri,
13305
13546
  presentationIconDataUri,
13306
13547
  presentationIconSrc,
13548
+ isConfirmedChild,
13307
13549
  isSupportedPresentation,
13308
13550
  presentationTiers,
13309
13551
  selectableEntries,
@@ -13337,4 +13579,4 @@ export {
13337
13579
  decodeNativePanes,
13338
13580
  encodeNativePanes
13339
13581
  };
13340
- //# sourceMappingURL=chunk-U3KDAIWB.js.map
13582
+ //# sourceMappingURL=chunk-YZCDGNZL.js.map