@vexpay/node 0.6.0 → 0.8.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/README.md +14 -3
- package/dist/index.cjs +25 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +407 -37
- package/dist/index.d.ts +407 -37
- package/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -146,9 +146,9 @@ await vexpay.crypto.payouts.create({
|
|
|
146
146
|
|
|
147
147
|
Responses and events include `currency`, `amount` and `fee` for both coins (`amountUsdt` / `feeUsdt` stay on USDT only). Credit your customer in the `currency` the webhook reports.
|
|
148
148
|
|
|
149
|
-
## Convert VES to USDT
|
|
149
|
+
## Convert VES or COP to USDT
|
|
150
150
|
|
|
151
|
-
Turn available VES into your USDT balance. A quote locks the rate (market USDT
|
|
151
|
+
Turn available VES or Colombian pesos into your USDT balance. A quote locks the rate (market USDT rate in that currency plus your spread) for 60 seconds; accepting it debits the source at once (`conversion.created`) and returns a `PENDING` conversion. VEXPay then delivers the USDT and sends `conversion.completed` (or `conversion.canceled`, with the VES or COP returned). Conversions are on for every account that has USDT enabled (COP also needs COP enabled) — otherwise the calls fail with `conversions_not_enabled` (403). In test mode they complete immediately. COP amounts are whole pesos.
|
|
152
152
|
|
|
153
153
|
```ts
|
|
154
154
|
import VexPay from '@vexpay/node';
|
|
@@ -164,9 +164,15 @@ const conversion = await vexpay.conversions.create(
|
|
|
164
164
|
);
|
|
165
165
|
|
|
166
166
|
for await (const c of vexpay.conversions.list({ status: 'PENDING' })) {
|
|
167
|
-
console.log(c.id, c.
|
|
167
|
+
console.log(c.id, c.sourceAmount, c.sourceCurrency, '→', c.targetAmountUsdt);
|
|
168
168
|
}
|
|
169
169
|
await vexpay.conversions.cancel(conversion.id); // only while PENDING
|
|
170
|
+
|
|
171
|
+
// Colombian pesos: same flow with sourceCurrency 'COP'.
|
|
172
|
+
const copQuote = await vexpay.conversions.quotes.create({ sourceCurrency: 'COP', sourceAmount: '1000000' });
|
|
173
|
+
|
|
174
|
+
// Auto-convert 50% of each completed COP payment (after the fee) to USDT; 0 turns it off.
|
|
175
|
+
await vexpay.conversions.settings.update({ autoConvert: { COP: { percent: 50 } } });
|
|
170
176
|
```
|
|
171
177
|
|
|
172
178
|
## Colombian pesos (COP)
|
|
@@ -213,6 +219,10 @@ const { availableCop } = await vexpay.cop.balance.retrieve();
|
|
|
213
219
|
| Nequi | Any valid data, e.g. phone `3001234567`, `CC` `1234567890`, any email | Completes on its own within about a minute |
|
|
214
220
|
| Daviplata | Same buyer data (`CC`, `CE` or `TI` only) | OTP `123456`, `000000` or `111111` completes it; any other code fails with `invalid_otp` |
|
|
215
221
|
|
|
222
|
+
## Testing card payments
|
|
223
|
+
|
|
224
|
+
With a test API key, VPOS test cards return a fixed outcome without reaching the bank: `4242424242424242` succeeds, `4000000000009995` is declined with `G51` (insufficient funds), `4000000000000259` completes and is then charged back, and more. A decline fails exactly like a live one (422, the bank code in `code` and `failureCode`, a `payment.failed` webhook). With a live key these numbers are refused with 400 `test_card_in_live_mode`. Full list: [test cards](https://docs.pay.vexwallet.co/vpos#test-card).
|
|
225
|
+
|
|
216
226
|
## Webhooks
|
|
217
227
|
|
|
218
228
|
VEXPay signs every delivery with a `VexPay-Signature` header. Verify it with the **raw** request body — parsing and re-serializing JSON changes the bytes and breaks the signature.
|
|
@@ -400,6 +410,7 @@ console.log(describe, {} as NewPayout, {} as Session);
|
|
|
400
410
|
| `crypto.payouts` | `create`, `retrieve` |
|
|
401
411
|
| `conversions` | `create`, `list`, `retrieve`, `cancel` |
|
|
402
412
|
| `conversions.quotes` | `create` |
|
|
413
|
+
| `conversions.settings` | `retrieve`, `update` |
|
|
403
414
|
| `cop.payments` | `create`, `retrieve`, `submitOtp`, `cancel`, `refund` |
|
|
404
415
|
| `cop.balance` | `retrieve` |
|
|
405
416
|
| `merchants` | `create`, `list`, `retrieve`, `retrieveByRef`, `update`, `delete`, `retrieveBalance`, `transfer`, `listAuditEvents`, `startVerification`, `confirmVerification` |
|
package/dist/index.cjs
CHANGED
|
@@ -107,7 +107,7 @@ function errorFromResponse(status, body, requestId) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// src/version.ts
|
|
110
|
-
var VERSION = "0.
|
|
110
|
+
var VERSION = "0.8.0";
|
|
111
111
|
|
|
112
112
|
// src/core.ts
|
|
113
113
|
var INITIAL_RETRY_DELAY_MS = 500;
|
|
@@ -266,6 +266,8 @@ var ROUTES = {
|
|
|
266
266
|
Conversions_createQuote: { method: "POST", path: "/v1/conversions/quotes" },
|
|
267
267
|
Conversions_get: { method: "GET", path: "/v1/conversions/{id}" },
|
|
268
268
|
Conversions_list: { method: "GET", path: "/v1/conversions" },
|
|
269
|
+
ConversionSettings_get: { method: "GET", path: "/v1/conversions/settings" },
|
|
270
|
+
ConversionSettings_update: { method: "PATCH", path: "/v1/conversions/settings" },
|
|
269
271
|
CopPayments_balance: { method: "GET", path: "/v1/cop/balance" },
|
|
270
272
|
CopPayments_cancel: { method: "POST", path: "/v1/cop/payments/{id}/cancel" },
|
|
271
273
|
CopPayments_create: { method: "POST", path: "/v1/cop/payments" },
|
|
@@ -305,6 +307,7 @@ var ROUTES = {
|
|
|
305
307
|
Payments_getPayment: { method: "GET", path: "/v1/payments/{id}" },
|
|
306
308
|
Payments_getPaymentByRef: { method: "GET", path: "/v1/payments/by-ref/{externalRef}" },
|
|
307
309
|
Payments_getQuote: { method: "GET", path: "/v1/quote" },
|
|
310
|
+
Payments_listPaymentMethods: { method: "GET", path: "/v1/payment-methods" },
|
|
308
311
|
Payments_requestC2p: { method: "POST", path: "/v1/payments/c2p/request" },
|
|
309
312
|
Payments_reversePayment: { method: "POST", path: "/v1/payments/{id}/reverse" },
|
|
310
313
|
Payments_verifyPagoMovil: { method: "POST", path: "/v1/payments/pago-movil/verify" },
|
|
@@ -511,13 +514,26 @@ var PaymentLinks = class extends APIResource {
|
|
|
511
514
|
|
|
512
515
|
// src/resources/conversions.ts
|
|
513
516
|
var ConversionQuotes = class extends APIResource {
|
|
514
|
-
/**
|
|
517
|
+
/**
|
|
518
|
+
* `sourceCurrency` is `'VES'` (default) or `'COP'`. Send `sourceAmount` (to spend; COP in whole pesos)
|
|
519
|
+
* or `targetAmountUsdt` (USDT to receive) — exactly one. VES may still use `sourceAmountVes`.
|
|
520
|
+
*/
|
|
515
521
|
create(params, options) {
|
|
516
522
|
return this.call("Conversions_createQuote", { body: params }, options);
|
|
517
523
|
}
|
|
518
524
|
};
|
|
525
|
+
var ConversionSettings = class extends APIResource {
|
|
526
|
+
retrieve(options) {
|
|
527
|
+
return this.call("ConversionSettings_get", {}, options);
|
|
528
|
+
}
|
|
529
|
+
/** Only `autoConvert.COP.percent` (0–100, whole number; 0 = off) can be changed. */
|
|
530
|
+
update(params, options) {
|
|
531
|
+
return this.call("ConversionSettings_update", { body: params }, options);
|
|
532
|
+
}
|
|
533
|
+
};
|
|
519
534
|
var Conversions = class extends APIResource {
|
|
520
535
|
quotes = new ConversionQuotes(this.http);
|
|
536
|
+
settings = new ConversionSettings(this.http);
|
|
521
537
|
/** Accept a quote (`quoteId`). Pass `idempotencyKey` in options to retry safely. */
|
|
522
538
|
create(params, options) {
|
|
523
539
|
return this.call("Conversions_create", { body: params }, options);
|
|
@@ -525,14 +541,14 @@ var Conversions = class extends APIResource {
|
|
|
525
541
|
retrieve(id, options) {
|
|
526
542
|
return this.call("Conversions_get", { path: { id } }, options);
|
|
527
543
|
}
|
|
528
|
-
/** Await for one page, or `for await` over every conversion (newest first). */
|
|
544
|
+
/** Await for one page, or `for await` over every conversion (newest first). Filter with `sourceCurrency`. */
|
|
529
545
|
list(params = {}, options) {
|
|
530
546
|
return new PagePromise(
|
|
531
547
|
(cursor) => this.call("Conversions_list", { query: { ...params, cursor } }, options),
|
|
532
548
|
params.cursor
|
|
533
549
|
);
|
|
534
550
|
}
|
|
535
|
-
/** Cancel a `PENDING` conversion; the VES returns to your available balance. */
|
|
551
|
+
/** Cancel a `PENDING` conversion; the VES or COP returns to your available balance. */
|
|
536
552
|
cancel(id, options) {
|
|
537
553
|
return this.call("Conversions_cancel", { path: { id } }, options);
|
|
538
554
|
}
|
|
@@ -762,6 +778,10 @@ var Payments = class extends APIResource {
|
|
|
762
778
|
operations = new Operations(this.http);
|
|
763
779
|
dispersals = new Dispersals(this.http);
|
|
764
780
|
change = new Change(this.http);
|
|
781
|
+
/** Bolívar methods your account can take now (`pago_movil`, `c2p`, `vpos`), with a reason when unavailable. */
|
|
782
|
+
methods(options) {
|
|
783
|
+
return this.call("Payments_listPaymentMethods", {}, options);
|
|
784
|
+
}
|
|
765
785
|
retrieve(id, options) {
|
|
766
786
|
return this.call("Payments_getPayment", { path: { id } }, options);
|
|
767
787
|
}
|
|
@@ -799,6 +819,7 @@ var WEBHOOK_EVENT_NAMES = [
|
|
|
799
819
|
"merchant.wallet_credit",
|
|
800
820
|
"payout.completed",
|
|
801
821
|
"payout.failed",
|
|
822
|
+
"conversion.created",
|
|
802
823
|
"conversion.completed",
|
|
803
824
|
"conversion.canceled",
|
|
804
825
|
"tenant.status_changed",
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/version.ts","../src/core.ts","../src/pagination.ts","../src/generated/routes.ts","../src/resource.ts","../src/resources/account.ts","../src/resources/commerce.ts","../src/resources/conversions.ts","../src/resources/cop.ts","../src/resources/crypto.ts","../src/resources/merchants.ts","../src/resources/payments.ts","../src/webhooks.ts","../src/client.ts"],"sourcesContent":["export { VexPay, VexPay as default, DEFAULT_BASE_URL, type VexPayOptions } from './client';\nexport type { RequestOptions } from './core';\nexport { PagePromise, type CursorPage } from './pagination';\nexport type {\n OperationId,\n PathParams,\n QueryParams,\n RequestBody,\n ResponseBody,\n Schemas,\n} from './types';\nexport {\n VexPayError,\n VexPayConfigurationError,\n VexPayAuthenticationError,\n VexPayInvalidRequestError,\n VexPayNotFoundError,\n VexPayConflictError,\n VexPayRateLimitError,\n VexPayAPIError,\n VexPayConnectionError,\n VexPayTimeoutError,\n VexPaySignatureVerificationError,\n} from './errors';\nexport {\n Webhooks,\n WEBHOOK_EVENT_NAMES,\n SIGNATURE_HEADER,\n DEFAULT_TOLERANCE_SECONDS,\n type WebhookEvent,\n type WebhookEventName,\n type PaymentWebhookData,\n type CopPaymentWebhookData,\n} from './webhooks';\nexport { VERSION } from './version';\n","/** Every error the SDK throws extends VexPayError. */\nexport class VexPayError extends Error {\n /** HTTP status, when the API answered. */\n readonly status?: number;\n /** Machine-readable API code, e.g. `insufficient_balance`. */\n readonly code?: string;\n /** Parsed response body, when the API answered. */\n readonly body?: unknown;\n /** Request id from the `x-request-id` response header, when present. */\n readonly requestId?: string;\n\n constructor(\n message: string,\n details: { status?: number; code?: string; body?: unknown; requestId?: string } = {},\n ) {\n super(message);\n this.name = new.target.name;\n this.status = details.status;\n this.code = details.code;\n this.body = details.body;\n this.requestId = details.requestId;\n }\n}\n\n/** Invalid client configuration (e.g. missing API key). Thrown before any request. */\nexport class VexPayConfigurationError extends VexPayError {}\n\n/** 401 — missing, invalid, or revoked API key. */\nexport class VexPayAuthenticationError extends VexPayError {}\n\n/** 400, 403, 410, 422 and other non-retryable 4xx — fix the request before retrying. */\nexport class VexPayInvalidRequestError extends VexPayError {}\n\n/** 404 — the resource does not exist (or belongs to another account). */\nexport class VexPayNotFoundError extends VexPayError {}\n\n/** 409 — e.g. `external_ref_conflict`, `idempotency_key_reused`. */\nexport class VexPayConflictError extends VexPayError {}\n\n/** 429 — too many requests. Retried automatically before surfacing. */\nexport class VexPayRateLimitError extends VexPayError {}\n\n/** 5xx — VEXPay or an upstream bank failed. Retried automatically before surfacing. */\nexport class VexPayAPIError extends VexPayError {}\n\n/** The request never got an HTTP answer (DNS, refused, reset). */\nexport class VexPayConnectionError extends VexPayError {}\n\n/** The request exceeded `timeoutMs`. */\nexport class VexPayTimeoutError extends VexPayConnectionError {}\n\n/** A webhook signature did not verify (see `webhooks.constructEvent`). */\nexport class VexPaySignatureVerificationError extends VexPayError {}\n\nconst MACHINE_CODE = /^[a-z][a-z0-9_]*$/;\n\nfunction messageFrom(body: unknown, status: number): string {\n if (body && typeof body === 'object') {\n const { message, error } = body as { message?: unknown; error?: unknown };\n if (Array.isArray(message)) return message.join('; ');\n if (typeof message === 'string' && message) return message;\n if (typeof error === 'string' && error) return error;\n }\n if (typeof body === 'string' && body) return body;\n return `VEXPay API responded with HTTP ${status}`;\n}\n\n/** Maps an HTTP error response to the matching error class. */\nexport function errorFromResponse(status: number, body: unknown, requestId?: string): VexPayError {\n const rawCode = body && typeof body === 'object' ? (body as { error?: unknown }).error : undefined;\n const code = typeof rawCode === 'string' && MACHINE_CODE.test(rawCode) ? rawCode : undefined;\n const details = { status, code, body, requestId };\n const message = messageFrom(body, status);\n\n if (status === 401) return new VexPayAuthenticationError(message, details);\n if (status === 404) return new VexPayNotFoundError(message, details);\n if (status === 409) return new VexPayConflictError(message, details);\n if (status === 429) return new VexPayRateLimitError(message, details);\n if (status >= 500) return new VexPayAPIError(message, details);\n return new VexPayInvalidRequestError(message, details);\n}\n","export const VERSION = '0.6.0';\n","import {\n VexPayConnectionError,\n VexPayError,\n VexPayTimeoutError,\n errorFromResponse,\n} from './errors';\nimport { VERSION } from './version';\n\nexport type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport type QueryValue = string | number | boolean | null | undefined;\n\n/** Per-request options accepted by every resource method. */\nexport interface RequestOptions {\n /** Sent as `Idempotency-Key` on POST. Defaults to a random UUID per call, reused across retries. */\n idempotencyKey?: string;\n /** Overrides the client's `timeoutMs` for this call. */\n timeoutMs?: number;\n /** Overrides the client's `maxNetworkRetries` for this call. */\n maxNetworkRetries?: number;\n /** Aborts the call (and any pending retry). */\n signal?: AbortSignal;\n}\n\nexport interface CoreConfig {\n apiKey: string;\n baseUrl: string;\n timeoutMs: number;\n maxNetworkRetries: number;\n fetch: typeof fetch;\n /** Test hook — defaults to setTimeout. */\n sleep?: (ms: number) => Promise<void>;\n}\n\nconst INITIAL_RETRY_DELAY_MS = 500;\nconst MAX_RETRY_DELAY_MS = 8_000;\nconst MAX_RETRY_AFTER_MS = 60_000;\n\nfunction defaultSleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nfunction userAgent(): string {\n const runtime = typeof process !== 'undefined' && process.version ? ` node/${process.version}` : '';\n return `vexpay-node/${VERSION}${runtime}`;\n}\n\n/** Retry-After as seconds or an HTTP date → milliseconds, capped. */\nexport function parseRetryAfter(value: string | null, now = Date.now()): number | undefined {\n if (!value) return undefined;\n const seconds = Number(value);\n if (Number.isFinite(seconds) && seconds >= 0) return Math.min(seconds * 1000, MAX_RETRY_AFTER_MS);\n const date = Date.parse(value);\n if (Number.isFinite(date)) return Math.min(Math.max(0, date - now), MAX_RETRY_AFTER_MS);\n return undefined;\n}\n\n/** Exponential backoff with full jitter: attempt 0 → [250, 500) ms, doubling, capped. */\nexport function backoffDelay(attempt: number, random = Math.random): number {\n const ceiling = Math.min(INITIAL_RETRY_DELAY_MS * 2 ** attempt, MAX_RETRY_DELAY_MS);\n return Math.round(ceiling / 2 + random() * (ceiling / 2));\n}\n\nfunction isRetryable(error: VexPayError): boolean {\n if (error instanceof VexPayConnectionError) return true;\n if (error.status === 429) return true;\n if (error.status !== undefined && error.status >= 500) return true;\n return error.status === 409 && error.code === 'idempotency_request_in_progress';\n}\n\nfunction buildUrl(baseUrl: string, path: string, query?: Record<string, QueryValue>): string {\n const url = new URL(path.replace(/^\\//, ''), baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`);\n for (const [key, value] of Object.entries(query ?? {})) {\n if (value !== undefined && value !== null) url.searchParams.set(key, String(value));\n }\n return url.toString();\n}\n\nasync function readBody(response: Response): Promise<unknown> {\n const text = await response.text();\n if (!text) return undefined;\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n}\n\nexport class HttpClient {\n private readonly sleep: (ms: number) => Promise<void>;\n\n constructor(private readonly config: CoreConfig) {\n this.sleep = config.sleep ?? defaultSleep;\n }\n\n async request<T>(\n method: HttpMethod,\n path: string,\n params: { query?: Record<string, QueryValue>; body?: unknown } = {},\n options: RequestOptions = {},\n ): Promise<T> {\n const maxRetries = options.maxNetworkRetries ?? this.config.maxNetworkRetries;\n const timeoutMs = options.timeoutMs ?? this.config.timeoutMs;\n const url = buildUrl(this.config.baseUrl, path, params.query);\n\n const headers: Record<string, string> = {\n accept: 'application/json',\n 'x-api-key': this.config.apiKey,\n 'user-agent': userAgent(),\n };\n if (params.body !== undefined) headers['content-type'] = 'application/json';\n // One key for every attempt of this call: a retried POST can never charge twice.\n if (method === 'POST') headers['idempotency-key'] = options.idempotencyKey ?? crypto.randomUUID();\n const body = params.body === undefined ? undefined : JSON.stringify(params.body);\n\n for (let attempt = 0; ; attempt += 1) {\n let error: VexPayError;\n let retryAfterMs: number | undefined;\n\n try {\n const response = await this.send(url, { method, headers, body }, timeoutMs, options.signal);\n const parsed = await readBody(response);\n if (response.ok) return parsed as T;\n error = errorFromResponse(response.status, parsed, response.headers.get('x-request-id') ?? undefined);\n retryAfterMs = parseRetryAfter(response.headers.get('retry-after'));\n } catch (caught) {\n if (!(caught instanceof VexPayError)) throw caught;\n error = caught;\n }\n\n if (attempt >= maxRetries || !isRetryable(error) || options.signal?.aborted) throw error;\n await this.sleep(retryAfterMs ?? backoffDelay(attempt));\n }\n }\n\n private async send(\n url: string,\n init: { method: HttpMethod; headers: Record<string, string>; body?: string },\n timeoutMs: number,\n signal?: AbortSignal,\n ): Promise<Response> {\n const controller = new AbortController();\n let timedOut = false;\n const timer = setTimeout(() => {\n timedOut = true;\n controller.abort();\n }, timeoutMs);\n const onAbort = () => controller.abort();\n signal?.addEventListener('abort', onAbort, { once: true });\n\n try {\n return await this.config.fetch(url, { ...init, signal: controller.signal });\n } catch (caught) {\n if (timedOut) {\n throw new VexPayTimeoutError(`Request to VEXPay timed out after ${timeoutMs}ms`);\n }\n if (signal?.aborted) throw caught;\n const reason = caught instanceof Error ? caught.message : String(caught);\n throw new VexPayConnectionError(`Could not reach VEXPay: ${reason}`);\n } finally {\n clearTimeout(timer);\n signal?.removeEventListener('abort', onAbort);\n }\n }\n}\n","export type CursorPage<Item> = { items: Item[]; nextCursor?: string | null };\n\n/**\n * Result of a cursor-paginated `list()`.\n *\n * const page = await vexpay.merchants.list({ limit: 100 }); // first page\n * for await (const merchant of vexpay.merchants.list()) { … } // every item, all pages\n *\n * The first request is sent when the result is awaited or iterated.\n */\nexport class PagePromise<Page extends CursorPage<Item>, Item = Page['items'][number]>\n implements PromiseLike<Page>, AsyncIterable<Item>\n{\n private firstPage?: Promise<Page>;\n\n constructor(\n private readonly fetchPage: (cursor: string | undefined) => Promise<Page>,\n private readonly startCursor?: string,\n ) {}\n\n private first(): Promise<Page> {\n return (this.firstPage ??= this.fetchPage(this.startCursor));\n }\n\n then<TResult1 = Page, TResult2 = never>(\n onfulfilled?: ((value: Page) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null,\n ): Promise<TResult1 | TResult2> {\n return this.first().then(onfulfilled, onrejected);\n }\n\n catch<TResult = never>(\n onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null,\n ): Promise<Page | TResult> {\n return this.first().catch(onrejected);\n }\n\n finally(onfinally?: (() => void) | null): Promise<Page> {\n return this.first().finally(onfinally);\n }\n\n async *[Symbol.asyncIterator](): AsyncIterator<Item> {\n let page = await this.first();\n let cursor = this.startCursor;\n for (;;) {\n for (const item of page.items) yield item;\n const next = page.nextCursor;\n // Stop on the last page, or if the API ever repeats a cursor.\n if (!next || next === cursor) return;\n cursor = next;\n page = await this.fetchPage(next);\n }\n }\n\n /** Collects items across pages, stopping after `limit` (default 10 000). */\n async autoPagingToArray({ limit = 10_000 }: { limit?: number } = {}): Promise<Item[]> {\n const items: Item[] = [];\n for await (const item of this) {\n items.push(item);\n if (items.length >= limit) break;\n }\n return items;\n }\n}\n","// Generated by scripts/generate-routes.mjs from packages/sdk-spec/openapi.json — do not edit.\nimport type { operations } from './openapi';\n\nexport type OperationId = keyof operations;\n\nexport const ROUTES = {\n Balance_getBalance: { method: 'GET', path: '/v1/balance' },\n Balance_listTransactions: { method: 'GET', path: '/v1/balance/transactions' },\n CheckoutSessions_create: { method: 'POST', path: '/v1/checkout/sessions' },\n CheckoutSessions_retrieve: { method: 'GET', path: '/v1/checkout/sessions/{id}' },\n Conversions_cancel: { method: 'POST', path: '/v1/conversions/{id}/cancel' },\n Conversions_create: { method: 'POST', path: '/v1/conversions' },\n Conversions_createQuote: { method: 'POST', path: '/v1/conversions/quotes' },\n Conversions_get: { method: 'GET', path: '/v1/conversions/{id}' },\n Conversions_list: { method: 'GET', path: '/v1/conversions' },\n CopPayments_balance: { method: 'GET', path: '/v1/cop/balance' },\n CopPayments_cancel: { method: 'POST', path: '/v1/cop/payments/{id}/cancel' },\n CopPayments_create: { method: 'POST', path: '/v1/cop/payments' },\n CopPayments_get: { method: 'GET', path: '/v1/cop/payments/{id}' },\n CopPayments_refund: { method: 'POST', path: '/v1/cop/payments/{id}/refund' },\n CopPayments_submitOtp: { method: 'POST', path: '/v1/cop/payments/{id}/otp' },\n Crypto_createDepositAddress: { method: 'POST', path: '/v1/crypto/deposit-addresses' },\n Crypto_createPayout: { method: 'POST', path: '/v1/crypto/payouts' },\n Crypto_getBalance: { method: 'GET', path: '/v1/crypto/balance' },\n Crypto_getBalances: { method: 'GET', path: '/v1/crypto/balances' },\n Crypto_getPayout: { method: 'GET', path: '/v1/crypto/payouts/{id}' },\n Crypto_listNetworks: { method: 'GET', path: '/v1/crypto/networks' },\n Merchants_addPayoutMethod: { method: 'POST', path: '/v1/merchants/{id}/payout-methods' },\n Merchants_confirmVerify: { method: 'POST', path: '/v1/merchants/{id}/verify' },\n Merchants_confirmVerifyMethod: { method: 'POST', path: '/v1/merchants/{id}/payout-methods/{methodId}/verify' },\n Merchants_create: { method: 'POST', path: '/v1/merchants' },\n Merchants_deletePayoutMethod: { method: 'DELETE', path: '/v1/merchants/{id}/payout-methods/{methodId}' },\n Merchants_getBalance: { method: 'GET', path: '/v1/merchants/{id}/balance' },\n Merchants_getById: { method: 'GET', path: '/v1/merchants/{id}' },\n Merchants_listAuditEvents: { method: 'GET', path: '/v1/merchants/{id}/audit-events' },\n Merchants_listOrGetByRef: { method: 'GET', path: '/v1/merchants' },\n Merchants_listPayoutMethods: { method: 'GET', path: '/v1/merchants/{id}/payout-methods' },\n Merchants_remove: { method: 'DELETE', path: '/v1/merchants/{id}' },\n Merchants_setDefaultPayoutMethod: { method: 'POST', path: '/v1/merchants/{id}/payout-methods/{methodId}/default' },\n Merchants_startVerify: { method: 'POST', path: '/v1/merchants/{id}/verify/start' },\n Merchants_startVerifyMethod: { method: 'POST', path: '/v1/merchants/{id}/payout-methods/{methodId}/verify/start' },\n Merchants_transfer: { method: 'POST', path: '/v1/merchants/{id}/transfers' },\n Merchants_update: { method: 'PATCH', path: '/v1/merchants/{id}' },\n Notifications_sendTest: { method: 'POST', path: '/v1/notifications/test' },\n PaymentLinks_get: { method: 'GET', path: '/v1/payment-links/{id}' },\n PaymentLinks_remove: { method: 'DELETE', path: '/v1/payment-links/{id}' },\n PaymentLinks_update: { method: 'PATCH', path: '/v1/payment-links/{id}' },\n Payments_executeC2p: { method: 'POST', path: '/v1/payments/c2p' },\n Payments_executeVpos: { method: 'POST', path: '/v1/payments/vpos' },\n Payments_getBanks: { method: 'GET', path: '/v1/banks' },\n Payments_getPagoMovilReceivingAccount: { method: 'GET', path: '/v1/payments/pago-movil/receiving-account' },\n Payments_getPayment: { method: 'GET', path: '/v1/payments/{id}' },\n Payments_getPaymentByRef: { method: 'GET', path: '/v1/payments/by-ref/{externalRef}' },\n Payments_getQuote: { method: 'GET', path: '/v1/quote' },\n Payments_requestC2p: { method: 'POST', path: '/v1/payments/c2p/request' },\n Payments_reversePayment: { method: 'POST', path: '/v1/payments/{id}/reverse' },\n Payments_verifyPagoMovil: { method: 'POST', path: '/v1/payments/pago-movil/verify' },\n Payouts_create: { method: 'POST', path: '/v1/payouts' },\n Payouts_createBatch: { method: 'POST', path: '/v1/payouts/batch' },\n Payouts_createInstant: { method: 'POST', path: '/v1/payouts/instant' },\n Payouts_getById: { method: 'GET', path: '/v1/payouts/{id}' },\n Payouts_getByRef: { method: 'GET', path: '/v1/payouts/by-ref/{externalRef}' },\n Payouts_list: { method: 'GET', path: '/v1/payouts' },\n Products_create: { method: 'POST', path: '/v1/products' },\n Products_createLink: { method: 'POST', path: '/v1/products/{id}/links' },\n Products_get: { method: 'GET', path: '/v1/products/{id}' },\n Products_list: { method: 'GET', path: '/v1/products' },\n Products_listLinks: { method: 'GET', path: '/v1/products/{id}/links' },\n Products_remove: { method: 'DELETE', path: '/v1/products/{id}' },\n Products_update: { method: 'PATCH', path: '/v1/products/{id}' },\n R4Operations_consultarOperacion: { method: 'GET', path: '/v1/payments/operations/{id}' },\n R4Operations_creditoCuentas: { method: 'POST', path: '/v1/payments/credit/account' },\n R4Operations_creditoInmediato: { method: 'POST', path: '/v1/payments/credit' },\n R4Operations_debitoInmediato: { method: 'POST', path: '/v1/payments/debit' },\n R4Operations_dispersarCredito: { method: 'POST', path: '/v1/payments/credit/disburse' },\n R4Operations_dispersarPagos: { method: 'POST', path: '/v1/payments/payouts' },\n R4Operations_ejecutarVuelto: { method: 'POST', path: '/v1/payments/change' },\n R4Operations_generarOtp: { method: 'POST', path: '/v1/payments/debit/otp' },\n R4Operations_pollOperation: { method: 'POST', path: '/v1/payments/operations/poll' },\n TenantPayoutAccount_confirmVerify: { method: 'POST', path: '/v1/tenant/payout-account/verify' },\n TenantPayoutAccount_get: { method: 'GET', path: '/v1/tenant/payout-account' },\n TenantPayoutAccount_startVerify: { method: 'POST', path: '/v1/tenant/payout-account/verify/start' },\n TenantPayoutAccount_upsert: { method: 'PUT', path: '/v1/tenant/payout-account' },\n TenantPayoutAccount_upsertPost: { method: 'POST', path: '/v1/tenant/payout-account' },\n Webhooks_createWebhook: { method: 'POST', path: '/v1/webhooks' },\n Webhooks_deleteWebhook: { method: 'DELETE', path: '/v1/webhooks/{id}' },\n Webhooks_listWebhooks: { method: 'GET', path: '/v1/webhooks' },\n Webhooks_updateWebhook: { method: 'PATCH', path: '/v1/webhooks/{id}' },\n} as const satisfies Record<OperationId, { method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; path: string }>;\n","import type { HttpClient, QueryValue, RequestOptions } from './core';\nimport { VexPayInvalidRequestError } from './errors';\nimport { ROUTES } from './generated/routes';\nimport type { OperationId, ResponseBody } from './types';\n\nexport type CallArgs = {\n path?: Record<string, string>;\n query?: object;\n body?: unknown;\n};\n\n/** Base class for resources: turns an operationId + args into a typed HTTP call. */\nexport abstract class APIResource {\n constructor(protected readonly http: HttpClient) {}\n\n /** Async so a bad argument surfaces as a rejected promise, never a synchronous throw. */\n protected async call<O extends OperationId>(\n operationId: O,\n args: CallArgs = {},\n options?: RequestOptions,\n ): Promise<ResponseBody<O>> {\n const route = ROUTES[operationId];\n const path = route.path.replace(/\\{(\\w+)\\}/g, (_match, name: string) => {\n const value = args.path?.[name];\n if (typeof value !== 'string' || value === '') {\n throw new VexPayInvalidRequestError(`Missing required path parameter \"${name}\" for ${operationId}.`);\n }\n return encodeURIComponent(value);\n });\n return this.http.request<ResponseBody<O>>(\n route.method,\n path,\n { query: args.query as Record<string, QueryValue> | undefined, body: args.body },\n options,\n );\n }\n}\n","import type { RequestOptions } from '../core';\nimport { PagePromise } from '../pagination';\nimport { APIResource } from '../resource';\nimport type { QueryParams, RequestBody } from '../types';\n\n/** Venezuelan bank catalog (SIMF codes, supported services, logos). */\nexport class Banks extends APIResource {\n list(options?: RequestOptions) {\n return this.call('Payments_getBanks', {}, options);\n }\n}\n\n/** USD → VES at the official BCV rate. */\nexport class Quotes extends APIResource {\n retrieve(params: QueryParams<'Payments_getQuote'>, options?: RequestOptions) {\n return this.call('Payments_getQuote', { query: params }, options);\n }\n}\n\n/** Every movement in your VES balance (payments, fees, payouts, chargebacks, …), newest first. */\nexport class BalanceTransactions extends APIResource {\n /** Await for one page, or `for await` over every movement. The amounts sum to `ledgerNetVes`. */\n list(params: QueryParams<'Balance_listTransactions'> = {}, options?: RequestOptions) {\n return new PagePromise(\n (cursor) => this.call('Balance_listTransactions', { query: { ...params, cursor } }, options),\n params.cursor,\n );\n }\n}\n\n/** Your platform balance. */\nexport class Balance extends APIResource {\n readonly transactions = new BalanceTransactions(this.http);\n\n retrieve(options?: RequestOptions) {\n return this.call('Balance_getBalance', {}, options);\n }\n}\n\n/** VES payouts to verified merchants. `externalRef` is the idempotency key. */\nexport class Payouts extends APIResource {\n create(params: RequestBody<'Payouts_create'>, options?: RequestOptions) {\n return this.call('Payouts_create', { body: params }, options);\n }\n\n /** Pay out immediately (crédito inmediato). */\n createInstant(params: RequestBody<'Payouts_createInstant'>, options?: RequestOptions) {\n return this.call('Payouts_createInstant', { body: params }, options);\n }\n\n /** Many payouts in one request, with item-level idempotency. */\n createBatch(params: RequestBody<'Payouts_createBatch'>, options?: RequestOptions) {\n return this.call('Payouts_createBatch', { body: params }, options);\n }\n\n /** Await for one page, or `for await` over every payout. */\n list(params: QueryParams<'Payouts_list'> = {}, options?: RequestOptions) {\n return new PagePromise(\n (cursor) => this.call('Payouts_list', { query: { ...params, cursor } }, options),\n params.cursor,\n );\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Payouts_getById', { path: { id } }, options);\n }\n\n retrieveByRef(externalRef: string, options?: RequestOptions) {\n return this.call('Payouts_getByRef', { path: { externalRef } }, options);\n }\n}\n\n/** The account your own VEXPay earnings are paid out to. */\nexport class TenantPayoutAccount extends APIResource {\n retrieve(options?: RequestOptions) {\n return this.call('TenantPayoutAccount_get', {}, options);\n }\n\n /** Create or replace the payout account (PUT). */\n upsert(params: RequestBody<'TenantPayoutAccount_upsert'>, options?: RequestOptions) {\n return this.call('TenantPayoutAccount_upsert', { body: params }, options);\n }\n\n /** Same as `upsert`, sent as POST (supports `Idempotency-Key`). */\n create(params: RequestBody<'TenantPayoutAccount_upsertPost'>, options?: RequestOptions) {\n return this.call('TenantPayoutAccount_upsertPost', { body: params }, options);\n }\n\n startVerification(options?: RequestOptions) {\n return this.call('TenantPayoutAccount_startVerify', {}, options);\n }\n\n confirmVerification(params: RequestBody<'TenantPayoutAccount_confirmVerify'>, options?: RequestOptions) {\n return this.call('TenantPayoutAccount_confirmVerify', { body: params }, options);\n }\n}\n\n/** Where VEXPay delivers signed webhooks. */\nexport class WebhookEndpoints extends APIResource {\n /** The response includes the signing `secret` — store it to verify deliveries. */\n create(params: RequestBody<'Webhooks_createWebhook'>, options?: RequestOptions) {\n return this.call('Webhooks_createWebhook', { body: params }, options);\n }\n\n list(options?: RequestOptions) {\n return this.call('Webhooks_listWebhooks', {}, options);\n }\n\n update(id: string, params: RequestBody<'Webhooks_updateWebhook'>, options?: RequestOptions) {\n return this.call('Webhooks_updateWebhook', { path: { id }, body: params }, options);\n }\n\n delete(id: string, options?: RequestOptions) {\n return this.call('Webhooks_deleteWebhook', { path: { id } }, options);\n }\n\n /** Send a `notification.test` delivery to your endpoints. */\n sendTest(options?: RequestOptions) {\n return this.call('Notifications_sendTest', {}, options);\n }\n}\n","import type { RequestOptions } from '../core';\nimport { PagePromise } from '../pagination';\nimport { APIResource } from '../resource';\nimport type { QueryParams, RequestBody } from '../types';\n\n/** Single-purchase checkouts: redirect to `url`, or embed with @vexpay/js using `clientSecret`. */\nexport class CheckoutSessions extends APIResource {\n /** `clientSecret` is returned only here — hand it to the browser, never store or log it. */\n create(params: RequestBody<'CheckoutSessions_create'>, options?: RequestOptions) {\n return this.call('CheckoutSessions_create', { body: params }, options);\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('CheckoutSessions_retrieve', { path: { id } }, options);\n }\n}\n\nexport class Checkout extends APIResource {\n readonly sessions = new CheckoutSessions(this.http);\n}\n\n/** No-code products sold through hosted payment links. */\nexport class Products extends APIResource {\n create(params: RequestBody<'Products_create'>, options?: RequestOptions) {\n return this.call('Products_create', { body: params }, options);\n }\n\n /** Await for one page, or `for await` over every product. */\n list(params: QueryParams<'Products_list'> = {}, options?: RequestOptions) {\n return new PagePromise(\n (cursor) => this.call('Products_list', { query: { ...params, cursor } }, options),\n params.cursor,\n );\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Products_get', { path: { id } }, options);\n }\n\n update(id: string, params: RequestBody<'Products_update'>, options?: RequestOptions) {\n return this.call('Products_update', { path: { id }, body: params }, options);\n }\n\n delete(id: string, options?: RequestOptions) {\n return this.call('Products_remove', { path: { id } }, options);\n }\n\n /** Publish a shareable `/pay/:slug` link for this product. */\n createLink(id: string, params: RequestBody<'Products_createLink'>, options?: RequestOptions) {\n return this.call('Products_createLink', { path: { id }, body: params }, options);\n }\n\n listLinks(id: string, options?: RequestOptions) {\n return this.call('Products_listLinks', { path: { id } }, options);\n }\n}\n\nexport class PaymentLinks extends APIResource {\n retrieve(id: string, options?: RequestOptions) {\n return this.call('PaymentLinks_get', { path: { id } }, options);\n }\n\n update(id: string, params: RequestBody<'PaymentLinks_update'>, options?: RequestOptions) {\n return this.call('PaymentLinks_update', { path: { id }, body: params }, options);\n }\n\n delete(id: string, options?: RequestOptions) {\n return this.call('PaymentLinks_remove', { path: { id } }, options);\n }\n}\n","import type { RequestOptions } from '../core';\nimport { PagePromise } from '../pagination';\nimport { APIResource } from '../resource';\nimport type { QueryParams, RequestBody } from '../types';\n\n/** A rate for converting VES to USDT, locked for 60 seconds. */\nexport class ConversionQuotes extends APIResource {\n /** Send `sourceAmountVes` (VES to spend) or `targetAmountUsdt` (USDT to receive) — exactly one. */\n create(params: RequestBody<'Conversions_createQuote'>, options?: RequestOptions) {\n return this.call('Conversions_createQuote', { body: params }, options);\n }\n}\n\n/**\n * Convert available VES into your USDT balance. Accepting a quote debits the VES at once; the\n * conversion is `PENDING` until VEXPay delivers the USDT (`conversion.completed`). Enabled per account.\n */\nexport class Conversions extends APIResource {\n readonly quotes = new ConversionQuotes(this.http);\n\n /** Accept a quote (`quoteId`). Pass `idempotencyKey` in options to retry safely. */\n create(params: RequestBody<'Conversions_create'>, options?: RequestOptions) {\n return this.call('Conversions_create', { body: params }, options);\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Conversions_get', { path: { id } }, options);\n }\n\n /** Await for one page, or `for await` over every conversion (newest first). */\n list(params: QueryParams<'Conversions_list'> = {}, options?: RequestOptions) {\n return new PagePromise(\n (cursor) => this.call('Conversions_list', { query: { ...params, cursor } }, options),\n params.cursor,\n );\n }\n\n /** Cancel a `PENDING` conversion; the VES returns to your available balance. */\n cancel(id: string, options?: RequestOptions) {\n return this.call('Conversions_cancel', { path: { id } }, options);\n }\n}\n","import type { RequestOptions } from '../core';\nimport { APIResource } from '../resource';\nimport type { RequestBody } from '../types';\n\n/**\n * Colombian peso payments: Bre-B (QR / transfer key), Nequi (push approval) or Daviplata (SMS\n * code). Payments complete asynchronously — listen for `payment.completed` / `payment.failed`.\n * COP must be enabled on your account (403 `method_not_allowed` otherwise).\n */\nexport class CopPayments extends APIResource {\n /**\n * Create a payment in whole pesos. `buyer` is required for `nequi` and `daviplata`. The response\n * `next` says what the buyer does: `show_qr`, `approve_in_app` or `submit_otp`.\n * Pass `idempotencyKey` in options to retry safely.\n */\n create(params: RequestBody<'CopPayments_create'>, options?: RequestOptions) {\n return this.call('CopPayments_create', { body: params }, options);\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('CopPayments_get', { path: { id } }, options);\n }\n\n /** Daviplata: submit the code the buyer received by SMS. A wrong code fails with `invalid_otp`. */\n submitOtp(id: string, params: RequestBody<'CopPayments_submitOtp'>, options?: RequestOptions) {\n return this.call('CopPayments_submitOtp', { path: { id }, body: params }, options);\n }\n\n /** Cancel a pending payment. */\n cancel(id: string, options?: RequestOptions) {\n return this.call('CopPayments_cancel', { path: { id } }, options);\n }\n\n /** Full refund of a completed payment, within 96 hours. */\n refund(id: string, options?: RequestOptions) {\n return this.call('CopPayments_refund', { path: { id } }, options);\n }\n}\n\n/** Your COP balance, in whole pesos. Kept apart from VES and stablecoins. */\nexport class CopBalance extends APIResource {\n retrieve(options?: RequestOptions) {\n return this.call('CopPayments_balance', {}, options);\n }\n}\n\n/** Collect Colombian pesos (Bre-B, Nequi, Daviplata). */\nexport class Cop extends APIResource {\n readonly payments = new CopPayments(this.http);\n readonly balance = new CopBalance(this.http);\n}\n","import type { RequestOptions } from '../core';\nimport { APIResource } from '../resource';\nimport type { QueryParams, RequestBody } from '../types';\n\n/** One stablecoin balance (`currency`: USDT by default, or USDC). Never converted to VES. */\nexport class CryptoBalance extends APIResource {\n retrieve(params: QueryParams<'Crypto_getBalance'> = {}, options?: RequestOptions) {\n return this.call('Crypto_getBalance', { query: params }, options);\n }\n}\n\n/** Every stablecoin balance (USDT and USDC). */\nexport class CryptoBalances extends APIResource {\n list(options?: RequestOptions) {\n return this.call('Crypto_getBalances', {}, options);\n }\n}\n\n/** Static deposit addresses per customer, stablecoin (`currency`) and network. */\nexport class DepositAddresses extends APIResource {\n /** Get or create — calling again for the same customer and network returns the same address. */\n create(params: RequestBody<'Crypto_createDepositAddress'>, options?: RequestOptions) {\n return this.call('Crypto_createDepositAddress', { body: params }, options);\n }\n}\n\n/** Enabled networks for one stablecoin (`currency`) with the payout fee and availability for an amount. */\nexport class CryptoNetworks extends APIResource {\n list(params: QueryParams<'Crypto_listNetworks'> = {}, options?: RequestOptions) {\n return this.call('Crypto_listNetworks', { query: params }, options);\n }\n}\n\n/** Stablecoin payouts to external addresses (`currency`: USDT or USDC). `idempotencyKey` (in the body) makes retries safe. */\nexport class CryptoPayouts extends APIResource {\n create(params: RequestBody<'Crypto_createPayout'>, options?: RequestOptions) {\n return this.call('Crypto_createPayout', { body: params }, options);\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Crypto_getPayout', { path: { id } }, options);\n }\n}\n\n/** Stablecoins (USDT, USDC): deposit addresses, balances, networks and payouts. */\nexport class Crypto extends APIResource {\n readonly balance = new CryptoBalance(this.http);\n readonly balances = new CryptoBalances(this.http);\n readonly depositAddresses = new DepositAddresses(this.http);\n readonly networks = new CryptoNetworks(this.http);\n readonly payouts = new CryptoPayouts(this.http);\n}\n","import type { RequestOptions } from '../core';\nimport { PagePromise } from '../pagination';\nimport { APIResource } from '../resource';\nimport type { QueryParams, RequestBody, Schemas } from '../types';\n\nexport type MerchantListParams = Omit<QueryParams<'Merchants_listOrGetByRef'>, 'externalRef'>;\n\n/** Where a merchant gets paid (bank account or Pago Móvil). */\nexport class PayoutMethods extends APIResource {\n list(merchantId: string, options?: RequestOptions) {\n return this.call('Merchants_listPayoutMethods', { path: { id: merchantId } }, options);\n }\n\n create(merchantId: string, params: RequestBody<'Merchants_addPayoutMethod'>, options?: RequestOptions) {\n return this.call('Merchants_addPayoutMethod', { path: { id: merchantId }, body: params }, options);\n }\n\n setDefault(merchantId: string, methodId: string, options?: RequestOptions) {\n return this.call('Merchants_setDefaultPayoutMethod', { path: { id: merchantId, methodId } }, options);\n }\n\n delete(merchantId: string, methodId: string, options?: RequestOptions) {\n return this.call('Merchants_deletePayoutMethod', { path: { id: merchantId, methodId } }, options);\n }\n\n /** Send micro-deposits to this payout method. */\n startVerification(merchantId: string, methodId: string, options?: RequestOptions) {\n return this.call('Merchants_startVerifyMethod', { path: { id: merchantId, methodId } }, options);\n }\n\n /** Confirm the micro-deposit amounts the merchant saw. */\n confirmVerification(\n merchantId: string,\n methodId: string,\n params: RequestBody<'Merchants_confirmVerifyMethod'>,\n options?: RequestOptions,\n ) {\n return this.call(\n 'Merchants_confirmVerifyMethod',\n { path: { id: merchantId, methodId }, body: params },\n options,\n );\n }\n}\n\nexport class Merchants extends APIResource {\n readonly payoutMethods = new PayoutMethods(this.http);\n\n /** `externalRef` is required and is the idempotency key for merchant creation. */\n create(params: RequestBody<'Merchants_create'>, options?: RequestOptions) {\n return this.call('Merchants_create', { body: params }, options);\n }\n\n /** Await for one page (`items`, `nextCursor`), or `for await` over every merchant. */\n list(params: MerchantListParams = {}, options?: RequestOptions) {\n return new PagePromise<Schemas['MerchantListResponseDto']>(\n (cursor) =>\n this.call('Merchants_listOrGetByRef', { query: { ...params, cursor } }, options) as Promise<\n Schemas['MerchantListResponseDto']\n >,\n params.cursor,\n );\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Merchants_getById', { path: { id } }, options);\n }\n\n /** Look up a merchant by the `externalRef` you created it with. */\n retrieveByRef(externalRef: string, options?: RequestOptions) {\n return this.call('Merchants_listOrGetByRef', { query: { externalRef } }, options) as Promise<\n Schemas['MerchantResponseDto']\n >;\n }\n\n update(id: string, params: RequestBody<'Merchants_update'>, options?: RequestOptions) {\n return this.call('Merchants_update', { path: { id }, body: params }, options);\n }\n\n delete(id: string, options?: RequestOptions) {\n return this.call('Merchants_remove', { path: { id } }, options);\n }\n\n retrieveBalance(id: string, options?: RequestOptions) {\n return this.call('Merchants_getBalance', { path: { id } }, options);\n }\n\n /** Move VES between this merchant's balance and another. */\n transfer(id: string, params: RequestBody<'Merchants_transfer'>, options?: RequestOptions) {\n return this.call('Merchants_transfer', { path: { id }, body: params }, options);\n }\n\n listAuditEvents(id: string, options?: RequestOptions) {\n return this.call('Merchants_listAuditEvents', { path: { id } }, options);\n }\n\n /** Send micro-deposits to the merchant's default payout method. */\n startVerification(id: string, options?: RequestOptions) {\n return this.call('Merchants_startVerify', { path: { id } }, options);\n }\n\n confirmVerification(id: string, params: RequestBody<'Merchants_confirmVerify'>, options?: RequestOptions) {\n return this.call('Merchants_confirmVerify', { path: { id }, body: params }, options);\n }\n}\n","import type { RequestOptions } from '../core';\nimport { APIResource } from '../resource';\nimport type { RequestBody } from '../types';\n\n/** Pago Móvil C2P: request the bank OTP, then charge with the customer's token. */\nexport class C2p extends APIResource {\n /** Create a C2P intent; the payer's bank sends them a token (see `otpRequested`). */\n request(params: RequestBody<'Payments_requestC2p'>, options?: RequestOptions) {\n return this.call('Payments_requestC2p', { body: params }, options);\n }\n\n /** Charge with the bank-issued token. Pass `intentId` from `request()`. */\n execute(params: RequestBody<'Payments_executeC2p'>, options?: RequestOptions) {\n return this.call('Payments_executeC2p', { body: params }, options);\n }\n}\n\n/** Card payments (VPOS). Prefer the hosted/embedded checkout so card data never touches your servers. */\nexport class Vpos extends APIResource {\n create(params: RequestBody<'Payments_executeVpos'>, options?: RequestOptions) {\n return this.call('Payments_executeVpos', { body: params }, options);\n }\n}\n\n/** Confirm a Pago Móvil the customer already sent to you. */\nexport class PagoMovil extends APIResource {\n /**\n * The account your customers must send the Pago Móvil to (bank, phone, identification).\n * Don't offer Pago Móvil while `configured` is false.\n */\n receivingAccount(options?: RequestOptions) {\n return this.call('Payments_getPagoMovilReceivingAccount', {}, options);\n }\n\n verify(params: RequestBody<'Payments_verifyPagoMovil'>, options?: RequestOptions) {\n return this.call('Payments_verifyPagoMovil', { body: params }, options);\n }\n}\n\n/** Débito inmediato (advanced payments, enabled per account). */\nexport class Debit extends APIResource {\n requestOtp(params: RequestBody<'R4Operations_generarOtp'>, options?: RequestOptions) {\n return this.call('R4Operations_generarOtp', { body: params }, options);\n }\n\n execute(params: RequestBody<'R4Operations_debitoInmediato'>, options?: RequestOptions) {\n return this.call('R4Operations_debitoInmediato', { body: params }, options);\n }\n}\n\n/** Crédito inmediato and disbursements (advanced payments, enabled per account). */\nexport class Credit extends APIResource {\n /** Instant credit to a Pago Móvil phone. */\n create(params: RequestBody<'R4Operations_creditoInmediato'>, options?: RequestOptions) {\n return this.call('R4Operations_creditoInmediato', { body: params }, options);\n }\n\n /** Instant credit to a bank account. */\n toAccount(params: RequestBody<'R4Operations_creditoCuentas'>, options?: RequestOptions) {\n return this.call('R4Operations_creditoCuentas', { body: params }, options);\n }\n\n /** Disburse one credit across several recipients. */\n disburse(params: RequestBody<'R4Operations_dispersarCredito'>, options?: RequestOptions) {\n return this.call('R4Operations_dispersarCredito', { body: params }, options);\n }\n}\n\n/** Bank operation status for débito/crédito (advanced payments, enabled per account). */\nexport class Operations extends APIResource {\n retrieve(id: string, options?: RequestOptions) {\n return this.call('R4Operations_consultarOperacion', { path: { id } }, options);\n }\n\n /** Re-check a pending operation with the bank now. */\n poll(params: RequestBody<'R4Operations_pollOperation'>, options?: RequestOptions) {\n return this.call('R4Operations_pollOperation', { body: params }, options);\n }\n}\n\n/** Account payout dispersion (advanced payments, enabled per account). */\nexport class Dispersals extends APIResource {\n create(params: RequestBody<'R4Operations_dispersarPagos'>, options?: RequestOptions) {\n return this.call('R4Operations_dispersarPagos', { body: params }, options);\n }\n}\n\n/** Vuelto / change payments (advanced payments, enabled per account). */\nexport class Change extends APIResource {\n create(params: RequestBody<'R4Operations_ejecutarVuelto'>, options?: RequestOptions) {\n return this.call('R4Operations_ejecutarVuelto', { body: params }, options);\n }\n}\n\nexport class Payments extends APIResource {\n readonly c2p = new C2p(this.http);\n readonly vpos = new Vpos(this.http);\n readonly pagoMovil = new PagoMovil(this.http);\n readonly debit = new Debit(this.http);\n readonly credit = new Credit(this.http);\n readonly operations = new Operations(this.http);\n readonly dispersals = new Dispersals(this.http);\n readonly change = new Change(this.http);\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Payments_getPayment', { path: { id } }, options);\n }\n\n /** Look up a payment by the `externalRef` you sent. */\n retrieveByRef(externalRef: string, options?: RequestOptions) {\n return this.call('Payments_getPaymentByRef', { path: { externalRef } }, options);\n }\n\n /** Reverse a completed C2P payment. */\n reverse(id: string, options?: RequestOptions) {\n return this.call('Payments_reversePayment', { path: { id } }, options);\n }\n}\n","import { createHmac, timingSafeEqual } from 'node:crypto';\nimport { VexPaySignatureVerificationError } from './errors';\n\nexport const WEBHOOK_EVENT_NAMES = [\n 'payment.pending',\n 'payment.completed',\n 'payment.failed',\n 'payment.canceled',\n 'payment.reversed',\n 'payment.chargeback',\n 'payment.chargeback_closed',\n 'merchant.verified',\n 'merchant.rejected',\n 'merchant.deactivated',\n 'merchant.reactivated',\n 'merchant.balance.updated',\n 'merchant.created',\n 'merchant.activated',\n 'merchant.updated',\n 'merchant.kyb_required',\n 'merchant.restricted',\n 'merchant.capability.updated',\n 'merchant.wallet_credit',\n 'payout.completed',\n 'payout.failed',\n 'conversion.completed',\n 'conversion.canceled',\n 'tenant.status_changed',\n 'tenant.api_key.created',\n 'tenant.api_key.rotated',\n 'tenant.api_key.revoked',\n 'tenant.live_status_changed',\n 'notification.test',\n] as const;\n\nexport type WebhookEventName = (typeof WEBHOOK_EVENT_NAMES)[number];\n\n/** `data` of every `payment.*` event. */\nexport interface PaymentWebhookData {\n paymentId: string;\n externalRef?: string;\n status: 'PENDING' | 'COMPLETED' | 'FAILED' | 'CANCELED' | 'REVERSED';\n /** `COP` payments carry a different shape: narrow on `method === 'COP'` and read them as {@link CopPaymentWebhookData}. */\n method: 'C2P' | 'VPOS' | 'PAGO_MOVIL' | 'DEBITO_INMEDIATO' | 'COP';\n usdAmount: number;\n vesAmount: number;\n bcvRate: number;\n feeUsd?: number;\n feeVes?: number;\n netVes?: number;\n bankReference?: string;\n bankTxId?: number;\n debtorId?: string;\n debtorPhone?: string;\n debtorBankCode?: number;\n debtorBankName?: string;\n cardLast4?: string;\n cardBrand?: string;\n cardProduct?: string;\n accountTypeLabel?: string;\n tenantName: string;\n createdAt: string;\n failureCode?: string;\n cancelReason?: 'superseded' | 'expired';\n reversedAt?: string;\n reversalRef?: string;\n reversalTxId?: number;\n livemode: boolean;\n /** Present when the payment came from a checkout session. */\n checkoutSession?: { id: string; reference: string | null; metadata: Record<string, string> };\n}\n\n/**\n * `payment.*` data for a Colombian peso payment (`method: \"COP\"`). Amounts are whole pesos.\n * `amountUsd` and `copRate` are present only for hosted-checkout payments.\n */\nexport interface CopPaymentWebhookData {\n id: string;\n paymentId: string;\n method: 'COP';\n currency: 'COP';\n status: 'pending' | 'completed' | 'failed' | 'canceled' | 'refunded';\n channel: 'breb' | 'nequi' | 'daviplata';\n amountCop: number;\n feeCop?: number;\n amountUsd?: string;\n copRate?: string;\n reference?: string;\n externalRef?: string;\n metadata: Record<string, string>;\n failureCode?: 'expired' | 'rejected' | 'processor_error' | 'processor_unknown';\n expiresAt?: string;\n createdAt: string;\n completedAt?: string;\n tenantName: string;\n livemode: boolean;\n /** Present when the payment came from a checkout session. */\n checkoutSession?: { id: string; reference: string | null; metadata: Record<string, string> };\n}\n\ntype PaymentEventName = Extract<WebhookEventName, `payment.${string}`>;\n\n/** A verified webhook delivery, discriminated by `event`. */\nexport type WebhookEvent =\n | { event: PaymentEventName; data: PaymentWebhookData; timestamp: string }\n | {\n event: Exclude<WebhookEventName, PaymentEventName>;\n data: Record<string, unknown> & { livemode: boolean };\n timestamp: string;\n };\n\nexport const SIGNATURE_HEADER = 'VexPay-Signature';\nexport const DEFAULT_TOLERANCE_SECONDS = 300;\n\nconst RAW_BODY_HINT =\n 'Pass the raw request body exactly as received (string or Buffer). Parsing and re-serializing JSON — e.g. JSON.stringify(req.body) — changes the bytes and breaks the signature. In Express use express.raw({ type: \"application/json\" }) on the webhook route.';\n\nfunction sign(secret: string, timestamp: number | string, payload: string): string {\n return createHmac('sha256', secret).update(`${timestamp}.${payload}`, 'utf8').digest('hex');\n}\n\nfunction parseHeader(header: string): { timestamp: number; signatures: string[] } | null {\n let timestamp: string | undefined;\n const signatures: string[] = [];\n for (const part of header.split(',')) {\n const index = part.indexOf('=');\n if (index <= 0) return null;\n const key = part.slice(0, index).trim();\n const value = part.slice(index + 1).trim();\n if (key === 't') timestamp = value;\n else if (key === 'v1') signatures.push(value);\n // Unknown schemes (v0, future v2…) are ignored.\n }\n if (!timestamp || !/^\\d+$/.test(timestamp)) return null;\n return { timestamp: Number(timestamp), signatures };\n}\n\nfunction safeEqualHex(expected: string, actual: string): boolean {\n const a = Buffer.from(expected, 'utf8');\n const b = Buffer.from(actual, 'utf8');\n return a.length === b.length && timingSafeEqual(a, b);\n}\n\nexport class Webhooks {\n /**\n * Verifies a delivery's `VexPay-Signature` header and returns the parsed event.\n * Throws VexPaySignatureVerificationError on a bad signature or a stale timestamp.\n */\n constructEvent(\n rawBody: string | Buffer | Uint8Array,\n signatureHeader: string | string[] | null | undefined,\n secret: string,\n options: { toleranceSeconds?: number; now?: number } = {},\n ): WebhookEvent {\n if (typeof rawBody !== 'string' && !(rawBody instanceof Uint8Array)) {\n throw new VexPaySignatureVerificationError(`Webhook payload must be the raw body. ${RAW_BODY_HINT}`);\n }\n if (!secret) {\n throw new VexPaySignatureVerificationError('A webhook signing secret is required.');\n }\n const payload = typeof rawBody === 'string' ? rawBody : Buffer.from(rawBody).toString('utf8');\n const header = Array.isArray(signatureHeader) ? signatureHeader[0] : signatureHeader;\n const parsed = header ? parseHeader(header) : null;\n if (!parsed) {\n throw new VexPaySignatureVerificationError(\n `Unable to parse the ${SIGNATURE_HEADER} header. Expected \"t=<timestamp>,v1=<signature>\".`,\n );\n }\n if (parsed.signatures.length === 0) {\n throw new VexPaySignatureVerificationError(`No v1 signatures found in the ${SIGNATURE_HEADER} header.`);\n }\n\n const tolerance = options.toleranceSeconds ?? DEFAULT_TOLERANCE_SECONDS;\n const now = options.now ?? Math.floor(Date.now() / 1000);\n if (tolerance > 0 && Math.abs(now - parsed.timestamp) > tolerance) {\n throw new VexPaySignatureVerificationError(\n `Webhook timestamp is outside the ${tolerance}s tolerance — possible replay. Check your server clock if this repeats.`,\n );\n }\n\n const expected = sign(secret, parsed.timestamp, payload);\n if (!parsed.signatures.some((candidate) => safeEqualHex(expected, candidate))) {\n throw new VexPaySignatureVerificationError(\n `No signature matches the expected signature for this payload. Check the endpoint secret. ${RAW_BODY_HINT}`,\n );\n }\n\n try {\n return JSON.parse(payload) as WebhookEvent;\n } catch {\n throw new VexPaySignatureVerificationError('Webhook payload is not valid JSON.');\n }\n }\n\n /** Builds a valid `VexPay-Signature` value — for your own tests. */\n generateTestHeader({\n payload,\n secret,\n timestamp = Math.floor(Date.now() / 1000),\n }: {\n payload: string;\n secret: string;\n timestamp?: number;\n }): string {\n return `t=${timestamp},v1=${sign(secret, timestamp, payload)}`;\n }\n}\n","import { HttpClient, type CoreConfig } from './core';\nimport { VexPayConfigurationError } from './errors';\nimport {\n Balance,\n Banks,\n Payouts,\n Quotes,\n TenantPayoutAccount,\n WebhookEndpoints,\n} from './resources/account';\nimport { Checkout, PaymentLinks, Products } from './resources/commerce';\nimport { Conversions } from './resources/conversions';\nimport { Cop } from './resources/cop';\nimport { Crypto } from './resources/crypto';\nimport { Merchants } from './resources/merchants';\nimport { Payments } from './resources/payments';\nimport { Webhooks } from './webhooks';\n\nexport const DEFAULT_BASE_URL = 'https://api.pay.vexwallet.co';\n\nexport interface VexPayOptions {\n /** API origin. Defaults to production (`https://api.pay.vexwallet.co`). */\n baseUrl?: string;\n /** Per-attempt timeout. Default 30 000 ms. */\n timeoutMs?: number;\n /** Retries for connection errors, timeouts, 429 and 5xx. Default 2. */\n maxNetworkRetries?: number;\n /** Custom fetch (proxies, instrumentation, tests). Defaults to the global fetch. */\n fetch?: typeof fetch;\n}\n\nexport class VexPay {\n /** @internal */\n readonly http: HttpClient;\n\n readonly banks: Banks;\n readonly quotes: Quotes;\n readonly balance: Balance;\n readonly payments: Payments;\n readonly checkout: Checkout;\n readonly merchants: Merchants;\n readonly payouts: Payouts;\n /** USDT: deposit addresses, balance, networks and payouts. */\n readonly crypto: Crypto;\n /** Convert available VES to USDT (enabled per account). */\n readonly conversions: Conversions;\n /** Colombian pesos: Bre-B, Nequi and Daviplata payments and the COP balance. */\n readonly cop: Cop;\n readonly products: Products;\n readonly paymentLinks: PaymentLinks;\n readonly tenantPayoutAccount: TenantPayoutAccount;\n readonly webhookEndpoints: WebhookEndpoints;\n /** Offline helpers: `constructEvent` verifies deliveries; no API calls. */\n readonly webhooks = new Webhooks();\n\n constructor(apiKey: string, options: VexPayOptions = {}) {\n if (typeof apiKey !== 'string' || apiKey.trim() === '') {\n throw new VexPayConfigurationError(\n 'A VEXPay API key is required: new VexPay(process.env.VEXPAY_API_KEY).',\n );\n }\n const fetchImpl = options.fetch ?? globalThis.fetch;\n if (typeof fetchImpl !== 'function') {\n throw new VexPayConfigurationError('No fetch implementation found. Use Node.js 20+ or pass options.fetch.');\n }\n const config: CoreConfig = {\n apiKey: apiKey.trim(),\n baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,\n timeoutMs: options.timeoutMs ?? 30_000,\n maxNetworkRetries: options.maxNetworkRetries ?? 2,\n fetch: fetchImpl.bind(globalThis),\n };\n this.http = new HttpClient(config);\n\n this.banks = new Banks(this.http);\n this.quotes = new Quotes(this.http);\n this.balance = new Balance(this.http);\n this.payments = new Payments(this.http);\n this.checkout = new Checkout(this.http);\n this.merchants = new Merchants(this.http);\n this.payouts = new Payouts(this.http);\n this.crypto = new Crypto(this.http);\n this.conversions = new Conversions(this.http);\n this.cop = new Cop(this.http);\n this.products = new Products(this.http);\n this.paymentLinks = new PaymentLinks(this.http);\n this.tenantPayoutAccount = new TenantPayoutAccount(this.http);\n this.webhookEndpoints = new WebhookEndpoints(this.http);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCO,IAAM,cAAN,cAA0B,MAAM;AAAA;AAAA,EAE5B;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAET,YACE,SACA,UAAkF,CAAC,GACnF;AACA,UAAM,OAAO;AACb,SAAK,OAAO,WAAW;AACvB,SAAK,SAAS,QAAQ;AACtB,SAAK,OAAO,QAAQ;AACpB,SAAK,OAAO,QAAQ;AACpB,SAAK,YAAY,QAAQ;AAAA,EAC3B;AACF;AAGO,IAAM,2BAAN,cAAuC,YAAY;AAAC;AAGpD,IAAM,4BAAN,cAAwC,YAAY;AAAC;AAGrD,IAAM,4BAAN,cAA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B,IAAI,oBAAoB,KAAK,IAAI;AAC5D,SAAK,mBAAmB,IAAI,iBAAiB,KAAK,IAAI;AAAA,EACxD;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/version.ts","../src/core.ts","../src/pagination.ts","../src/generated/routes.ts","../src/resource.ts","../src/resources/account.ts","../src/resources/commerce.ts","../src/resources/conversions.ts","../src/resources/cop.ts","../src/resources/crypto.ts","../src/resources/merchants.ts","../src/resources/payments.ts","../src/webhooks.ts","../src/client.ts"],"sourcesContent":["export { VexPay, VexPay as default, DEFAULT_BASE_URL, type VexPayOptions } from './client';\nexport type { RequestOptions } from './core';\nexport { PagePromise, type CursorPage } from './pagination';\nexport type {\n OperationId,\n PathParams,\n QueryParams,\n RequestBody,\n ResponseBody,\n Schemas,\n} from './types';\nexport {\n VexPayError,\n VexPayConfigurationError,\n VexPayAuthenticationError,\n VexPayInvalidRequestError,\n VexPayNotFoundError,\n VexPayConflictError,\n VexPayRateLimitError,\n VexPayAPIError,\n VexPayConnectionError,\n VexPayTimeoutError,\n VexPaySignatureVerificationError,\n} from './errors';\nexport {\n Webhooks,\n WEBHOOK_EVENT_NAMES,\n SIGNATURE_HEADER,\n DEFAULT_TOLERANCE_SECONDS,\n type WebhookEvent,\n type WebhookEventName,\n type PaymentWebhookData,\n type CopPaymentWebhookData,\n} from './webhooks';\nexport { VERSION } from './version';\n","/** Every error the SDK throws extends VexPayError. */\nexport class VexPayError extends Error {\n /** HTTP status, when the API answered. */\n readonly status?: number;\n /** Machine-readable API code, e.g. `insufficient_balance`. */\n readonly code?: string;\n /** Parsed response body, when the API answered. */\n readonly body?: unknown;\n /** Request id from the `x-request-id` response header, when present. */\n readonly requestId?: string;\n\n constructor(\n message: string,\n details: { status?: number; code?: string; body?: unknown; requestId?: string } = {},\n ) {\n super(message);\n this.name = new.target.name;\n this.status = details.status;\n this.code = details.code;\n this.body = details.body;\n this.requestId = details.requestId;\n }\n}\n\n/** Invalid client configuration (e.g. missing API key). Thrown before any request. */\nexport class VexPayConfigurationError extends VexPayError {}\n\n/** 401 — missing, invalid, or revoked API key. */\nexport class VexPayAuthenticationError extends VexPayError {}\n\n/** 400, 403, 410, 422 and other non-retryable 4xx — fix the request before retrying. */\nexport class VexPayInvalidRequestError extends VexPayError {}\n\n/** 404 — the resource does not exist (or belongs to another account). */\nexport class VexPayNotFoundError extends VexPayError {}\n\n/** 409 — e.g. `external_ref_conflict`, `idempotency_key_reused`. */\nexport class VexPayConflictError extends VexPayError {}\n\n/** 429 — too many requests. Retried automatically before surfacing. */\nexport class VexPayRateLimitError extends VexPayError {}\n\n/** 5xx — VEXPay or an upstream bank failed. Retried automatically before surfacing. */\nexport class VexPayAPIError extends VexPayError {}\n\n/** The request never got an HTTP answer (DNS, refused, reset). */\nexport class VexPayConnectionError extends VexPayError {}\n\n/** The request exceeded `timeoutMs`. */\nexport class VexPayTimeoutError extends VexPayConnectionError {}\n\n/** A webhook signature did not verify (see `webhooks.constructEvent`). */\nexport class VexPaySignatureVerificationError extends VexPayError {}\n\nconst MACHINE_CODE = /^[a-z][a-z0-9_]*$/;\n\nfunction messageFrom(body: unknown, status: number): string {\n if (body && typeof body === 'object') {\n const { message, error } = body as { message?: unknown; error?: unknown };\n if (Array.isArray(message)) return message.join('; ');\n if (typeof message === 'string' && message) return message;\n if (typeof error === 'string' && error) return error;\n }\n if (typeof body === 'string' && body) return body;\n return `VEXPay API responded with HTTP ${status}`;\n}\n\n/** Maps an HTTP error response to the matching error class. */\nexport function errorFromResponse(status: number, body: unknown, requestId?: string): VexPayError {\n const rawCode = body && typeof body === 'object' ? (body as { error?: unknown }).error : undefined;\n const code = typeof rawCode === 'string' && MACHINE_CODE.test(rawCode) ? rawCode : undefined;\n const details = { status, code, body, requestId };\n const message = messageFrom(body, status);\n\n if (status === 401) return new VexPayAuthenticationError(message, details);\n if (status === 404) return new VexPayNotFoundError(message, details);\n if (status === 409) return new VexPayConflictError(message, details);\n if (status === 429) return new VexPayRateLimitError(message, details);\n if (status >= 500) return new VexPayAPIError(message, details);\n return new VexPayInvalidRequestError(message, details);\n}\n","export const VERSION = '0.8.0';\n","import {\n VexPayConnectionError,\n VexPayError,\n VexPayTimeoutError,\n errorFromResponse,\n} from './errors';\nimport { VERSION } from './version';\n\nexport type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport type QueryValue = string | number | boolean | null | undefined;\n\n/** Per-request options accepted by every resource method. */\nexport interface RequestOptions {\n /** Sent as `Idempotency-Key` on POST. Defaults to a random UUID per call, reused across retries. */\n idempotencyKey?: string;\n /** Overrides the client's `timeoutMs` for this call. */\n timeoutMs?: number;\n /** Overrides the client's `maxNetworkRetries` for this call. */\n maxNetworkRetries?: number;\n /** Aborts the call (and any pending retry). */\n signal?: AbortSignal;\n}\n\nexport interface CoreConfig {\n apiKey: string;\n baseUrl: string;\n timeoutMs: number;\n maxNetworkRetries: number;\n fetch: typeof fetch;\n /** Test hook — defaults to setTimeout. */\n sleep?: (ms: number) => Promise<void>;\n}\n\nconst INITIAL_RETRY_DELAY_MS = 500;\nconst MAX_RETRY_DELAY_MS = 8_000;\nconst MAX_RETRY_AFTER_MS = 60_000;\n\nfunction defaultSleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nfunction userAgent(): string {\n const runtime = typeof process !== 'undefined' && process.version ? ` node/${process.version}` : '';\n return `vexpay-node/${VERSION}${runtime}`;\n}\n\n/** Retry-After as seconds or an HTTP date → milliseconds, capped. */\nexport function parseRetryAfter(value: string | null, now = Date.now()): number | undefined {\n if (!value) return undefined;\n const seconds = Number(value);\n if (Number.isFinite(seconds) && seconds >= 0) return Math.min(seconds * 1000, MAX_RETRY_AFTER_MS);\n const date = Date.parse(value);\n if (Number.isFinite(date)) return Math.min(Math.max(0, date - now), MAX_RETRY_AFTER_MS);\n return undefined;\n}\n\n/** Exponential backoff with full jitter: attempt 0 → [250, 500) ms, doubling, capped. */\nexport function backoffDelay(attempt: number, random = Math.random): number {\n const ceiling = Math.min(INITIAL_RETRY_DELAY_MS * 2 ** attempt, MAX_RETRY_DELAY_MS);\n return Math.round(ceiling / 2 + random() * (ceiling / 2));\n}\n\nfunction isRetryable(error: VexPayError): boolean {\n if (error instanceof VexPayConnectionError) return true;\n if (error.status === 429) return true;\n if (error.status !== undefined && error.status >= 500) return true;\n return error.status === 409 && error.code === 'idempotency_request_in_progress';\n}\n\nfunction buildUrl(baseUrl: string, path: string, query?: Record<string, QueryValue>): string {\n const url = new URL(path.replace(/^\\//, ''), baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`);\n for (const [key, value] of Object.entries(query ?? {})) {\n if (value !== undefined && value !== null) url.searchParams.set(key, String(value));\n }\n return url.toString();\n}\n\nasync function readBody(response: Response): Promise<unknown> {\n const text = await response.text();\n if (!text) return undefined;\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n}\n\nexport class HttpClient {\n private readonly sleep: (ms: number) => Promise<void>;\n\n constructor(private readonly config: CoreConfig) {\n this.sleep = config.sleep ?? defaultSleep;\n }\n\n async request<T>(\n method: HttpMethod,\n path: string,\n params: { query?: Record<string, QueryValue>; body?: unknown } = {},\n options: RequestOptions = {},\n ): Promise<T> {\n const maxRetries = options.maxNetworkRetries ?? this.config.maxNetworkRetries;\n const timeoutMs = options.timeoutMs ?? this.config.timeoutMs;\n const url = buildUrl(this.config.baseUrl, path, params.query);\n\n const headers: Record<string, string> = {\n accept: 'application/json',\n 'x-api-key': this.config.apiKey,\n 'user-agent': userAgent(),\n };\n if (params.body !== undefined) headers['content-type'] = 'application/json';\n // One key for every attempt of this call: a retried POST can never charge twice.\n if (method === 'POST') headers['idempotency-key'] = options.idempotencyKey ?? crypto.randomUUID();\n const body = params.body === undefined ? undefined : JSON.stringify(params.body);\n\n for (let attempt = 0; ; attempt += 1) {\n let error: VexPayError;\n let retryAfterMs: number | undefined;\n\n try {\n const response = await this.send(url, { method, headers, body }, timeoutMs, options.signal);\n const parsed = await readBody(response);\n if (response.ok) return parsed as T;\n error = errorFromResponse(response.status, parsed, response.headers.get('x-request-id') ?? undefined);\n retryAfterMs = parseRetryAfter(response.headers.get('retry-after'));\n } catch (caught) {\n if (!(caught instanceof VexPayError)) throw caught;\n error = caught;\n }\n\n if (attempt >= maxRetries || !isRetryable(error) || options.signal?.aborted) throw error;\n await this.sleep(retryAfterMs ?? backoffDelay(attempt));\n }\n }\n\n private async send(\n url: string,\n init: { method: HttpMethod; headers: Record<string, string>; body?: string },\n timeoutMs: number,\n signal?: AbortSignal,\n ): Promise<Response> {\n const controller = new AbortController();\n let timedOut = false;\n const timer = setTimeout(() => {\n timedOut = true;\n controller.abort();\n }, timeoutMs);\n const onAbort = () => controller.abort();\n signal?.addEventListener('abort', onAbort, { once: true });\n\n try {\n return await this.config.fetch(url, { ...init, signal: controller.signal });\n } catch (caught) {\n if (timedOut) {\n throw new VexPayTimeoutError(`Request to VEXPay timed out after ${timeoutMs}ms`);\n }\n if (signal?.aborted) throw caught;\n const reason = caught instanceof Error ? caught.message : String(caught);\n throw new VexPayConnectionError(`Could not reach VEXPay: ${reason}`);\n } finally {\n clearTimeout(timer);\n signal?.removeEventListener('abort', onAbort);\n }\n }\n}\n","export type CursorPage<Item> = { items: Item[]; nextCursor?: string | null };\n\n/**\n * Result of a cursor-paginated `list()`.\n *\n * const page = await vexpay.merchants.list({ limit: 100 }); // first page\n * for await (const merchant of vexpay.merchants.list()) { … } // every item, all pages\n *\n * The first request is sent when the result is awaited or iterated.\n */\nexport class PagePromise<Page extends CursorPage<Item>, Item = Page['items'][number]>\n implements PromiseLike<Page>, AsyncIterable<Item>\n{\n private firstPage?: Promise<Page>;\n\n constructor(\n private readonly fetchPage: (cursor: string | undefined) => Promise<Page>,\n private readonly startCursor?: string,\n ) {}\n\n private first(): Promise<Page> {\n return (this.firstPage ??= this.fetchPage(this.startCursor));\n }\n\n then<TResult1 = Page, TResult2 = never>(\n onfulfilled?: ((value: Page) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null,\n ): Promise<TResult1 | TResult2> {\n return this.first().then(onfulfilled, onrejected);\n }\n\n catch<TResult = never>(\n onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null,\n ): Promise<Page | TResult> {\n return this.first().catch(onrejected);\n }\n\n finally(onfinally?: (() => void) | null): Promise<Page> {\n return this.first().finally(onfinally);\n }\n\n async *[Symbol.asyncIterator](): AsyncIterator<Item> {\n let page = await this.first();\n let cursor = this.startCursor;\n for (;;) {\n for (const item of page.items) yield item;\n const next = page.nextCursor;\n // Stop on the last page, or if the API ever repeats a cursor.\n if (!next || next === cursor) return;\n cursor = next;\n page = await this.fetchPage(next);\n }\n }\n\n /** Collects items across pages, stopping after `limit` (default 10 000). */\n async autoPagingToArray({ limit = 10_000 }: { limit?: number } = {}): Promise<Item[]> {\n const items: Item[] = [];\n for await (const item of this) {\n items.push(item);\n if (items.length >= limit) break;\n }\n return items;\n }\n}\n","// Generated by scripts/generate-routes.mjs from packages/sdk-spec/openapi.json — do not edit.\nimport type { operations } from './openapi';\n\nexport type OperationId = keyof operations;\n\nexport const ROUTES = {\n Balance_getBalance: { method: 'GET', path: '/v1/balance' },\n Balance_listTransactions: { method: 'GET', path: '/v1/balance/transactions' },\n CheckoutSessions_create: { method: 'POST', path: '/v1/checkout/sessions' },\n CheckoutSessions_retrieve: { method: 'GET', path: '/v1/checkout/sessions/{id}' },\n Conversions_cancel: { method: 'POST', path: '/v1/conversions/{id}/cancel' },\n Conversions_create: { method: 'POST', path: '/v1/conversions' },\n Conversions_createQuote: { method: 'POST', path: '/v1/conversions/quotes' },\n Conversions_get: { method: 'GET', path: '/v1/conversions/{id}' },\n Conversions_list: { method: 'GET', path: '/v1/conversions' },\n ConversionSettings_get: { method: 'GET', path: '/v1/conversions/settings' },\n ConversionSettings_update: { method: 'PATCH', path: '/v1/conversions/settings' },\n CopPayments_balance: { method: 'GET', path: '/v1/cop/balance' },\n CopPayments_cancel: { method: 'POST', path: '/v1/cop/payments/{id}/cancel' },\n CopPayments_create: { method: 'POST', path: '/v1/cop/payments' },\n CopPayments_get: { method: 'GET', path: '/v1/cop/payments/{id}' },\n CopPayments_refund: { method: 'POST', path: '/v1/cop/payments/{id}/refund' },\n CopPayments_submitOtp: { method: 'POST', path: '/v1/cop/payments/{id}/otp' },\n Crypto_createDepositAddress: { method: 'POST', path: '/v1/crypto/deposit-addresses' },\n Crypto_createPayout: { method: 'POST', path: '/v1/crypto/payouts' },\n Crypto_getBalance: { method: 'GET', path: '/v1/crypto/balance' },\n Crypto_getBalances: { method: 'GET', path: '/v1/crypto/balances' },\n Crypto_getPayout: { method: 'GET', path: '/v1/crypto/payouts/{id}' },\n Crypto_listNetworks: { method: 'GET', path: '/v1/crypto/networks' },\n Merchants_addPayoutMethod: { method: 'POST', path: '/v1/merchants/{id}/payout-methods' },\n Merchants_confirmVerify: { method: 'POST', path: '/v1/merchants/{id}/verify' },\n Merchants_confirmVerifyMethod: { method: 'POST', path: '/v1/merchants/{id}/payout-methods/{methodId}/verify' },\n Merchants_create: { method: 'POST', path: '/v1/merchants' },\n Merchants_deletePayoutMethod: { method: 'DELETE', path: '/v1/merchants/{id}/payout-methods/{methodId}' },\n Merchants_getBalance: { method: 'GET', path: '/v1/merchants/{id}/balance' },\n Merchants_getById: { method: 'GET', path: '/v1/merchants/{id}' },\n Merchants_listAuditEvents: { method: 'GET', path: '/v1/merchants/{id}/audit-events' },\n Merchants_listOrGetByRef: { method: 'GET', path: '/v1/merchants' },\n Merchants_listPayoutMethods: { method: 'GET', path: '/v1/merchants/{id}/payout-methods' },\n Merchants_remove: { method: 'DELETE', path: '/v1/merchants/{id}' },\n Merchants_setDefaultPayoutMethod: { method: 'POST', path: '/v1/merchants/{id}/payout-methods/{methodId}/default' },\n Merchants_startVerify: { method: 'POST', path: '/v1/merchants/{id}/verify/start' },\n Merchants_startVerifyMethod: { method: 'POST', path: '/v1/merchants/{id}/payout-methods/{methodId}/verify/start' },\n Merchants_transfer: { method: 'POST', path: '/v1/merchants/{id}/transfers' },\n Merchants_update: { method: 'PATCH', path: '/v1/merchants/{id}' },\n Notifications_sendTest: { method: 'POST', path: '/v1/notifications/test' },\n PaymentLinks_get: { method: 'GET', path: '/v1/payment-links/{id}' },\n PaymentLinks_remove: { method: 'DELETE', path: '/v1/payment-links/{id}' },\n PaymentLinks_update: { method: 'PATCH', path: '/v1/payment-links/{id}' },\n Payments_executeC2p: { method: 'POST', path: '/v1/payments/c2p' },\n Payments_executeVpos: { method: 'POST', path: '/v1/payments/vpos' },\n Payments_getBanks: { method: 'GET', path: '/v1/banks' },\n Payments_getPagoMovilReceivingAccount: { method: 'GET', path: '/v1/payments/pago-movil/receiving-account' },\n Payments_getPayment: { method: 'GET', path: '/v1/payments/{id}' },\n Payments_getPaymentByRef: { method: 'GET', path: '/v1/payments/by-ref/{externalRef}' },\n Payments_getQuote: { method: 'GET', path: '/v1/quote' },\n Payments_listPaymentMethods: { method: 'GET', path: '/v1/payment-methods' },\n Payments_requestC2p: { method: 'POST', path: '/v1/payments/c2p/request' },\n Payments_reversePayment: { method: 'POST', path: '/v1/payments/{id}/reverse' },\n Payments_verifyPagoMovil: { method: 'POST', path: '/v1/payments/pago-movil/verify' },\n Payouts_create: { method: 'POST', path: '/v1/payouts' },\n Payouts_createBatch: { method: 'POST', path: '/v1/payouts/batch' },\n Payouts_createInstant: { method: 'POST', path: '/v1/payouts/instant' },\n Payouts_getById: { method: 'GET', path: '/v1/payouts/{id}' },\n Payouts_getByRef: { method: 'GET', path: '/v1/payouts/by-ref/{externalRef}' },\n Payouts_list: { method: 'GET', path: '/v1/payouts' },\n Products_create: { method: 'POST', path: '/v1/products' },\n Products_createLink: { method: 'POST', path: '/v1/products/{id}/links' },\n Products_get: { method: 'GET', path: '/v1/products/{id}' },\n Products_list: { method: 'GET', path: '/v1/products' },\n Products_listLinks: { method: 'GET', path: '/v1/products/{id}/links' },\n Products_remove: { method: 'DELETE', path: '/v1/products/{id}' },\n Products_update: { method: 'PATCH', path: '/v1/products/{id}' },\n R4Operations_consultarOperacion: { method: 'GET', path: '/v1/payments/operations/{id}' },\n R4Operations_creditoCuentas: { method: 'POST', path: '/v1/payments/credit/account' },\n R4Operations_creditoInmediato: { method: 'POST', path: '/v1/payments/credit' },\n R4Operations_debitoInmediato: { method: 'POST', path: '/v1/payments/debit' },\n R4Operations_dispersarCredito: { method: 'POST', path: '/v1/payments/credit/disburse' },\n R4Operations_dispersarPagos: { method: 'POST', path: '/v1/payments/payouts' },\n R4Operations_ejecutarVuelto: { method: 'POST', path: '/v1/payments/change' },\n R4Operations_generarOtp: { method: 'POST', path: '/v1/payments/debit/otp' },\n R4Operations_pollOperation: { method: 'POST', path: '/v1/payments/operations/poll' },\n TenantPayoutAccount_confirmVerify: { method: 'POST', path: '/v1/tenant/payout-account/verify' },\n TenantPayoutAccount_get: { method: 'GET', path: '/v1/tenant/payout-account' },\n TenantPayoutAccount_startVerify: { method: 'POST', path: '/v1/tenant/payout-account/verify/start' },\n TenantPayoutAccount_upsert: { method: 'PUT', path: '/v1/tenant/payout-account' },\n TenantPayoutAccount_upsertPost: { method: 'POST', path: '/v1/tenant/payout-account' },\n Webhooks_createWebhook: { method: 'POST', path: '/v1/webhooks' },\n Webhooks_deleteWebhook: { method: 'DELETE', path: '/v1/webhooks/{id}' },\n Webhooks_listWebhooks: { method: 'GET', path: '/v1/webhooks' },\n Webhooks_updateWebhook: { method: 'PATCH', path: '/v1/webhooks/{id}' },\n} as const satisfies Record<OperationId, { method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; path: string }>;\n","import type { HttpClient, QueryValue, RequestOptions } from './core';\nimport { VexPayInvalidRequestError } from './errors';\nimport { ROUTES } from './generated/routes';\nimport type { OperationId, ResponseBody } from './types';\n\nexport type CallArgs = {\n path?: Record<string, string>;\n query?: object;\n body?: unknown;\n};\n\n/** Base class for resources: turns an operationId + args into a typed HTTP call. */\nexport abstract class APIResource {\n constructor(protected readonly http: HttpClient) {}\n\n /** Async so a bad argument surfaces as a rejected promise, never a synchronous throw. */\n protected async call<O extends OperationId>(\n operationId: O,\n args: CallArgs = {},\n options?: RequestOptions,\n ): Promise<ResponseBody<O>> {\n const route = ROUTES[operationId];\n const path = route.path.replace(/\\{(\\w+)\\}/g, (_match, name: string) => {\n const value = args.path?.[name];\n if (typeof value !== 'string' || value === '') {\n throw new VexPayInvalidRequestError(`Missing required path parameter \"${name}\" for ${operationId}.`);\n }\n return encodeURIComponent(value);\n });\n return this.http.request<ResponseBody<O>>(\n route.method,\n path,\n { query: args.query as Record<string, QueryValue> | undefined, body: args.body },\n options,\n );\n }\n}\n","import type { RequestOptions } from '../core';\nimport { PagePromise } from '../pagination';\nimport { APIResource } from '../resource';\nimport type { QueryParams, RequestBody } from '../types';\n\n/** Venezuelan bank catalog (SIMF codes, supported services, logos). */\nexport class Banks extends APIResource {\n list(options?: RequestOptions) {\n return this.call('Payments_getBanks', {}, options);\n }\n}\n\n/** USD → VES at the official BCV rate. */\nexport class Quotes extends APIResource {\n retrieve(params: QueryParams<'Payments_getQuote'>, options?: RequestOptions) {\n return this.call('Payments_getQuote', { query: params }, options);\n }\n}\n\n/** Every movement in your VES balance (payments, fees, payouts, chargebacks, …), newest first. */\nexport class BalanceTransactions extends APIResource {\n /** Await for one page, or `for await` over every movement. The amounts sum to `ledgerNetVes`. */\n list(params: QueryParams<'Balance_listTransactions'> = {}, options?: RequestOptions) {\n return new PagePromise(\n (cursor) => this.call('Balance_listTransactions', { query: { ...params, cursor } }, options),\n params.cursor,\n );\n }\n}\n\n/** Your platform balance. */\nexport class Balance extends APIResource {\n readonly transactions = new BalanceTransactions(this.http);\n\n retrieve(options?: RequestOptions) {\n return this.call('Balance_getBalance', {}, options);\n }\n}\n\n/** VES payouts to verified merchants. `externalRef` is the idempotency key. */\nexport class Payouts extends APIResource {\n create(params: RequestBody<'Payouts_create'>, options?: RequestOptions) {\n return this.call('Payouts_create', { body: params }, options);\n }\n\n /** Pay out immediately (crédito inmediato). */\n createInstant(params: RequestBody<'Payouts_createInstant'>, options?: RequestOptions) {\n return this.call('Payouts_createInstant', { body: params }, options);\n }\n\n /** Many payouts in one request, with item-level idempotency. */\n createBatch(params: RequestBody<'Payouts_createBatch'>, options?: RequestOptions) {\n return this.call('Payouts_createBatch', { body: params }, options);\n }\n\n /** Await for one page, or `for await` over every payout. */\n list(params: QueryParams<'Payouts_list'> = {}, options?: RequestOptions) {\n return new PagePromise(\n (cursor) => this.call('Payouts_list', { query: { ...params, cursor } }, options),\n params.cursor,\n );\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Payouts_getById', { path: { id } }, options);\n }\n\n retrieveByRef(externalRef: string, options?: RequestOptions) {\n return this.call('Payouts_getByRef', { path: { externalRef } }, options);\n }\n}\n\n/** The account your own VEXPay earnings are paid out to. */\nexport class TenantPayoutAccount extends APIResource {\n retrieve(options?: RequestOptions) {\n return this.call('TenantPayoutAccount_get', {}, options);\n }\n\n /** Create or replace the payout account (PUT). */\n upsert(params: RequestBody<'TenantPayoutAccount_upsert'>, options?: RequestOptions) {\n return this.call('TenantPayoutAccount_upsert', { body: params }, options);\n }\n\n /** Same as `upsert`, sent as POST (supports `Idempotency-Key`). */\n create(params: RequestBody<'TenantPayoutAccount_upsertPost'>, options?: RequestOptions) {\n return this.call('TenantPayoutAccount_upsertPost', { body: params }, options);\n }\n\n startVerification(options?: RequestOptions) {\n return this.call('TenantPayoutAccount_startVerify', {}, options);\n }\n\n confirmVerification(params: RequestBody<'TenantPayoutAccount_confirmVerify'>, options?: RequestOptions) {\n return this.call('TenantPayoutAccount_confirmVerify', { body: params }, options);\n }\n}\n\n/** Where VEXPay delivers signed webhooks. */\nexport class WebhookEndpoints extends APIResource {\n /** The response includes the signing `secret` — store it to verify deliveries. */\n create(params: RequestBody<'Webhooks_createWebhook'>, options?: RequestOptions) {\n return this.call('Webhooks_createWebhook', { body: params }, options);\n }\n\n list(options?: RequestOptions) {\n return this.call('Webhooks_listWebhooks', {}, options);\n }\n\n update(id: string, params: RequestBody<'Webhooks_updateWebhook'>, options?: RequestOptions) {\n return this.call('Webhooks_updateWebhook', { path: { id }, body: params }, options);\n }\n\n delete(id: string, options?: RequestOptions) {\n return this.call('Webhooks_deleteWebhook', { path: { id } }, options);\n }\n\n /** Send a `notification.test` delivery to your endpoints. */\n sendTest(options?: RequestOptions) {\n return this.call('Notifications_sendTest', {}, options);\n }\n}\n","import type { RequestOptions } from '../core';\nimport { PagePromise } from '../pagination';\nimport { APIResource } from '../resource';\nimport type { QueryParams, RequestBody } from '../types';\n\n/** Single-purchase checkouts: redirect to `url`, or embed with @vexpay/js using `clientSecret`. */\nexport class CheckoutSessions extends APIResource {\n /** `clientSecret` is returned only here — hand it to the browser, never store or log it. */\n create(params: RequestBody<'CheckoutSessions_create'>, options?: RequestOptions) {\n return this.call('CheckoutSessions_create', { body: params }, options);\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('CheckoutSessions_retrieve', { path: { id } }, options);\n }\n}\n\nexport class Checkout extends APIResource {\n readonly sessions = new CheckoutSessions(this.http);\n}\n\n/** No-code products sold through hosted payment links. */\nexport class Products extends APIResource {\n create(params: RequestBody<'Products_create'>, options?: RequestOptions) {\n return this.call('Products_create', { body: params }, options);\n }\n\n /** Await for one page, or `for await` over every product. */\n list(params: QueryParams<'Products_list'> = {}, options?: RequestOptions) {\n return new PagePromise(\n (cursor) => this.call('Products_list', { query: { ...params, cursor } }, options),\n params.cursor,\n );\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Products_get', { path: { id } }, options);\n }\n\n update(id: string, params: RequestBody<'Products_update'>, options?: RequestOptions) {\n return this.call('Products_update', { path: { id }, body: params }, options);\n }\n\n delete(id: string, options?: RequestOptions) {\n return this.call('Products_remove', { path: { id } }, options);\n }\n\n /** Publish a shareable `/pay/:slug` link for this product. */\n createLink(id: string, params: RequestBody<'Products_createLink'>, options?: RequestOptions) {\n return this.call('Products_createLink', { path: { id }, body: params }, options);\n }\n\n listLinks(id: string, options?: RequestOptions) {\n return this.call('Products_listLinks', { path: { id } }, options);\n }\n}\n\nexport class PaymentLinks extends APIResource {\n retrieve(id: string, options?: RequestOptions) {\n return this.call('PaymentLinks_get', { path: { id } }, options);\n }\n\n update(id: string, params: RequestBody<'PaymentLinks_update'>, options?: RequestOptions) {\n return this.call('PaymentLinks_update', { path: { id }, body: params }, options);\n }\n\n delete(id: string, options?: RequestOptions) {\n return this.call('PaymentLinks_remove', { path: { id } }, options);\n }\n}\n","import type { RequestOptions } from '../core';\nimport { PagePromise } from '../pagination';\nimport { APIResource } from '../resource';\nimport type { QueryParams, RequestBody } from '../types';\n\n/** A rate for converting VES or COP to USDT, locked for 60 seconds. */\nexport class ConversionQuotes extends APIResource {\n /**\n * `sourceCurrency` is `'VES'` (default) or `'COP'`. Send `sourceAmount` (to spend; COP in whole pesos)\n * or `targetAmountUsdt` (USDT to receive) — exactly one. VES may still use `sourceAmountVes`.\n */\n create(params: RequestBody<'Conversions_createQuote'>, options?: RequestOptions) {\n return this.call('Conversions_createQuote', { body: params }, options);\n }\n}\n\n/** Your conversion spreads, minimum and caps, and COP auto-convert. */\nexport class ConversionSettings extends APIResource {\n retrieve(options?: RequestOptions) {\n return this.call('ConversionSettings_get', {}, options);\n }\n\n /** Only `autoConvert.COP.percent` (0–100, whole number; 0 = off) can be changed. */\n update(params: RequestBody<'ConversionSettings_update'>, options?: RequestOptions) {\n return this.call('ConversionSettings_update', { body: params }, options);\n }\n}\n\n/**\n * Convert available VES or COP into your USDT balance. Accepting a quote debits the source at once\n * (`conversion.created`); the conversion is `PENDING` until VEXPay delivers the USDT\n * (`conversion.completed`). Enabled per account.\n */\nexport class Conversions extends APIResource {\n readonly quotes = new ConversionQuotes(this.http);\n readonly settings = new ConversionSettings(this.http);\n\n /** Accept a quote (`quoteId`). Pass `idempotencyKey` in options to retry safely. */\n create(params: RequestBody<'Conversions_create'>, options?: RequestOptions) {\n return this.call('Conversions_create', { body: params }, options);\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Conversions_get', { path: { id } }, options);\n }\n\n /** Await for one page, or `for await` over every conversion (newest first). Filter with `sourceCurrency`. */\n list(params: QueryParams<'Conversions_list'> = {}, options?: RequestOptions) {\n return new PagePromise(\n (cursor) => this.call('Conversions_list', { query: { ...params, cursor } }, options),\n params.cursor,\n );\n }\n\n /** Cancel a `PENDING` conversion; the VES or COP returns to your available balance. */\n cancel(id: string, options?: RequestOptions) {\n return this.call('Conversions_cancel', { path: { id } }, options);\n }\n}\n","import type { RequestOptions } from '../core';\nimport { APIResource } from '../resource';\nimport type { RequestBody } from '../types';\n\n/**\n * Colombian peso payments: Bre-B (QR / transfer key), Nequi (push approval) or Daviplata (SMS\n * code). Payments complete asynchronously — listen for `payment.completed` / `payment.failed`.\n * COP must be enabled on your account (403 `method_not_allowed` otherwise).\n */\nexport class CopPayments extends APIResource {\n /**\n * Create a payment in whole pesos. `buyer` is required for `nequi` and `daviplata`. The response\n * `next` says what the buyer does: `show_qr`, `approve_in_app` or `submit_otp`.\n * Pass `idempotencyKey` in options to retry safely.\n */\n create(params: RequestBody<'CopPayments_create'>, options?: RequestOptions) {\n return this.call('CopPayments_create', { body: params }, options);\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('CopPayments_get', { path: { id } }, options);\n }\n\n /** Daviplata: submit the code the buyer received by SMS. A wrong code fails with `invalid_otp`. */\n submitOtp(id: string, params: RequestBody<'CopPayments_submitOtp'>, options?: RequestOptions) {\n return this.call('CopPayments_submitOtp', { path: { id }, body: params }, options);\n }\n\n /** Cancel a pending payment. */\n cancel(id: string, options?: RequestOptions) {\n return this.call('CopPayments_cancel', { path: { id } }, options);\n }\n\n /** Full refund of a completed payment, within 96 hours. */\n refund(id: string, options?: RequestOptions) {\n return this.call('CopPayments_refund', { path: { id } }, options);\n }\n}\n\n/** Your COP balance, in whole pesos. Kept apart from VES and stablecoins. */\nexport class CopBalance extends APIResource {\n retrieve(options?: RequestOptions) {\n return this.call('CopPayments_balance', {}, options);\n }\n}\n\n/** Collect Colombian pesos (Bre-B, Nequi, Daviplata). */\nexport class Cop extends APIResource {\n readonly payments = new CopPayments(this.http);\n readonly balance = new CopBalance(this.http);\n}\n","import type { RequestOptions } from '../core';\nimport { APIResource } from '../resource';\nimport type { QueryParams, RequestBody } from '../types';\n\n/** One stablecoin balance (`currency`: USDT by default, or USDC). Never converted to VES. */\nexport class CryptoBalance extends APIResource {\n retrieve(params: QueryParams<'Crypto_getBalance'> = {}, options?: RequestOptions) {\n return this.call('Crypto_getBalance', { query: params }, options);\n }\n}\n\n/** Every stablecoin balance (USDT and USDC). */\nexport class CryptoBalances extends APIResource {\n list(options?: RequestOptions) {\n return this.call('Crypto_getBalances', {}, options);\n }\n}\n\n/** Static deposit addresses per customer, stablecoin (`currency`) and network. */\nexport class DepositAddresses extends APIResource {\n /** Get or create — calling again for the same customer and network returns the same address. */\n create(params: RequestBody<'Crypto_createDepositAddress'>, options?: RequestOptions) {\n return this.call('Crypto_createDepositAddress', { body: params }, options);\n }\n}\n\n/** Enabled networks for one stablecoin (`currency`) with the payout fee and availability for an amount. */\nexport class CryptoNetworks extends APIResource {\n list(params: QueryParams<'Crypto_listNetworks'> = {}, options?: RequestOptions) {\n return this.call('Crypto_listNetworks', { query: params }, options);\n }\n}\n\n/** Stablecoin payouts to external addresses (`currency`: USDT or USDC). `idempotencyKey` (in the body) makes retries safe. */\nexport class CryptoPayouts extends APIResource {\n create(params: RequestBody<'Crypto_createPayout'>, options?: RequestOptions) {\n return this.call('Crypto_createPayout', { body: params }, options);\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Crypto_getPayout', { path: { id } }, options);\n }\n}\n\n/** Stablecoins (USDT, USDC): deposit addresses, balances, networks and payouts. */\nexport class Crypto extends APIResource {\n readonly balance = new CryptoBalance(this.http);\n readonly balances = new CryptoBalances(this.http);\n readonly depositAddresses = new DepositAddresses(this.http);\n readonly networks = new CryptoNetworks(this.http);\n readonly payouts = new CryptoPayouts(this.http);\n}\n","import type { RequestOptions } from '../core';\nimport { PagePromise } from '../pagination';\nimport { APIResource } from '../resource';\nimport type { QueryParams, RequestBody, Schemas } from '../types';\n\nexport type MerchantListParams = Omit<QueryParams<'Merchants_listOrGetByRef'>, 'externalRef'>;\n\n/** Where a merchant gets paid (bank account or Pago Móvil). */\nexport class PayoutMethods extends APIResource {\n list(merchantId: string, options?: RequestOptions) {\n return this.call('Merchants_listPayoutMethods', { path: { id: merchantId } }, options);\n }\n\n create(merchantId: string, params: RequestBody<'Merchants_addPayoutMethod'>, options?: RequestOptions) {\n return this.call('Merchants_addPayoutMethod', { path: { id: merchantId }, body: params }, options);\n }\n\n setDefault(merchantId: string, methodId: string, options?: RequestOptions) {\n return this.call('Merchants_setDefaultPayoutMethod', { path: { id: merchantId, methodId } }, options);\n }\n\n delete(merchantId: string, methodId: string, options?: RequestOptions) {\n return this.call('Merchants_deletePayoutMethod', { path: { id: merchantId, methodId } }, options);\n }\n\n /** Send micro-deposits to this payout method. */\n startVerification(merchantId: string, methodId: string, options?: RequestOptions) {\n return this.call('Merchants_startVerifyMethod', { path: { id: merchantId, methodId } }, options);\n }\n\n /** Confirm the micro-deposit amounts the merchant saw. */\n confirmVerification(\n merchantId: string,\n methodId: string,\n params: RequestBody<'Merchants_confirmVerifyMethod'>,\n options?: RequestOptions,\n ) {\n return this.call(\n 'Merchants_confirmVerifyMethod',\n { path: { id: merchantId, methodId }, body: params },\n options,\n );\n }\n}\n\nexport class Merchants extends APIResource {\n readonly payoutMethods = new PayoutMethods(this.http);\n\n /** `externalRef` is required and is the idempotency key for merchant creation. */\n create(params: RequestBody<'Merchants_create'>, options?: RequestOptions) {\n return this.call('Merchants_create', { body: params }, options);\n }\n\n /** Await for one page (`items`, `nextCursor`), or `for await` over every merchant. */\n list(params: MerchantListParams = {}, options?: RequestOptions) {\n return new PagePromise<Schemas['MerchantListResponseDto']>(\n (cursor) =>\n this.call('Merchants_listOrGetByRef', { query: { ...params, cursor } }, options) as Promise<\n Schemas['MerchantListResponseDto']\n >,\n params.cursor,\n );\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Merchants_getById', { path: { id } }, options);\n }\n\n /** Look up a merchant by the `externalRef` you created it with. */\n retrieveByRef(externalRef: string, options?: RequestOptions) {\n return this.call('Merchants_listOrGetByRef', { query: { externalRef } }, options) as Promise<\n Schemas['MerchantResponseDto']\n >;\n }\n\n update(id: string, params: RequestBody<'Merchants_update'>, options?: RequestOptions) {\n return this.call('Merchants_update', { path: { id }, body: params }, options);\n }\n\n delete(id: string, options?: RequestOptions) {\n return this.call('Merchants_remove', { path: { id } }, options);\n }\n\n retrieveBalance(id: string, options?: RequestOptions) {\n return this.call('Merchants_getBalance', { path: { id } }, options);\n }\n\n /** Move VES between this merchant's balance and another. */\n transfer(id: string, params: RequestBody<'Merchants_transfer'>, options?: RequestOptions) {\n return this.call('Merchants_transfer', { path: { id }, body: params }, options);\n }\n\n listAuditEvents(id: string, options?: RequestOptions) {\n return this.call('Merchants_listAuditEvents', { path: { id } }, options);\n }\n\n /** Send micro-deposits to the merchant's default payout method. */\n startVerification(id: string, options?: RequestOptions) {\n return this.call('Merchants_startVerify', { path: { id } }, options);\n }\n\n confirmVerification(id: string, params: RequestBody<'Merchants_confirmVerify'>, options?: RequestOptions) {\n return this.call('Merchants_confirmVerify', { path: { id }, body: params }, options);\n }\n}\n","import type { RequestOptions } from '../core';\nimport { APIResource } from '../resource';\nimport type { RequestBody } from '../types';\n\n/** Pago Móvil C2P: request the bank OTP, then charge with the customer's token. */\nexport class C2p extends APIResource {\n /** Create a C2P intent; the payer's bank sends them a token (see `otpRequested`). */\n request(params: RequestBody<'Payments_requestC2p'>, options?: RequestOptions) {\n return this.call('Payments_requestC2p', { body: params }, options);\n }\n\n /** Charge with the bank-issued token. Pass `intentId` from `request()`. */\n execute(params: RequestBody<'Payments_executeC2p'>, options?: RequestOptions) {\n return this.call('Payments_executeC2p', { body: params }, options);\n }\n}\n\n/** Card payments (VPOS). Prefer the hosted/embedded checkout so card data never touches your servers. */\nexport class Vpos extends APIResource {\n create(params: RequestBody<'Payments_executeVpos'>, options?: RequestOptions) {\n return this.call('Payments_executeVpos', { body: params }, options);\n }\n}\n\n/** Confirm a Pago Móvil the customer already sent to you. */\nexport class PagoMovil extends APIResource {\n /**\n * The account your customers must send the Pago Móvil to (bank, phone, identification).\n * Don't offer Pago Móvil while `configured` is false.\n */\n receivingAccount(options?: RequestOptions) {\n return this.call('Payments_getPagoMovilReceivingAccount', {}, options);\n }\n\n verify(params: RequestBody<'Payments_verifyPagoMovil'>, options?: RequestOptions) {\n return this.call('Payments_verifyPagoMovil', { body: params }, options);\n }\n}\n\n/** Débito inmediato (advanced payments, enabled per account). */\nexport class Debit extends APIResource {\n requestOtp(params: RequestBody<'R4Operations_generarOtp'>, options?: RequestOptions) {\n return this.call('R4Operations_generarOtp', { body: params }, options);\n }\n\n execute(params: RequestBody<'R4Operations_debitoInmediato'>, options?: RequestOptions) {\n return this.call('R4Operations_debitoInmediato', { body: params }, options);\n }\n}\n\n/** Crédito inmediato and disbursements (advanced payments, enabled per account). */\nexport class Credit extends APIResource {\n /** Instant credit to a Pago Móvil phone. */\n create(params: RequestBody<'R4Operations_creditoInmediato'>, options?: RequestOptions) {\n return this.call('R4Operations_creditoInmediato', { body: params }, options);\n }\n\n /** Instant credit to a bank account. */\n toAccount(params: RequestBody<'R4Operations_creditoCuentas'>, options?: RequestOptions) {\n return this.call('R4Operations_creditoCuentas', { body: params }, options);\n }\n\n /** Disburse one credit across several recipients. */\n disburse(params: RequestBody<'R4Operations_dispersarCredito'>, options?: RequestOptions) {\n return this.call('R4Operations_dispersarCredito', { body: params }, options);\n }\n}\n\n/** Bank operation status for débito/crédito (advanced payments, enabled per account). */\nexport class Operations extends APIResource {\n retrieve(id: string, options?: RequestOptions) {\n return this.call('R4Operations_consultarOperacion', { path: { id } }, options);\n }\n\n /** Re-check a pending operation with the bank now. */\n poll(params: RequestBody<'R4Operations_pollOperation'>, options?: RequestOptions) {\n return this.call('R4Operations_pollOperation', { body: params }, options);\n }\n}\n\n/** Account payout dispersion (advanced payments, enabled per account). */\nexport class Dispersals extends APIResource {\n create(params: RequestBody<'R4Operations_dispersarPagos'>, options?: RequestOptions) {\n return this.call('R4Operations_dispersarPagos', { body: params }, options);\n }\n}\n\n/** Vuelto / change payments (advanced payments, enabled per account). */\nexport class Change extends APIResource {\n create(params: RequestBody<'R4Operations_ejecutarVuelto'>, options?: RequestOptions) {\n return this.call('R4Operations_ejecutarVuelto', { body: params }, options);\n }\n}\n\nexport class Payments extends APIResource {\n readonly c2p = new C2p(this.http);\n readonly vpos = new Vpos(this.http);\n readonly pagoMovil = new PagoMovil(this.http);\n readonly debit = new Debit(this.http);\n readonly credit = new Credit(this.http);\n readonly operations = new Operations(this.http);\n readonly dispersals = new Dispersals(this.http);\n readonly change = new Change(this.http);\n\n /** Bolívar methods your account can take now (`pago_movil`, `c2p`, `vpos`), with a reason when unavailable. */\n methods(options?: RequestOptions) {\n return this.call('Payments_listPaymentMethods', {}, options);\n }\n\n retrieve(id: string, options?: RequestOptions) {\n return this.call('Payments_getPayment', { path: { id } }, options);\n }\n\n /** Look up a payment by the `externalRef` you sent. */\n retrieveByRef(externalRef: string, options?: RequestOptions) {\n return this.call('Payments_getPaymentByRef', { path: { externalRef } }, options);\n }\n\n /** Reverse a completed C2P payment. */\n reverse(id: string, options?: RequestOptions) {\n return this.call('Payments_reversePayment', { path: { id } }, options);\n }\n}\n","import { createHmac, timingSafeEqual } from 'node:crypto';\nimport { VexPaySignatureVerificationError } from './errors';\n\nexport const WEBHOOK_EVENT_NAMES = [\n 'payment.pending',\n 'payment.completed',\n 'payment.failed',\n 'payment.canceled',\n 'payment.reversed',\n 'payment.chargeback',\n 'payment.chargeback_closed',\n 'merchant.verified',\n 'merchant.rejected',\n 'merchant.deactivated',\n 'merchant.reactivated',\n 'merchant.balance.updated',\n 'merchant.created',\n 'merchant.activated',\n 'merchant.updated',\n 'merchant.kyb_required',\n 'merchant.restricted',\n 'merchant.capability.updated',\n 'merchant.wallet_credit',\n 'payout.completed',\n 'payout.failed',\n 'conversion.created',\n 'conversion.completed',\n 'conversion.canceled',\n 'tenant.status_changed',\n 'tenant.api_key.created',\n 'tenant.api_key.rotated',\n 'tenant.api_key.revoked',\n 'tenant.live_status_changed',\n 'notification.test',\n] as const;\n\nexport type WebhookEventName = (typeof WEBHOOK_EVENT_NAMES)[number];\n\n/** `data` of every `payment.*` event. */\nexport interface PaymentWebhookData {\n paymentId: string;\n externalRef?: string;\n status: 'PENDING' | 'COMPLETED' | 'FAILED' | 'CANCELED' | 'REVERSED';\n /** `COP` payments carry a different shape: narrow on `method === 'COP'` and read them as {@link CopPaymentWebhookData}. */\n method: 'C2P' | 'VPOS' | 'PAGO_MOVIL' | 'DEBITO_INMEDIATO' | 'COP';\n usdAmount: number;\n vesAmount: number;\n bcvRate: number;\n feeUsd?: number;\n feeVes?: number;\n netVes?: number;\n bankReference?: string;\n bankTxId?: number;\n debtorId?: string;\n debtorPhone?: string;\n debtorBankCode?: number;\n debtorBankName?: string;\n cardLast4?: string;\n cardBrand?: string;\n cardProduct?: string;\n accountTypeLabel?: string;\n tenantName: string;\n createdAt: string;\n failureCode?: string;\n cancelReason?: 'superseded' | 'expired';\n reversedAt?: string;\n reversalRef?: string;\n reversalTxId?: number;\n livemode: boolean;\n /** Present when the payment came from a checkout session. */\n checkoutSession?: { id: string; reference: string | null; metadata: Record<string, string> };\n}\n\n/**\n * `payment.*` data for a Colombian peso payment (`method: \"COP\"`). Amounts are whole pesos.\n * `amountUsd` and `copRate` are present only for hosted-checkout payments.\n */\nexport interface CopPaymentWebhookData {\n id: string;\n paymentId: string;\n method: 'COP';\n currency: 'COP';\n status: 'pending' | 'completed' | 'failed' | 'canceled' | 'refunded';\n channel: 'breb' | 'nequi' | 'daviplata';\n amountCop: number;\n feeCop?: number;\n amountUsd?: string;\n copRate?: string;\n reference?: string;\n externalRef?: string;\n metadata: Record<string, string>;\n failureCode?: 'expired' | 'rejected' | 'processor_error' | 'processor_unknown';\n expiresAt?: string;\n createdAt: string;\n completedAt?: string;\n tenantName: string;\n livemode: boolean;\n /** Present when the payment came from a checkout session. */\n checkoutSession?: { id: string; reference: string | null; metadata: Record<string, string> };\n}\n\ntype PaymentEventName = Extract<WebhookEventName, `payment.${string}`>;\n\n/** A verified webhook delivery, discriminated by `event`. */\nexport type WebhookEvent =\n | { event: PaymentEventName; data: PaymentWebhookData; timestamp: string }\n | {\n event: Exclude<WebhookEventName, PaymentEventName>;\n data: Record<string, unknown> & { livemode: boolean };\n timestamp: string;\n };\n\nexport const SIGNATURE_HEADER = 'VexPay-Signature';\nexport const DEFAULT_TOLERANCE_SECONDS = 300;\n\nconst RAW_BODY_HINT =\n 'Pass the raw request body exactly as received (string or Buffer). Parsing and re-serializing JSON — e.g. JSON.stringify(req.body) — changes the bytes and breaks the signature. In Express use express.raw({ type: \"application/json\" }) on the webhook route.';\n\nfunction sign(secret: string, timestamp: number | string, payload: string): string {\n return createHmac('sha256', secret).update(`${timestamp}.${payload}`, 'utf8').digest('hex');\n}\n\nfunction parseHeader(header: string): { timestamp: number; signatures: string[] } | null {\n let timestamp: string | undefined;\n const signatures: string[] = [];\n for (const part of header.split(',')) {\n const index = part.indexOf('=');\n if (index <= 0) return null;\n const key = part.slice(0, index).trim();\n const value = part.slice(index + 1).trim();\n if (key === 't') timestamp = value;\n else if (key === 'v1') signatures.push(value);\n // Unknown schemes (v0, future v2…) are ignored.\n }\n if (!timestamp || !/^\\d+$/.test(timestamp)) return null;\n return { timestamp: Number(timestamp), signatures };\n}\n\nfunction safeEqualHex(expected: string, actual: string): boolean {\n const a = Buffer.from(expected, 'utf8');\n const b = Buffer.from(actual, 'utf8');\n return a.length === b.length && timingSafeEqual(a, b);\n}\n\nexport class Webhooks {\n /**\n * Verifies a delivery's `VexPay-Signature` header and returns the parsed event.\n * Throws VexPaySignatureVerificationError on a bad signature or a stale timestamp.\n */\n constructEvent(\n rawBody: string | Buffer | Uint8Array,\n signatureHeader: string | string[] | null | undefined,\n secret: string,\n options: { toleranceSeconds?: number; now?: number } = {},\n ): WebhookEvent {\n if (typeof rawBody !== 'string' && !(rawBody instanceof Uint8Array)) {\n throw new VexPaySignatureVerificationError(`Webhook payload must be the raw body. ${RAW_BODY_HINT}`);\n }\n if (!secret) {\n throw new VexPaySignatureVerificationError('A webhook signing secret is required.');\n }\n const payload = typeof rawBody === 'string' ? rawBody : Buffer.from(rawBody).toString('utf8');\n const header = Array.isArray(signatureHeader) ? signatureHeader[0] : signatureHeader;\n const parsed = header ? parseHeader(header) : null;\n if (!parsed) {\n throw new VexPaySignatureVerificationError(\n `Unable to parse the ${SIGNATURE_HEADER} header. Expected \"t=<timestamp>,v1=<signature>\".`,\n );\n }\n if (parsed.signatures.length === 0) {\n throw new VexPaySignatureVerificationError(`No v1 signatures found in the ${SIGNATURE_HEADER} header.`);\n }\n\n const tolerance = options.toleranceSeconds ?? DEFAULT_TOLERANCE_SECONDS;\n const now = options.now ?? Math.floor(Date.now() / 1000);\n if (tolerance > 0 && Math.abs(now - parsed.timestamp) > tolerance) {\n throw new VexPaySignatureVerificationError(\n `Webhook timestamp is outside the ${tolerance}s tolerance — possible replay. Check your server clock if this repeats.`,\n );\n }\n\n const expected = sign(secret, parsed.timestamp, payload);\n if (!parsed.signatures.some((candidate) => safeEqualHex(expected, candidate))) {\n throw new VexPaySignatureVerificationError(\n `No signature matches the expected signature for this payload. Check the endpoint secret. ${RAW_BODY_HINT}`,\n );\n }\n\n try {\n return JSON.parse(payload) as WebhookEvent;\n } catch {\n throw new VexPaySignatureVerificationError('Webhook payload is not valid JSON.');\n }\n }\n\n /** Builds a valid `VexPay-Signature` value — for your own tests. */\n generateTestHeader({\n payload,\n secret,\n timestamp = Math.floor(Date.now() / 1000),\n }: {\n payload: string;\n secret: string;\n timestamp?: number;\n }): string {\n return `t=${timestamp},v1=${sign(secret, timestamp, payload)}`;\n }\n}\n","import { HttpClient, type CoreConfig } from './core';\nimport { VexPayConfigurationError } from './errors';\nimport {\n Balance,\n Banks,\n Payouts,\n Quotes,\n TenantPayoutAccount,\n WebhookEndpoints,\n} from './resources/account';\nimport { Checkout, PaymentLinks, Products } from './resources/commerce';\nimport { Conversions } from './resources/conversions';\nimport { Cop } from './resources/cop';\nimport { Crypto } from './resources/crypto';\nimport { Merchants } from './resources/merchants';\nimport { Payments } from './resources/payments';\nimport { Webhooks } from './webhooks';\n\nexport const DEFAULT_BASE_URL = 'https://api.pay.vexwallet.co';\n\nexport interface VexPayOptions {\n /** API origin. Defaults to production (`https://api.pay.vexwallet.co`). */\n baseUrl?: string;\n /** Per-attempt timeout. Default 30 000 ms. */\n timeoutMs?: number;\n /** Retries for connection errors, timeouts, 429 and 5xx. Default 2. */\n maxNetworkRetries?: number;\n /** Custom fetch (proxies, instrumentation, tests). Defaults to the global fetch. */\n fetch?: typeof fetch;\n}\n\nexport class VexPay {\n /** @internal */\n readonly http: HttpClient;\n\n readonly banks: Banks;\n readonly quotes: Quotes;\n readonly balance: Balance;\n readonly payments: Payments;\n readonly checkout: Checkout;\n readonly merchants: Merchants;\n readonly payouts: Payouts;\n /** USDT: deposit addresses, balance, networks and payouts. */\n readonly crypto: Crypto;\n /** Convert available VES to USDT (enabled per account). */\n readonly conversions: Conversions;\n /** Colombian pesos: Bre-B, Nequi and Daviplata payments and the COP balance. */\n readonly cop: Cop;\n readonly products: Products;\n readonly paymentLinks: PaymentLinks;\n readonly tenantPayoutAccount: TenantPayoutAccount;\n readonly webhookEndpoints: WebhookEndpoints;\n /** Offline helpers: `constructEvent` verifies deliveries; no API calls. */\n readonly webhooks = new Webhooks();\n\n constructor(apiKey: string, options: VexPayOptions = {}) {\n if (typeof apiKey !== 'string' || apiKey.trim() === '') {\n throw new VexPayConfigurationError(\n 'A VEXPay API key is required: new VexPay(process.env.VEXPAY_API_KEY).',\n );\n }\n const fetchImpl = options.fetch ?? globalThis.fetch;\n if (typeof fetchImpl !== 'function') {\n throw new VexPayConfigurationError('No fetch implementation found. Use Node.js 20+ or pass options.fetch.');\n }\n const config: CoreConfig = {\n apiKey: apiKey.trim(),\n baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,\n timeoutMs: options.timeoutMs ?? 30_000,\n maxNetworkRetries: options.maxNetworkRetries ?? 2,\n fetch: fetchImpl.bind(globalThis),\n };\n this.http = new HttpClient(config);\n\n this.banks = new Banks(this.http);\n this.quotes = new Quotes(this.http);\n this.balance = new Balance(this.http);\n this.payments = new Payments(this.http);\n this.checkout = new Checkout(this.http);\n this.merchants = new Merchants(this.http);\n this.payouts = new Payouts(this.http);\n this.crypto = new Crypto(this.http);\n this.conversions = new Conversions(this.http);\n this.cop = new Cop(this.http);\n this.products = new Products(this.http);\n this.paymentLinks = new PaymentLinks(this.http);\n this.tenantPayoutAccount = new TenantPayoutAccount(this.http);\n this.webhookEndpoints = new WebhookEndpoints(this.http);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCO,IAAM,cAAN,cAA0B,MAAM;AAAA;AAAA,EAE5B;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAET,YACE,SACA,UAAkF,CAAC,GACnF;AACA,UAAM,OAAO;AACb,SAAK,OAAO,WAAW;AACvB,SAAK,SAAS,QAAQ;AACtB,SAAK,OAAO,QAAQ;AACpB,SAAK,OAAO,QAAQ;AACpB,SAAK,YAAY,QAAQ;AAAA,EAC3B;AACF;AAGO,IAAM,2BAAN,cAAuC,YAAY;AAAC;AAGpD,IAAM,4BAAN,cAAwC,YAAY;AAAC;AAGrD,IAAM,4BAAN,cAAwC,YAAY;AAAC;AAGrD,IAAM,s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