@delopay/sdk 0.388.0 → 0.390.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.
@@ -370,6 +370,21 @@ var Authentication = class {
370
370
  }
371
371
  };
372
372
 
373
+ // src/listQuery.ts
374
+ function csvQuery(params, csvKeys) {
375
+ if (!params) return void 0;
376
+ const joined = csvKeys;
377
+ const query = {};
378
+ for (const [key, value] of Object.entries(params)) {
379
+ if (!joined.includes(key) || !Array.isArray(value)) {
380
+ query[key] = value;
381
+ } else if (value.length > 0) {
382
+ query[key] = value.join(",");
383
+ }
384
+ }
385
+ return query;
386
+ }
387
+
373
388
  // src/resources/billing.ts
374
389
  var BillingAllocations = class {
375
390
  constructor(request) {
@@ -485,15 +500,17 @@ var Billing = class {
485
500
  });
486
501
  }
487
502
  /**
488
- * List the balance ledger (credits and debits) for a merchant.
503
+ * List the balance ledger (credits and debits) for a merchant, the newest
504
+ * entry first unless `sort_by` says otherwise.
489
505
  *
490
506
  * @param merchantId - The merchant account ID.
491
- * @param params - Optional pagination parameters.
507
+ * @param params - Optional pagination, filters (entry types, a creation
508
+ * window) and sort.
492
509
  * @returns The ledger entries.
493
510
  */
494
511
  async listLedger(merchantId, params) {
495
512
  return this.request("GET", `/billing/${encodeURIComponent(merchantId)}/ledger`, {
496
- query: params
513
+ query: csvQuery(params, ["entry_type"])
497
514
  });
498
515
  }
499
516
  /**
@@ -4959,13 +4976,16 @@ var Users = class {
4959
4976
  *
4960
4977
  * Returns an empty page when a Delopay admin is impersonating a merchant,
4961
4978
  * so the admin's metadata is not exposed inside the merchant dashboard.
4979
+ *
4980
+ * Newest first unless `sort_by` says otherwise. Several `event_type` or
4981
+ * `auth_method` values match an event with any of them.
4962
4982
  */
4963
4983
  async listLoginActivity(params) {
4964
4984
  if (params === void 0) {
4965
4985
  return this.request("GET", "/user/me/login-activity");
4966
4986
  }
4967
4987
  return this.request("GET", "/user/me/login-activity", {
4968
- query: params
4988
+ query: csvQuery(params, ["event_type", "auth_method"])
4969
4989
  });
4970
4990
  }
4971
4991
  /**
@@ -5829,14 +5849,16 @@ var IdentityVerifications = class {
5829
5849
  return this.request("POST", "/identity-verifications", { body: params, ...options });
5830
5850
  }
5831
5851
  /**
5832
- * The merchant's verifications, newest first. A caller limited to one shop
5833
- * sees that shop's only.
5852
+ * The merchant's verifications, newest first unless `sort_by` says
5853
+ * otherwise. A caller limited to one shop sees that shop's only. Several
5854
+ * `outcome`, `kind` or `merchant_connector_id` values match a verification
5855
+ * with any of them.
5834
5856
  *
5835
5857
  * `GET /identity-verifications`
5836
5858
  */
5837
5859
  async list(query, options) {
5838
5860
  return this.request("GET", "/identity-verifications", {
5839
- query,
5861
+ query: csvQuery(query, ["outcome", "kind", "merchant_connector_id"]),
5840
5862
  ...options
5841
5863
  });
5842
5864
  }
@@ -6620,7 +6642,13 @@ var Export = class {
6620
6642
  );
6621
6643
  }
6622
6644
  async auditLog(params, options) {
6623
- return runExport(this.request, "GET", "/audit/export", queried(params), options);
6645
+ return runExport(
6646
+ this.request,
6647
+ "GET",
6648
+ "/audit/export",
6649
+ { query: csvQuery(params, ["profile_id", "action", "entity_type"]) },
6650
+ options
6651
+ );
6624
6652
  }
6625
6653
  };
6626
6654
  function queried(params, headers) {
@@ -6917,14 +6945,15 @@ var BuyerBlocklist = class {
6917
6945
  this.request = request;
6918
6946
  }
6919
6947
  /**
6920
- * One page of blocked buyers, newest first, filtered by scope, by `kind`
6921
- * (the entries that include an identifier of that kind) and by a search
6922
- * over every identifier and the note. Expired entries are not listed.
6948
+ * One page of blocked buyers, newest first unless `sort_by` says otherwise,
6949
+ * filtered by scope, by `kind` (the entries that include an identifier of
6950
+ * that kind, or of any of several) and by a search over every identifier
6951
+ * and the note. Expired entries are not listed.
6923
6952
  * `GET /buyer-blocklist`
6924
6953
  */
6925
6954
  async list(params) {
6926
6955
  return this.request("GET", "/buyer-blocklist", {
6927
- query: params
6956
+ query: csvQuery(params, ["kind"])
6928
6957
  });
6929
6958
  }
6930
6959
  /**
@@ -7050,6 +7079,56 @@ var BuyerBlocklist = class {
7050
7079
  }
7051
7080
  };
7052
7081
 
7082
+ // src/resources/persons.ts
7083
+ var Persons = class {
7084
+ constructor(request) {
7085
+ this.request = request;
7086
+ }
7087
+ /**
7088
+ * One page of persons, by default the most recent payment first, with the
7089
+ * number of persons the request matches.
7090
+ * `GET /persons`
7091
+ */
7092
+ async list(params) {
7093
+ return this.request("GET", "/persons", { query: params });
7094
+ }
7095
+ /**
7096
+ * One person: its figures, the identifiers and IP addresses its payments
7097
+ * carry, and its payments by status, shop, payment method, risk band and
7098
+ * environment. The id of a person that was merged into another returns
7099
+ * that person, with `merged_from` naming the id asked for. A person with
7100
+ * no payment in the scope is not found (`404`).
7101
+ * `GET /persons/{person_id}`
7102
+ */
7103
+ async retrieve(personId, params) {
7104
+ return this.request("GET", `/persons/${encodeURIComponent(personId)}`, {
7105
+ query: params
7106
+ });
7107
+ }
7108
+ /**
7109
+ * Other persons of the merchant that may be the same person, the likeliest
7110
+ * first, at most 20. An estimate from the devices the persons paid with;
7111
+ * related persons stay separate persons.
7112
+ * `GET /persons/{person_id}/related`
7113
+ */
7114
+ async related(personId, params) {
7115
+ return this.request("GET", `/persons/${encodeURIComponent(personId)}/related`, {
7116
+ query: params
7117
+ });
7118
+ }
7119
+ /**
7120
+ * The person of one payment, with how many payments the person has and
7121
+ * which kinds of identifier tie this payment to the others. `404` while
7122
+ * the payment has no person yet.
7123
+ * `GET /persons/payment/{payment_id}`
7124
+ */
7125
+ async ofPayment(paymentId, params) {
7126
+ return this.request("GET", `/persons/payment/${encodeURIComponent(paymentId)}`, {
7127
+ query: params
7128
+ });
7129
+ }
7130
+ };
7131
+
7053
7132
  // src/resources/shopLabels.ts
7054
7133
  var labelsPath = (merchantId) => `/account/${encodeURIComponent(merchantId)}/business-profile/labels`;
7055
7134
  var ShopLabels = class {
@@ -7302,12 +7381,13 @@ var BuyerConversations = class {
7302
7381
  this.request = request;
7303
7382
  }
7304
7383
  /**
7305
- * One page of the inbox, the latest message first, filtered by shop,
7306
- * status, assignee, mode or buyer. `GET /buyer-conversations`
7384
+ * One page of the inbox, the latest message first unless `sort_by` says
7385
+ * otherwise, filtered by shop, status (one or several), assignee, mode or
7386
+ * buyer. `GET /buyer-conversations`
7307
7387
  */
7308
7388
  async list(params) {
7309
7389
  return this.request("GET", "/buyer-conversations", {
7310
- query: params
7390
+ query: csvQuery(params, ["status"])
7311
7391
  });
7312
7392
  }
7313
7393
  /**
@@ -7418,12 +7498,14 @@ var BuyerEvidenceReviews = class {
7418
7498
  this.request = request;
7419
7499
  }
7420
7500
  /**
7421
- * The shop's cases with buyer evidence, the nearest target first.
7422
- * `merchant_id` and `reviewer` are ignored here. `GET /buyer-evidence`
7501
+ * The shop's cases with buyer evidence, the nearest target first unless
7502
+ * `sort_by` says otherwise. Several `state` values match a case in any of
7503
+ * them. `merchant_id` and `reviewer` are ignored here, and so are the
7504
+ * `merchant` and `reviewer` sorts. `GET /buyer-evidence`
7423
7505
  */
7424
7506
  async list(params) {
7425
7507
  return this.request("GET", "/buyer-evidence", {
7426
- query: params
7508
+ query: csvQuery(params, ["state"])
7427
7509
  });
7428
7510
  }
7429
7511
  /** One case's evidence with its history and files. `GET /buyer-evidence/{id}` */
@@ -8195,10 +8277,14 @@ var Support = class {
8195
8277
  async create(body) {
8196
8278
  return this.request("POST", "/support/conversations", { body });
8197
8279
  }
8198
- /** The conversations the caller may read. `GET /support/conversations` */
8280
+ /**
8281
+ * The conversations the caller may read, the latest message first unless
8282
+ * `sort_by` says otherwise. Several `kind`, `category` or `status` values
8283
+ * match a conversation with any of them. `GET /support/conversations`
8284
+ */
8199
8285
  async list(query) {
8200
8286
  return this.request("GET", "/support/conversations", {
8201
- query: query === void 0 ? void 0 : { ...query }
8287
+ query: csvQuery(query, ["kind", "category", "status"])
8202
8288
  });
8203
8289
  }
8204
8290
  /** One conversation. `GET /support/conversations/{id}` */
@@ -8249,6 +8335,7 @@ var Support = class {
8249
8335
  };
8250
8336
 
8251
8337
  // src/resources/invoices.ts
8338
+ var INVOICE_CSV_KEYS = ["status", "kind"];
8252
8339
  var Invoices = class {
8253
8340
  constructor(request) {
8254
8341
  this.request = request;
@@ -8268,13 +8355,15 @@ var Invoices = class {
8268
8355
  return this.request("POST", "/invoices", { body: params, ...options });
8269
8356
  }
8270
8357
  /**
8271
- * One page of documents, newest first. List rows carry no `lines` unless
8272
- * `include_lines` is set, and never a `refund` summary.
8358
+ * One page of documents, newest first unless `sort_by` says otherwise. List
8359
+ * rows carry no `lines` unless `include_lines` is set, and never a `refund`
8360
+ * summary. Several `status` or `kind` values match a document in any of
8361
+ * them.
8273
8362
  * `GET /invoices`
8274
8363
  */
8275
8364
  async list(params, options) {
8276
8365
  return this.request("GET", "/invoices", {
8277
- query: params === void 0 ? void 0 : { ...params },
8366
+ query: csvQuery(params, INVOICE_CSV_KEYS),
8278
8367
  ...options
8279
8368
  });
8280
8369
  }
@@ -8299,7 +8388,7 @@ var Invoices = class {
8299
8388
  */
8300
8389
  async listForProduct(productId, params, options) {
8301
8390
  return this.request("GET", `/products/${encodeURIComponent(productId)}/invoices`, {
8302
- query: params === void 0 ? void 0 : { ...params },
8391
+ query: csvQuery(params, INVOICE_CSV_KEYS),
8303
8392
  ...options
8304
8393
  });
8305
8394
  }
@@ -8317,7 +8406,7 @@ var Invoices = class {
8317
8406
  */
8318
8407
  async export(params, options) {
8319
8408
  return this.request("GET", "/invoices/export", {
8320
- query: { ...params },
8409
+ query: csvQuery(params, INVOICE_CSV_KEYS),
8321
8410
  responseType: "blob",
8322
8411
  ...options
8323
8412
  });
@@ -9012,7 +9101,10 @@ var Subscriptions = class {
9012
9101
  ...options
9013
9102
  });
9014
9103
  }
9015
- /** List subscriptions for the profile. `GET /subscriptions/list` */
9104
+ /**
9105
+ * List subscriptions for the profile, or one customer's with `customer_id`.
9106
+ * `GET /subscriptions/list`
9107
+ */
9016
9108
  async list(params, options) {
9017
9109
  return this.request("GET", "/subscriptions/list", {
9018
9110
  query: params,
@@ -9808,13 +9900,19 @@ var BuyerPortal = class {
9808
9900
  };
9809
9901
 
9810
9902
  // src/resources/audit.ts
9903
+ var MERCHANT_AUDIT_CSV_KEYS = ["profile_id", "action", "entity_type"];
9811
9904
  var Audit = class {
9812
9905
  constructor(request) {
9813
9906
  this.request = request;
9814
9907
  }
9908
+ /**
9909
+ * One page of the merchant's audit log, the newest entry first unless
9910
+ * `sort_by` says otherwise. Several `profile_id`, `action` or `entity_type`
9911
+ * values match an entry with any of them. `GET /audit`
9912
+ */
9815
9913
  async list(params) {
9816
9914
  return this.request("GET", "/audit", {
9817
- query: params
9915
+ query: csvQuery(params, MERCHANT_AUDIT_CSV_KEYS)
9818
9916
  });
9819
9917
  }
9820
9918
  /**
@@ -9827,6 +9925,33 @@ var Audit = class {
9827
9925
  };
9828
9926
 
9829
9927
  // src/resources/settlement.ts
9928
+ function statementListQuery(params) {
9929
+ return csvQuery(
9930
+ {
9931
+ test_mode: params.test_mode,
9932
+ profile_id: params.profile_id,
9933
+ limit: params.limit,
9934
+ offset: params.offset,
9935
+ payout_status: params.payout_status,
9936
+ period_from: params.period_from,
9937
+ period_to: params.period_to,
9938
+ sort_by: params.sort_by,
9939
+ sort_order: params.sort_order
9940
+ },
9941
+ ["payout_status"]
9942
+ );
9943
+ }
9944
+ function nativeListQuery(params) {
9945
+ return {
9946
+ profile_id: params.profile_id,
9947
+ currency: params.currency,
9948
+ test_mode: params.test_mode,
9949
+ limit: params.limit,
9950
+ offset: params.offset,
9951
+ sort_by: params.sort_by,
9952
+ sort_order: params.sort_order
9953
+ };
9954
+ }
9830
9955
  function exportHeaders(options, accept) {
9831
9956
  const headers = new Headers(options?.headers);
9832
9957
  headers.set("Accept", accept);
@@ -9990,18 +10115,15 @@ var Settlement = class {
9990
10115
  });
9991
10116
  }
9992
10117
  /**
9993
- * List generated settlement statements, newest first.
10118
+ * List generated settlement statements, the newest period first unless
10119
+ * `sort_by` says otherwise. Several `payout_status` values match a
10120
+ * statement in any of them.
9994
10121
  *
9995
10122
  * `GET /settlement/statements`
9996
10123
  */
9997
10124
  async listStatements(params, options) {
9998
10125
  return this.request("GET", "/settlement/statements", {
9999
- query: {
10000
- test_mode: params.test_mode,
10001
- profile_id: params.profile_id,
10002
- limit: params.limit,
10003
- offset: params.offset
10004
- },
10126
+ query: statementListQuery(params),
10005
10127
  ...options
10006
10128
  });
10007
10129
  }
@@ -10258,16 +10380,14 @@ var Settlement = class {
10258
10380
  options
10259
10381
  );
10260
10382
  }
10261
- /** List report summaries without fetching every source row in each saved snapshot. */
10383
+ /**
10384
+ * List report summaries without fetching every source row in each saved
10385
+ * snapshot, the newest first. `sort_by` takes `period` here; another value
10386
+ * is refused.
10387
+ */
10262
10388
  async listNativeReports(params, options) {
10263
10389
  return this.request("GET", "/settlement/native/reports", {
10264
- query: {
10265
- profile_id: params.profile_id,
10266
- currency: params.currency,
10267
- test_mode: params.test_mode,
10268
- limit: params.limit,
10269
- offset: params.offset
10270
- },
10390
+ query: nativeListQuery(params),
10271
10391
  ...options
10272
10392
  });
10273
10393
  }
@@ -10285,15 +10405,13 @@ var Settlement = class {
10285
10405
  bodyIdempotencyKey: params.idempotency_key
10286
10406
  });
10287
10407
  }
10408
+ /**
10409
+ * List recorded payouts, the earliest value date first. `sort_by` takes
10410
+ * `value_date` or `amount` here; another value is refused.
10411
+ */
10288
10412
  async listNativePayouts(params, options) {
10289
10413
  return this.request("GET", "/settlement/native/payouts", {
10290
- query: {
10291
- profile_id: params.profile_id,
10292
- currency: params.currency,
10293
- test_mode: params.test_mode,
10294
- limit: params.limit,
10295
- offset: params.offset
10296
- },
10414
+ query: nativeListQuery(params),
10297
10415
  ...options
10298
10416
  });
10299
10417
  }
@@ -11247,6 +11365,7 @@ var Delopay = class {
11247
11365
  this.availabilityOverrides = new AvailabilityOverrides(request);
11248
11366
  this.sellToRestrictions = new SellToRestrictions(request);
11249
11367
  this.buyerBlocklist = new BuyerBlocklist(request);
11368
+ this.persons = new Persons(request);
11250
11369
  this.shopLabels = new ShopLabels(request);
11251
11370
  this.industries = new Industries(request);
11252
11371
  this.checkoutTemplates = new CheckoutTemplates(request);
@@ -17237,6 +17356,7 @@ var encodeNativePanes = encodePanes;
17237
17356
  export {
17238
17357
  DelopayError,
17239
17358
  DelopayAuthenticationError,
17359
+ csvQuery,
17240
17360
  runExport,
17241
17361
  preventionCaseQuery,
17242
17362
  ChargebackPrevention,
@@ -17258,6 +17378,7 @@ export {
17258
17378
  AvailabilityOverrides,
17259
17379
  SellToRestrictions,
17260
17380
  BuyerBlocklist,
17381
+ Persons,
17261
17382
  ShopLabels,
17262
17383
  Industries,
17263
17384
  CheckoutTemplates,
@@ -17274,6 +17395,7 @@ export {
17274
17395
  CheckoutMethods,
17275
17396
  Subscriptions,
17276
17397
  Audit,
17398
+ statementListQuery,
17277
17399
  Settlement,
17278
17400
  OperationLimits,
17279
17401
  Settings,
@@ -17539,4 +17661,4 @@ export {
17539
17661
  decodeNativePanes,
17540
17662
  encodeNativePanes
17541
17663
  };
17542
- //# sourceMappingURL=chunk-A6CXJOUK.js.map
17664
+ //# sourceMappingURL=chunk-PE7G347M.js.map