@delopay/sdk 0.150.0 → 0.152.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,
@@ -1147,6 +1148,16 @@ var Disputes = class {
1147
1148
  async retrieve(disputeId) {
1148
1149
  return this.request("GET", `/disputes/${encodeURIComponent(disputeId)}`);
1149
1150
  }
1151
+ /** Read declared links and provider-reported refund references. Empty means unknown. */
1152
+ async listRefundAssociations(disputeId) {
1153
+ return this.request("GET", `/disputes/${encodeURIComponent(disputeId)}/refund-associations`);
1154
+ }
1155
+ /** Declare or clear an allocation against a successful refund of this payment. */
1156
+ async setRefundAssociation(disputeId, params) {
1157
+ return this.request("PUT", `/disputes/${encodeURIComponent(disputeId)}/refund-associations`, {
1158
+ body: params
1159
+ });
1160
+ }
1150
1161
  /**
1151
1162
  * List disputes, optionally filtered by status, stage, or date range.
1152
1163
  *
@@ -4483,6 +4494,43 @@ var AvailabilityOverrides = class {
4483
4494
  }
4484
4495
  };
4485
4496
 
4497
+ // src/resources/checkoutMethods.ts
4498
+ var CheckoutMethods = class {
4499
+ constructor(request) {
4500
+ this.request = request;
4501
+ }
4502
+ /**
4503
+ * The shop's layout (stored, or derived from its accounts) and every item
4504
+ * it may place. `GET /checkout-methods/{profile_id}`
4505
+ */
4506
+ async retrieve(merchantId, profileId) {
4507
+ return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}`, {
4508
+ query: { merchant_id: merchantId }
4509
+ });
4510
+ }
4511
+ /**
4512
+ * Replace the shop's layout. The router refuses an express item that does
4513
+ * not draw its own button, more than two rows of two in the express strip,
4514
+ * a title without text, or an item no account of the shop offers.
4515
+ * `PUT /checkout-methods/{profile_id}`
4516
+ */
4517
+ async update(merchantId, profileId, body) {
4518
+ return this.request("PUT", `/checkout-methods/${encodeURIComponent(profileId)}`, {
4519
+ query: { merchant_id: merchantId },
4520
+ body
4521
+ });
4522
+ }
4523
+ /**
4524
+ * Delete the stored layout; the shop is back on the derived one.
4525
+ * `DELETE /checkout-methods/{profile_id}`
4526
+ */
4527
+ async reset(merchantId, profileId) {
4528
+ return this.request("DELETE", `/checkout-methods/${encodeURIComponent(profileId)}`, {
4529
+ query: { merchant_id: merchantId }
4530
+ });
4531
+ }
4532
+ };
4533
+
4486
4534
  // src/resources/subscriptions.ts
4487
4535
  var Subscriptions = class {
4488
4536
  constructor(request) {
@@ -5365,6 +5413,7 @@ var Delopay = class {
5365
5413
  this.forex = new Forex(request);
5366
5414
  this.regions = new Regions(request);
5367
5415
  this.availabilityOverrides = new AvailabilityOverrides(request);
5416
+ this.checkoutMethods = new CheckoutMethods(request);
5368
5417
  this.analytics = new Analytics(request);
5369
5418
  this.analyticsDashboard = new AnalyticsDashboard(request);
5370
5419
  this.featureMatrix = new FeatureMatrix(request);
@@ -7761,19 +7810,23 @@ var CheckoutSession = class {
7761
7810
  * discriminated union owned by the consuming checkout, which keeps its
7762
7811
  * own types and runtime gates — hence the loose return type.
7763
7812
  *
7764
- * `theme` is the route's one declared query parameter (a named checkout
7765
- * variant). `locale` travels as `Accept-Language` — the only
7813
+ * `theme` (a named checkout variant) and `country` are the route's declared
7814
+ * query parameters. `country` is a manual override of the buyer country the
7815
+ * router otherwise resolves from the client IP — it decides which payment
7816
+ * methods the layout shows — as an ISO 3166-1 alpha-2 code, sent uppercased
7817
+ * and omitted when empty. `locale` travels as `Accept-Language` — the only
7766
7818
  * channel the backend's locale resolution reads; a `?locale=` query is
7767
7819
  * silently ignored by this route.
7768
7820
  *
7769
7821
  * `GET /payment-link/data/{merchantId}/{paymentId}`
7770
7822
  */
7771
7823
  async fetchCheckoutData(params, options) {
7824
+ const country = params?.country?.trim().toUpperCase();
7772
7825
  return this.client.request(
7773
7826
  "GET",
7774
7827
  `/payment-link/data/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
7775
7828
  {
7776
- query: { theme: params?.theme },
7829
+ query: { theme: params?.theme, country: country || void 0 },
7777
7830
  ...options,
7778
7831
  headers: {
7779
7832
  ...params?.locale ? {
@@ -8081,6 +8134,9 @@ var CheckoutSession = class {
8081
8134
 
8082
8135
  // src/panes.ts
8083
8136
  var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
8137
+ function parseOpenTarget(raw) {
8138
+ return raw === "popup" || raw === "same_page" ? raw : "tab";
8139
+ }
8084
8140
  function parseVisibility(raw) {
8085
8141
  return PANE_VISIBILITIES.find((value) => value === raw) ?? "always";
8086
8142
  }
@@ -8372,7 +8428,7 @@ function decodePanes(raw) {
8372
8428
  // Anything unrecognised degrades to `always` rather than dropping the row.
8373
8429
  visibility: parseVisibility(entry["visibility"]),
8374
8430
  // Same tolerance: an unknown value degrades to the default `tab`.
8375
- openIn: entry["open_in"] === "popup" ? "popup" : "tab",
8431
+ openIn: parseOpenTarget(entry["open_in"]),
8376
8432
  nativeElement: parseNativeElement(entry["native_element"]),
8377
8433
  preset: str(entry["preset"]),
8378
8434
  style: str(entry["style"])
@@ -8427,7 +8483,7 @@ function encodePanes(panes) {
8427
8483
  // never went through `decodePanes`. A decoded pane always holds a valid
8428
8484
  // value, so this is a no-op on the round-trip path.
8429
8485
  visibility: parseVisibility(pane.visibility),
8430
- open_in: pane.openIn === "popup" ? "popup" : "tab",
8486
+ open_in: parseOpenTarget(pane.openIn),
8431
8487
  // Omitted at the default: `everywhere` is what the router decodes an
8432
8488
  // absent key to, so leaving it out changes nothing — and keeps a blob
8433
8489
  // stored before the field existed byte-identical on re-encode, which
@@ -8511,6 +8567,7 @@ var encodeNativePanes = encodePanes;
8511
8567
  CUSTOM_FIELD_OPERATORS_BY_SOURCE,
8512
8568
  CUSTOM_FIELD_VALUELESS_OPERATORS,
8513
8569
  Cards,
8570
+ CheckoutMethods,
8514
8571
  CheckoutSession,
8515
8572
  DEFAULT_BADGES,
8516
8573
  DEFAULT_BADGES_DARK,