@vexpay/node 0.15.0 → 0.17.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.js CHANGED
@@ -46,7 +46,7 @@ function messageFrom(body, status) {
46
46
  if (typeof error === "string" && error) return error;
47
47
  }
48
48
  if (typeof body === "string" && body) return body;
49
- return `VEXPay API responded with HTTP ${status}`;
49
+ return `VEX Pay API responded with HTTP ${status}`;
50
50
  }
51
51
  function errorFromResponse(status, body, requestId) {
52
52
  const rawCode = body && typeof body === "object" ? body.error : void 0;
@@ -62,7 +62,7 @@ function errorFromResponse(status, body, requestId) {
62
62
  }
63
63
 
64
64
  // src/version.ts
65
- var VERSION = "0.15.0";
65
+ var VERSION = "0.17.0";
66
66
 
67
67
  // src/core.ts
68
68
  var INITIAL_RETRY_DELAY_MS = 500;
@@ -157,11 +157,11 @@ var HttpClient = class {
157
157
  return await this.config.fetch(url, { ...init, signal: controller.signal });
158
158
  } catch (caught) {
159
159
  if (timedOut) {
160
- throw new VexPayTimeoutError(`Request to VEXPay timed out after ${timeoutMs}ms`);
160
+ throw new VexPayTimeoutError(`Request to VEX Pay timed out after ${timeoutMs}ms`);
161
161
  }
162
162
  if (signal?.aborted) throw caught;
163
163
  const reason = caught instanceof Error ? caught.message : String(caught);
164
- throw new VexPayConnectionError(`Could not reach VEXPay: ${reason}`);
164
+ throw new VexPayConnectionError(`Could not reach VEX Pay: ${reason}`);
165
165
  } finally {
166
166
  clearTimeout(timer);
167
167
  signal?.removeEventListener("abort", onAbort);
@@ -247,6 +247,8 @@ var ROUTES = {
247
247
  Invoices_pay: { method: "POST", path: "/v1/invoices/{id}/pay" },
248
248
  Invoices_retrieve: { method: "GET", path: "/v1/invoices/{id}" },
249
249
  Invoices_void: { method: "POST", path: "/v1/invoices/{id}/void" },
250
+ MarketplaceSettings_get: { method: "GET", path: "/v1/marketplace/settings" },
251
+ MarketplaceSettings_update: { method: "PATCH", path: "/v1/marketplace/settings" },
250
252
  Merchants_addPayoutMethod: { method: "POST", path: "/v1/merchants/{id}/payout-methods" },
251
253
  Merchants_confirmVerify: { method: "POST", path: "/v1/merchants/{id}/verify" },
252
254
  Merchants_confirmVerifyMethod: { method: "POST", path: "/v1/merchants/{id}/payout-methods/{methodId}/verify" },
@@ -570,7 +572,7 @@ var Invoices = class extends APIResource {
570
572
  markUncollectible(id, options) {
571
573
  return this.call("Invoices_markUncollectible", { path: { id } }, options);
572
574
  }
573
- /** Record an open invoice as paid outside VEXPay (`paidOutOfBand: true`); no money moves. */
575
+ /** Record an open invoice as paid outside VEX Pay (`paidOutOfBand: true`); no money moves. */
574
576
  pay(id, params, options) {
575
577
  return this.call("Invoices_pay", { path: { id }, body: params }, options);
576
578
  }
@@ -834,8 +836,18 @@ var PayoutMethods = class extends APIResource {
834
836
  );
835
837
  }
836
838
  };
839
+ var MarketplaceSettings = class extends APIResource {
840
+ retrieve(options) {
841
+ return this.call("MarketplaceSettings_get", {}, options);
842
+ }
843
+ /** `merchantAutoPayoutDefault` and/or `merchantAutoPayoutMinUsd` (USD; null clears it). */
844
+ update(params, options) {
845
+ return this.call("MarketplaceSettings_update", { body: params }, options);
846
+ }
847
+ };
837
848
  var Merchants = class extends APIResource {
838
849
  payoutMethods = new PayoutMethods(this.http);
850
+ marketplaceSettings = new MarketplaceSettings(this.http);
839
851
  /** `externalRef` is required and is the idempotency key for merchant creation. */
840
852
  create(params, options) {
841
853
  return this.call("Merchants_create", { body: params }, options);
@@ -1171,7 +1183,7 @@ var VexPay = class {
1171
1183
  constructor(apiKey, options = {}) {
1172
1184
  if (typeof apiKey !== "string" || apiKey.trim() === "") {
1173
1185
  throw new VexPayConfigurationError(
1174
- "A VEXPay API key is required: new VexPay(process.env.VEXPAY_API_KEY)."
1186
+ "A VEX Pay API key is required: new VexPay(process.env.VEXPAY_API_KEY)."
1175
1187
  );
1176
1188
  }
1177
1189
  const fetchImpl = options.fetch ?? globalThis.fetch;