@delopay/sdk 0.151.0 → 0.153.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
@@ -50,6 +50,7 @@ __export(index_exports, {
50
50
  CUSTOM_FIELD_OPERATORS_BY_SOURCE: () => CUSTOM_FIELD_OPERATORS_BY_SOURCE,
51
51
  CUSTOM_FIELD_VALUELESS_OPERATORS: () => CUSTOM_FIELD_VALUELESS_OPERATORS,
52
52
  Cards: () => Cards,
53
+ CheckoutMethods: () => CheckoutMethods,
53
54
  CheckoutSession: () => CheckoutSession,
54
55
  DEFAULT_BADGES: () => DEFAULT_BADGES,
55
56
  DEFAULT_BADGES_DARK: () => DEFAULT_BADGES_DARK,
@@ -1134,10 +1135,37 @@ var Customers = class {
1134
1135
  };
1135
1136
 
1136
1137
  // src/resources/disputes.ts
1138
+ function workspaceQuery(params) {
1139
+ if (!params) return void 0;
1140
+ const { connector, currency, dispute_status, dispute_stage, ...query } = params;
1141
+ return {
1142
+ ...query,
1143
+ ...connector?.length ? { connector: connector.join(",") } : {},
1144
+ ...currency?.length ? { currency: currency.join(",") } : {},
1145
+ ...dispute_status?.length ? { dispute_status: dispute_status.join(",") } : {},
1146
+ ...dispute_stage?.length ? { dispute_stage: dispute_stage.join(",") } : {}
1147
+ };
1148
+ }
1137
1149
  var Disputes = class {
1138
1150
  constructor(request) {
1139
1151
  this.request = request;
1140
1152
  }
1153
+ /** Read native disputes and provider-only cases once, after shared authorization and filters. */
1154
+ async workspace(params) {
1155
+ return this.request("GET", "/disputes/workspace", { query: workspaceQuery(params) });
1156
+ }
1157
+ /** Read filter options over the same scoped case set; pagination is ignored. */
1158
+ async workspaceFilters(params) {
1159
+ return this.request("GET", "/disputes/workspace/filters", { query: workspaceQuery(params) });
1160
+ }
1161
+ /** Count the filtered case set, including unknown outcomes; pagination is ignored. */
1162
+ async workspaceAggregate(params) {
1163
+ return this.request("GET", "/disputes/workspace/aggregate", { query: workspaceQuery(params) });
1164
+ }
1165
+ /** Export the complete filtered set, or throw on the server's explicit export-limit refusal. */
1166
+ async workspaceExport(params) {
1167
+ return this.request("GET", "/disputes/workspace/export", { query: workspaceQuery(params) });
1168
+ }
1141
1169
  /**
1142
1170
  * Retrieve a dispute by its ID.
1143
1171
  *
@@ -4493,6 +4521,43 @@ var AvailabilityOverrides = class {
4493
4521
  }
4494
4522
  };
4495
4523
 
4524
+ // src/resources/checkoutMethods.ts
4525
+ var CheckoutMethods = class {
4526
+ constructor(request) {
4527
+ this.request = request;
4528
+ }
4529
+ /**
4530
+ * The shop's layout (stored, or derived from its accounts) and every item
4531
+ * it may place. `GET /checkout-methods/{profile_id}`
4532
+ */
4533
+ async retrieve(merchantId, profileId) {
4534
+ return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}`, {
4535
+ query: { merchant_id: merchantId }
4536
+ });
4537
+ }
4538
+ /**
4539
+ * Replace the shop's layout. The router refuses an express item that does
4540
+ * not draw its own button, more than two rows of two in the express strip,
4541
+ * a title without text, or an item no account of the shop offers.
4542
+ * `PUT /checkout-methods/{profile_id}`
4543
+ */
4544
+ async update(merchantId, profileId, body) {
4545
+ return this.request("PUT", `/checkout-methods/${encodeURIComponent(profileId)}`, {
4546
+ query: { merchant_id: merchantId },
4547
+ body
4548
+ });
4549
+ }
4550
+ /**
4551
+ * Delete the stored layout; the shop is back on the derived one.
4552
+ * `DELETE /checkout-methods/{profile_id}`
4553
+ */
4554
+ async reset(merchantId, profileId) {
4555
+ return this.request("DELETE", `/checkout-methods/${encodeURIComponent(profileId)}`, {
4556
+ query: { merchant_id: merchantId }
4557
+ });
4558
+ }
4559
+ };
4560
+
4496
4561
  // src/resources/subscriptions.ts
4497
4562
  var Subscriptions = class {
4498
4563
  constructor(request) {
@@ -5375,6 +5440,7 @@ var Delopay = class {
5375
5440
  this.forex = new Forex(request);
5376
5441
  this.regions = new Regions(request);
5377
5442
  this.availabilityOverrides = new AvailabilityOverrides(request);
5443
+ this.checkoutMethods = new CheckoutMethods(request);
5378
5444
  this.analytics = new Analytics(request);
5379
5445
  this.analyticsDashboard = new AnalyticsDashboard(request);
5380
5446
  this.featureMatrix = new FeatureMatrix(request);
@@ -7771,19 +7837,23 @@ var CheckoutSession = class {
7771
7837
  * discriminated union owned by the consuming checkout, which keeps its
7772
7838
  * own types and runtime gates — hence the loose return type.
7773
7839
  *
7774
- * `theme` is the route's one declared query parameter (a named checkout
7775
- * variant). `locale` travels as `Accept-Language` — the only
7840
+ * `theme` (a named checkout variant) and `country` are the route's declared
7841
+ * query parameters. `country` is a manual override of the buyer country the
7842
+ * router otherwise resolves from the client IP — it decides which payment
7843
+ * methods the layout shows — as an ISO 3166-1 alpha-2 code, sent uppercased
7844
+ * and omitted when empty. `locale` travels as `Accept-Language` — the only
7776
7845
  * channel the backend's locale resolution reads; a `?locale=` query is
7777
7846
  * silently ignored by this route.
7778
7847
  *
7779
7848
  * `GET /payment-link/data/{merchantId}/{paymentId}`
7780
7849
  */
7781
7850
  async fetchCheckoutData(params, options) {
7851
+ const country = params?.country?.trim().toUpperCase();
7782
7852
  return this.client.request(
7783
7853
  "GET",
7784
7854
  `/payment-link/data/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
7785
7855
  {
7786
- query: { theme: params?.theme },
7856
+ query: { theme: params?.theme, country: country || void 0 },
7787
7857
  ...options,
7788
7858
  headers: {
7789
7859
  ...params?.locale ? {
@@ -8091,6 +8161,9 @@ var CheckoutSession = class {
8091
8161
 
8092
8162
  // src/panes.ts
8093
8163
  var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
8164
+ function parseOpenTarget(raw) {
8165
+ return raw === "popup" || raw === "same_page" ? raw : "tab";
8166
+ }
8094
8167
  function parseVisibility(raw) {
8095
8168
  return PANE_VISIBILITIES.find((value) => value === raw) ?? "always";
8096
8169
  }
@@ -8382,7 +8455,7 @@ function decodePanes(raw) {
8382
8455
  // Anything unrecognised degrades to `always` rather than dropping the row.
8383
8456
  visibility: parseVisibility(entry["visibility"]),
8384
8457
  // Same tolerance: an unknown value degrades to the default `tab`.
8385
- openIn: entry["open_in"] === "popup" ? "popup" : "tab",
8458
+ openIn: parseOpenTarget(entry["open_in"]),
8386
8459
  nativeElement: parseNativeElement(entry["native_element"]),
8387
8460
  preset: str(entry["preset"]),
8388
8461
  style: str(entry["style"])
@@ -8437,7 +8510,7 @@ function encodePanes(panes) {
8437
8510
  // never went through `decodePanes`. A decoded pane always holds a valid
8438
8511
  // value, so this is a no-op on the round-trip path.
8439
8512
  visibility: parseVisibility(pane.visibility),
8440
- open_in: pane.openIn === "popup" ? "popup" : "tab",
8513
+ open_in: parseOpenTarget(pane.openIn),
8441
8514
  // Omitted at the default: `everywhere` is what the router decodes an
8442
8515
  // absent key to, so leaving it out changes nothing — and keeps a blob
8443
8516
  // stored before the field existed byte-identical on re-encode, which
@@ -8521,6 +8594,7 @@ var encodeNativePanes = encodePanes;
8521
8594
  CUSTOM_FIELD_OPERATORS_BY_SOURCE,
8522
8595
  CUSTOM_FIELD_VALUELESS_OPERATORS,
8523
8596
  Cards,
8597
+ CheckoutMethods,
8524
8598
  CheckoutSession,
8525
8599
  DEFAULT_BADGES,
8526
8600
  DEFAULT_BADGES_DARK,