@delopay/sdk 0.437.0 → 0.441.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 +5 -5
- package/dist/checkoutSession.cjs +2 -2
- package/dist/checkoutSession.js +1 -1
- package/dist/{chunk-UQDXXLLT.js → chunk-6H5AJY4O.js} +63 -1
- package/dist/chunk-6H5AJY4O.js.map +1 -0
- package/dist/{chunk-K36XUB3A.cjs → chunk-75FQADKN.cjs} +63 -1
- package/dist/chunk-75FQADKN.cjs.map +1 -0
- package/dist/{chunk-I23IC3T4.js → chunk-AU5YCE7W.js} +26 -2
- package/dist/chunk-AU5YCE7W.js.map +1 -0
- package/dist/{chunk-UUZ5TSEX.js → chunk-FLQ3K6Y6.js} +2 -2
- package/dist/chunk-FLQ3K6Y6.js.map +1 -0
- package/dist/{chunk-7M32LYPT.js → chunk-GU3P6GBA.js} +4 -4
- package/dist/{chunk-IH4OVCKM.cjs → chunk-HSJABE7X.cjs} +2 -2
- package/dist/chunk-HSJABE7X.cjs.map +1 -0
- package/dist/{chunk-2QULWFRR.cjs → chunk-KUAQWEOK.cjs} +7 -7
- package/dist/{chunk-2QULWFRR.cjs.map → chunk-KUAQWEOK.cjs.map} +1 -1
- package/dist/{chunk-CSY3IZOC.js → chunk-MCBBXUKA.js} +94 -1
- package/dist/chunk-MCBBXUKA.js.map +1 -0
- package/dist/{chunk-I65QS3YQ.cjs → chunk-NKDUQ2BI.cjs} +94 -1
- package/dist/chunk-NKDUQ2BI.cjs.map +1 -0
- package/dist/{chunk-QXVMSF3D.cjs → chunk-SIPQ65BK.cjs} +27 -3
- package/dist/chunk-SIPQ65BK.cjs.map +1 -0
- package/dist/{chunk-4XURI7WM.cjs → chunk-TRVFWPP7.cjs} +3 -3
- package/dist/{chunk-4XURI7WM.cjs.map → chunk-TRVFWPP7.cjs.map} +1 -1
- package/dist/{chunk-GQYWT7BY.js → chunk-X2QU7NEJ.js} +2 -2
- package/dist/client.cjs +3 -3
- package/dist/client.js +2 -2
- package/dist/core.cjs +2 -2
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/internal/resources/adminPortal.cjs +2 -2
- package/dist/internal/resources/adminPortal.d.cts +14 -1
- package/dist/internal/resources/adminPortal.d.ts +14 -1
- package/dist/internal/resources/adminPortal.js +1 -1
- package/dist/internal.cjs +9 -9
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +6 -6
- package/dist/resources/payments.cjs +2 -2
- package/dist/resources/payments.d.cts +77 -1
- package/dist/resources/payments.d.ts +77 -1
- package/dist/resources/payments.js +1 -1
- package/dist/resources/settlement.cjs +2 -2
- package/dist/resources/settlement.d.cts +39 -1
- package/dist/resources/settlement.d.ts +39 -1
- package/dist/resources/settlement.js +1 -1
- package/dist/types.d.cts +591 -2
- package/dist/types.d.ts +591 -2
- package/package.json +1 -1
- package/dist/chunk-CSY3IZOC.js.map +0 -1
- package/dist/chunk-I23IC3T4.js.map +0 -1
- package/dist/chunk-I65QS3YQ.cjs.map +0 -1
- package/dist/chunk-IH4OVCKM.cjs.map +0 -1
- package/dist/chunk-K36XUB3A.cjs.map +0 -1
- package/dist/chunk-QXVMSF3D.cjs.map +0 -1
- package/dist/chunk-UQDXXLLT.js.map +0 -1
- package/dist/chunk-UUZ5TSEX.js.map +0 -1
- /package/dist/{chunk-7M32LYPT.js.map → chunk-GU3P6GBA.js.map} +0 -0
- /package/dist/{chunk-GQYWT7BY.js.map → chunk-X2QU7NEJ.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/skyline/Programming/delopay/delopay-typescript-sdk/dist/chunk-IH4OVCKM.cjs","../src/core.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;A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AAA;AAC1B,UAAA;AACiB,YAAA;AAChC,cAAA;AACF,cAAA;AACA,cAAA;AACP,YAAA;AACH,UAAA;AACkD,UAAA;AACxC,YAAA;AACF,YAAA;AACA,YAAA;AACP,UAAA;AAC6C,UAAA;AACxC,UAAA;AACR,QAAA;AAC8B,QAAA;AACkC,UAAA;AACpD,YAAA;AACF,YAAA;AACA,YAAA;AACP,UAAA;AAC6C,UAAA;AACxC,UAAA;AACR,QAAA;AACM,QAAA;AACN,MAAA;AACsB,QAAA;AACL,QAAA;AACnB,MAAA;AACF,IAAA;AAEM,IAAA;AACR,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2CqB,EAAA;AACgD,IAAA;AACH,IAAA;AACnD,IAAA;AACT,IAAA;AACS,IAAA;AAC8C,MAAA;AAK3C,MAAA;AACmC,QAAA;AAC1C,MAAA;AACS,QAAA;AAChB,MAAA;AACgC,MAAA;AACsB,MAAA;AAC9B,MAAA;AACE,MAAA;AAClB,QAAA;AACR,MAAA;AAC6B,MAAA;AACf,MAAA;AACuB,QAAA;AACX,QAAA;AACH,QAAA;AACI,QAAA;AACpB,MAAA;AACW,QAAA;AAClB,MAAA;AACF,IAAA;AACF,EAAA;AACF;ADjc+E;AACA;AACA;AACA","file":"/Users/skyline/Programming/delopay/delopay-typescript-sdk/dist/chunk-IH4OVCKM.cjs","sourcesContent":[null,"import { DelopayError, DelopayAuthenticationError } from './error';\nimport { EventStreamParser } from './eventStream';\nimport type { EventStreamDispatch } from './eventStream';\nimport type { TokenResponse } from './types';\n\nexport { DelopayError, DelopayAuthenticationError } from './error';\n\nconst PRODUCTION_URL = 'https://api.delopay.net';\nconst SANDBOX_URL = 'https://dashboard.delopay.dev/api';\n\nconst MAX_RAW_BODY_BYTES = 2048;\nconst MAX_RETRY_AFTER_MS = 30_000;\n\nfunction parseRetryAfter(header: string | null): number | null {\n if (!header) return null;\n const trimmed = header.trim();\n const seconds = Number(trimmed);\n if (Number.isFinite(seconds) && seconds >= 0) {\n return Math.min(seconds * 1000, MAX_RETRY_AFTER_MS);\n }\n const date = Date.parse(trimmed);\n if (Number.isFinite(date)) {\n const delta = date - Date.now();\n return delta > 0 ? Math.min(delta, MAX_RETRY_AFTER_MS) : 0;\n }\n return null;\n}\n\nfunction truncateRawBody(raw: string): string | undefined {\n if (!raw) return undefined;\n return raw.length > MAX_RAW_BODY_BYTES ? raw.slice(0, MAX_RAW_BODY_BYTES) + '…' : raw;\n}\n\n/**\n * The error a non-2xx response stands for, read off its body.\n *\n * The API wraps errors as `{ error: { message, code, type, data? } }`; a body\n * that is not JSON (an HTML 502 from a proxy) is kept, truncated, as\n * `rawBody`. A 401 is a {@link DelopayAuthenticationError} unless it is a\n * connector's passthrough.\n */\nasync function errorFromResponse(\n response: Response,\n requestId: string | undefined,\n): Promise<DelopayError> {\n const rawBody = await response.text().catch(() => '');\n let parsed: Record<string, unknown> = {};\n if (rawBody) {\n try {\n parsed = JSON.parse(rawBody) as Record<string, unknown>;\n } catch {\n // non-JSON error body (HTML from a proxy, truncated stream, etc.) — keep raw\n }\n }\n // API wraps errors as { error: { message, code, type, data? } } — unwrap if present\n const err = (parsed.error as Record<string, unknown>) ?? parsed;\n const message = (err.message as string) ?? `Request failed with status ${response.status}`;\n const code = (err.code as string) ?? '';\n const type = (err.error_type as string) ?? (err.type as string) ?? '';\n const data =\n err.data && typeof err.data === 'object' && !Array.isArray(err.data)\n ? (err.data as Record<string, unknown>)\n : undefined;\n const truncatedRaw = truncateRawBody(rawBody);\n\n // A 401 usually means OUR credential (API key / JWT) was rejected —\n // but connector-passthrough errors (`CE_*` / type \"connector\", e.g.\n // a PSP rejecting the merchant's stored Stripe key) propagate the\n // upstream status and are NOT a Delopay authentication failure, so\n // they stay a plain DelopayError instead of triggering the\n // \"re-authenticate\" handling dashboards attach to auth errors.\n const isConnectorPassthrough = type === 'connector' || code.startsWith('CE_');\n if (response.status === 401 && !isConnectorPassthrough) {\n return new DelopayAuthenticationError(message, {\n code,\n type,\n requestId,\n rawBody: truncatedRaw,\n data,\n });\n }\n\n return new DelopayError(message, {\n status: response.status,\n code,\n type,\n requestId,\n rawBody: truncatedRaw,\n data,\n });\n}\n\nfunction findIdempotencyKey(headers: Record<string, string>): string | undefined {\n for (const [k, v] of Object.entries(headers)) {\n if (k.toLowerCase() === 'idempotency-key') return v;\n }\n return undefined;\n}\n\ninterface CombinedSignal {\n signal: AbortSignal;\n dispose: () => void;\n}\n\nfunction noop(): void {\n // Intentionally empty: no listeners registered, nothing to clean up.\n}\n\n/**\n * A `onDownloadProgress` listener threw. Carried out of the transport as-is so\n * the retry logic never mistakes the caller's own failure — a `TypeError` in a\n * progress bar, say — for a network error and downloads the body again.\n */\nclass ListenerFailure {\n constructor(readonly cause: unknown) {}\n}\n\n/**\n * The body stream failed after the headers arrived: the connection dropped, or\n * the server aborted it because it could not finish the body it had started.\n * Surfaced as the transport's ordinary network error, so it is retried on\n * exactly the same terms as a failure before the first byte.\n */\nclass BodyStreamFailure {\n constructor(readonly cause: unknown) {}\n}\n\nfunction abortError(): Error {\n const error = new Error('The operation was aborted');\n error.name = 'AbortError';\n return error;\n}\n\n/** `Content-Length` as a byte count, or `null` when absent or unreadable. */\nfunction parseContentLength(header: string | null): number | null {\n if (header === null || !/^\\s*\\d+\\s*$/.test(header)) return null;\n const value = Number(header);\n return Number.isSafeInteger(value) ? value : null;\n}\n\n/**\n * One `reader.read()`, raced against the request's signal.\n *\n * A conforming `fetch` errors the body stream itself when its signal aborts,\n * but not every stream a runtime or a polyfill hands back does, and a read\n * that never settles would hold a timed-out or cancelled download open for\n * good. The race makes the abort reach the reader either way.\n */\nfunction readChunk(\n reader: ReadableStreamDefaultReader<Uint8Array>,\n signal: AbortSignal,\n): Promise<ReadableStreamReadResult<Uint8Array>> {\n if (signal.aborted) return Promise.reject(abortError());\n return new Promise((resolve, reject) => {\n const onAbort = () => reject(abortError());\n signal.addEventListener('abort', onAbort, { once: true });\n reader.read().then(\n (result) => {\n signal.removeEventListener('abort', onAbort);\n resolve(result);\n },\n (cause: unknown) => {\n signal.removeEventListener('abort', onAbort);\n reject(signal.aborted ? abortError() : new BodyStreamFailure(cause));\n },\n );\n });\n}\n\n/** The chunks as one buffer of exactly `length` bytes. */\nfunction concatChunks(chunks: Uint8Array[], length: number): ArrayBuffer {\n const out = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n out.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return out.buffer;\n}\n\n/**\n * Read a 2xx body chunk by chunk, reporting each one, and decode it as\n * `responseType` asks — the `onDownloadProgress` path of `request()`.\n *\n * `onActivity` is called when the headers arrive and on every chunk; the\n * caller uses it to restart its idle timer.\n */\nasync function receiveWithProgress(\n response: Response,\n responseType: RequestOptions['responseType'],\n listener: (event: DownloadProgressEvent) => void,\n attempt: number,\n signal: AbortSignal,\n onActivity: () => void,\n): Promise<unknown> {\n const headers = response.headers ?? new Headers();\n const total = parseContentLength(headers.get('content-length'));\n let loaded = 0;\n const notify = (chunk: Uint8Array) => {\n try {\n // A copy: the request resolves to the bytes it read, whatever a\n // listener does with the ones it was shown.\n listener({ loaded, total, chunk: chunk.slice(), headers, attempt });\n } catch (cause) {\n throw new ListenerFailure(cause);\n }\n };\n\n onActivity();\n notify(new Uint8Array(0));\n\n const body = response.body;\n if (!body || typeof body.getReader !== 'function') {\n // No readable stream: a null-body status, or a runtime whose `fetch` does\n // not expose one. The body is read whole, and reported as one chunk.\n if (responseType === 'blob') {\n const blob = await response.blob();\n const bytes = new Uint8Array(await blob.arrayBuffer());\n loaded = bytes.byteLength;\n if (loaded > 0) notify(bytes);\n return blob;\n }\n if (responseType === 'arraybuffer') {\n const buffer = await response.arrayBuffer();\n loaded = buffer.byteLength;\n if (loaded > 0) notify(new Uint8Array(buffer));\n return buffer;\n }\n const text = await response.text();\n const bytes = new TextEncoder().encode(text);\n loaded = bytes.byteLength;\n if (loaded > 0) notify(bytes);\n return text ? JSON.parse(text) : undefined;\n }\n\n const reader = body.getReader();\n const chunks: Uint8Array[] = [];\n try {\n for (;;) {\n const { done, value } = await readChunk(reader, signal);\n if (done) break;\n if (!value || value.byteLength === 0) continue;\n chunks.push(value);\n loaded += value.byteLength;\n onActivity();\n notify(value);\n }\n } catch (err) {\n // Release the connection rather than leave a half-read body behind it.\n reader.cancel().catch(noop);\n throw err;\n }\n\n const bytes = concatChunks(chunks, loaded);\n if (responseType === 'blob') {\n return new Blob([bytes], { type: headers.get('content-type') ?? '' });\n }\n if (responseType === 'arraybuffer') {\n return bytes;\n }\n const text = new TextDecoder().decode(bytes);\n return text ? JSON.parse(text) : undefined;\n}\n\nfunction combineSignals(signals: AbortSignal[]): CombinedSignal {\n const controller = new AbortController();\n const listeners: { signal: AbortSignal; handler: () => void }[] = [];\n const dispose = () => {\n for (const { signal, handler } of listeners) {\n signal.removeEventListener('abort', handler);\n }\n listeners.length = 0;\n };\n for (const signal of signals) {\n if (signal.aborted) {\n controller.abort(signal.reason);\n dispose();\n return { signal: controller.signal, dispose: noop };\n }\n const handler = () => {\n controller.abort(signal.reason);\n dispose();\n };\n signal.addEventListener('abort', handler, { once: true });\n listeners.push({ signal, handler });\n }\n return { signal: controller.signal, dispose };\n}\n\n/**\n * Events emitted by the debug logger.\n * - `request` — about to send a request (`method`, `url`, `path`)\n * - `response` — response received (`status`, `method`, `path`, `requestId?`)\n * - `retry` — about to retry after a transient failure (`attempt`, `maxRetries`, `method`, `path`)\n */\nexport type DelopayLogger = (\n event: 'request' | 'response' | 'retry',\n data: Record<string, unknown>,\n) => void;\n\n/**\n * Configuration options for the Delopay client.\n */\nexport interface DelopayOptions {\n /**\n * Use the sandbox environment (`https://dashboard.delopay.dev/api`). Defaults\n * to `false` (production). Request paths are appended to that address, so a\n * payment is created at `https://dashboard.delopay.dev/api/payments`.\n */\n sandbox?: boolean;\n /** Override the base URL entirely. Takes precedence over `sandbox`. */\n baseUrl?: string;\n /** Request timeout in milliseconds. Defaults to `30000` (30 seconds). */\n timeout?: number;\n /**\n * Maximum number of automatic retries for transient failures (5xx, timeout, network errors).\n * Retries use exponential backoff. Set to `0` to disable. Defaults to `2`.\n * Only idempotent-safe requests (GET, DELETE, and requests with an `Idempotency-Key` header) are retried.\n */\n maxRetries?: number;\n /** Enable debug logging of requests and responses. Defaults to `false`. */\n debug?: boolean;\n /**\n * Custom logger for debug events (`request`, `response`, `retry`). When omitted,\n * debug output is written to `console.log`. Has no effect unless `debug` is `true`.\n * Useful for routing SDK logs through pino, winston, or similar structured loggers.\n */\n logger?: DelopayLogger;\n /**\n * The shop (business profile) every request acts on, sent as `X-Profile-Id`.\n * An API key bound to several shops must name one of them on every request;\n * create one client per shop. A header a call sets itself takes precedence.\n */\n profileId?: string;\n}\n\nconst SENSITIVE_QUERY_KEYS = new Set([\n 'client_secret',\n 'ephemeral_key',\n 'api_key',\n 'publishable_key',\n]);\n\n/**\n * Return a copy of `url` with the values of known-sensitive query parameters\n * replaced by `REDACTED`, leaving the rest of the query string intact.\n * Used only to sanitize URLs before they hit debug logs.\n */\nfunction redactUrlForLogging(url: string): string {\n const qIdx = url.indexOf('?');\n if (qIdx === -1) return url;\n const base = url.slice(0, qIdx);\n const query = url.slice(qIdx + 1);\n const parts = query.split('&').map((pair) => {\n const eqIdx = pair.indexOf('=');\n if (eqIdx === -1) return pair;\n const key = pair.slice(0, eqIdx);\n if (SENSITIVE_QUERY_KEYS.has(decodeURIComponent(key).toLowerCase())) {\n return `${key}=REDACTED`;\n }\n return pair;\n });\n return `${base}?${parts.join('&')}`;\n}\n\n/**\n * One step of a response body's download, reported to\n * {@link RequestOptions.onDownloadProgress}.\n */\nexport interface DownloadProgressEvent {\n /** Body bytes received so far on this attempt, `chunk` included. */\n loaded: number;\n /**\n * `Content-Length`, when the response carried one — a buffered body such as\n * a PDF. `null` for a streamed (chunked) body, whose size is not known\n * until it ends. With a compressed transfer it is the compressed size, so\n * `loaded` can pass it.\n */\n total: number | null;\n /**\n * The bytes this event reports. Empty on the first event of an attempt,\n * which fires as soon as the headers arrive, before any of the body.\n * A copy: changing it cannot change the value the request resolves to.\n */\n chunk: Uint8Array;\n /** The response headers, available from the first event on. */\n headers: Headers;\n /**\n * Which attempt this is, from `0`. A retried request reports its body\n * again from the start under the next number, so a listener that\n * accumulates state resets it when this changes.\n */\n attempt: number;\n}\n\n/**\n * Low-level options forwarded to a single HTTP request.\n */\nexport interface RequestOptions {\n /** Request body, serialised as JSON. */\n body?: unknown;\n /**\n * @internal Resource assertion that this operation deduplicates by the JSON\n * body's idempotency_key. Null means that optional key is absent, so the write\n * must not be retried. The transport checks the assertion against the body;\n * it does not send this option or copy a JSON key into an HTTP header.\n */\n bodyIdempotencyKey?: string | null;\n /**\n * Query-string parameters. `undefined` and `null` values are omitted.\n * Array values are emitted as repeated keys (`?tag=a&tag=b`) — not comma-joined.\n */\n query?: Record<\n string,\n string | number | boolean | null | undefined | (string | number | boolean)[]\n >;\n /** Additional HTTP headers merged with the default `api-key` header. */\n headers?: Record<string, string>;\n /**\n * Override the client-level timeout for this request, in milliseconds.\n *\n * Covers the whole request, body included — unless `onDownloadProgress` is\n * set, in which case it is an **idle** timeout: it restarts when the\n * headers arrive and on every chunk of the body, so a long download that\n * keeps making progress is never cut off, and one that stalls still is.\n */\n timeout?: number;\n /**\n * Caller-provided `AbortSignal`. Aborting it cancels the in-flight request and rejects\n * with a `DelopayError` carrying code `'ABORTED'`. Combined with the per-request timeout.\n */\n signal?: AbortSignal;\n /**\n * How to decode a 2xx response body. `'json'` (the default) parses JSON;\n * `'blob'` / `'arraybuffer'` return the raw bytes for binary endpoints\n * such as PDF exports. Error responses are always decoded as JSON and\n * thrown as `DelopayError` regardless of this setting.\n */\n responseType?: 'json' | 'blob' | 'arraybuffer';\n /**\n * Pass `keepalive: true` to let the request outlive its page — e.g.\n * telemetry sent while the document is navigating away. Browsers cap\n * keepalive request bodies at ~64 KiB and reject larger ones.\n */\n keepalive?: boolean;\n /**\n * Report a 2xx response body as it downloads. Called once as soon as the\n * headers arrive (with an empty `chunk` and `loaded: 0`), then once per\n * chunk of the body; the value the request resolves to is decoded from\n * those same bytes, per `responseType`. Error responses are not reported.\n *\n * Setting it turns `timeout` into an idle timeout (see there). A body that\n * fails part-way rejects with the ordinary `NETWORK` error and is retried\n * on the usual terms, starting again under the next `attempt`. A listener\n * that throws rejects the request with that error, unretried.\n */\n onDownloadProgress?: (event: DownloadProgressEvent) => void;\n}\n\nexport type RequestFn = <T>(method: string, path: string, options?: RequestOptions) => Promise<T>;\n\n/**\n * Per-call options that resource methods accept as an optional final argument:\n * extra HTTP headers (e.g. `Idempotency-Key`), a per-request timeout override,\n * an `AbortSignal` for cancellation, and a download-progress listener — the\n * last is what a file download (a statement PDF, a report CSV) reports its\n * bytes through.\n */\nexport type RequestExtras = Pick<\n RequestOptions,\n 'headers' | 'timeout' | 'signal' | 'onDownloadProgress'\n>;\n\n/** How long an event stream may stay silent before it is given up. */\nconst DEFAULT_STREAM_IDLE_TIMEOUT_MS = 45_000;\n\n/** Options of one `text/event-stream` request. */\nexport interface EventStreamRequestOptions {\n /** Query-string parameters, as {@link RequestOptions.query}. */\n query?: RequestOptions['query'];\n /** Additional HTTP headers, merged over the auth header. */\n headers?: Record<string, string>;\n /**\n * Aborting it before the response arrives rejects with code `ABORTED`;\n * aborting it later ends the dispatches without an error.\n */\n signal?: AbortSignal;\n /**\n * How long the stream may stay silent, response headers included, before\n * it fails with code `TIMEOUT`. Paused while the consumer holds a dispatch.\n * Defaults to 45 seconds.\n */\n idleTimeoutMs?: number;\n /** Sent as `Last-Event-ID`, and the id the stream starts from. */\n lastEventId?: string | null;\n}\n\n/**\n * An open event stream. Its body is read as it is iterated and never kept:\n * only the line and the event in progress are held.\n */\nexport interface EventStreamConnection {\n /**\n * The stream's dispatches, in order. Ends when the server closes the\n * stream or the caller aborts or closes it; throws a `DelopayError` with\n * code `TIMEOUT` when the stream is silent too long, and `NETWORK` when\n * the connection fails. Iterate it once.\n */\n readonly dispatches: AsyncIterable<EventStreamDispatch>;\n /** Close the stream: the iteration ends and the connection is released. */\n close(): void;\n}\n\n/** Opens a `GET` event stream; what resources that stream receive. */\nexport type EventStreamFn = (\n path: string,\n options?: EventStreamRequestOptions,\n) => Promise<EventStreamConnection>;\n\n/**\n * What a resource class is built from: the client's request and event-stream\n * functions. Every resource takes the request function first; the few that\n * stream (`Live`, `ProcessorImports`) also take the stream opener.\n */\nexport interface DelopayTransport {\n /** Send one request with the client's credentials, retries and timeout. */\n readonly request: RequestFn;\n /** Open one `text/event-stream` request with the client's credentials. */\n readonly openStream: EventStreamFn;\n /** The resolved base URL every request goes to. */\n readonly baseUrl: string;\n}\n\n/** A resource class that {@link DelopayCore.use} can build. */\nexport type ResourceConstructor<T> = new (request: RequestFn, openStream: EventStreamFn) => T;\n\n/**\n * The Delopay client without its resources: credentials, configuration,\n * transport, sessions and pagination.\n *\n * {@link Delopay} extends it with every resource as a property, which puts\n * every resource in the application's bundle. An application that wants only\n * the resources it calls builds them from this class instead, importing each\n * one from its own module, so a bundler leaves the rest out and can load each\n * one with the code that uses it:\n *\n * @example\n * ```typescript\n * import { DelopayCore } from '@delopay/sdk/core';\n * import { Refunds } from '@delopay/sdk/resources/refunds';\n *\n * const client = new DelopayCore('snd_...', { sandbox: true });\n * const refunds = client.use(Refunds);\n * const refund = await refunds.create({ payment_id: 'pay_abc123' });\n * ```\n *\n * A resource built this way shares the client's credentials: a token set with\n * {@link DelopayCore.setJwtToken} applies to it at once.\n */\nexport class DelopayCore {\n /** The resolved base URL used for all API requests. */\n readonly baseUrl: string;\n private readonly apiKey: string;\n private readonly timeout: number;\n private readonly maxRetries: number;\n private readonly debug: boolean;\n private readonly logger?: DelopayLogger;\n private readonly profileId?: string;\n private jwtToken?: string;\n\n /** The functions every resource is built from; see {@link DelopayCore.use}. */\n readonly transport: DelopayTransport;\n\n private readonly resources = new Map<ResourceConstructor<unknown>, unknown>();\n\n /**\n * Create a new client.\n *\n * @param apiKey - Your Delopay API key (e.g. `prd_...` or `snd_...`).\n * Pass an empty string or omit for JWT-only usage (e.g. dashboard apps).\n * @param options - Optional configuration (sandbox mode, base URL override, timeout).\n */\n constructor(apiKey?: string, options?: DelopayOptions) {\n this.apiKey = apiKey ?? '';\n this.timeout = options?.timeout ?? 30_000;\n this.maxRetries = options?.maxRetries ?? 2;\n this.debug = options?.debug ?? false;\n if (options?.logger !== undefined) this.logger = options.logger;\n if (options?.profileId !== undefined && options.profileId !== '') {\n this.profileId = options.profileId;\n }\n\n if (options?.baseUrl !== undefined) {\n this.baseUrl = options.baseUrl;\n } else if (options?.sandbox) {\n this.baseUrl = SANDBOX_URL;\n } else {\n this.baseUrl = PRODUCTION_URL;\n }\n\n this.transport = {\n request: this.request.bind(this) as RequestFn,\n openStream: this.openEventStream.bind(this),\n baseUrl: this.baseUrl,\n };\n }\n\n /**\n * The client's instance of a resource class, built on first use from this\n * client's transport. Later calls with the same class return the same\n * instance.\n *\n * A resource whose constructor takes something else besides the transport\n * (`Branding` takes the base URL) is built directly instead:\n * `new Branding(client.transport.request, client.baseUrl)`.\n *\n * @param Resource - The resource class, imported from its own module.\n * @returns The resource, bound to this client.\n */\n use<T>(Resource: ResourceConstructor<T>): T {\n let resource = this.resources.get(Resource) as T | undefined;\n if (resource === undefined) {\n resource = new Resource(this.transport.request, this.transport.openStream);\n this.resources.set(Resource, resource);\n }\n return resource;\n }\n\n /**\n * Set a JWT token for subsequent requests.\n * When set, requests use `Authorization: Bearer <token>` instead of `api-key`.\n * Useful after `users.signIn()` returns a JWT for dashboard operations.\n */\n setJwtToken(token: string): void {\n this.jwtToken = token;\n }\n\n /**\n * Clear the JWT token, reverting to API key authentication.\n */\n clearJwtToken(): void {\n this.jwtToken = undefined;\n }\n\n /**\n * End the current login session on the server (`POST /user/signout`), the\n * same request as {@link Users.signOut}. The token stays set on this\n * client: clear it with {@link DelopayCore.clearJwtToken} afterwards. The\n * request's `Authorization` header is built when this is called, so\n * clearing the token straight after still signs out the session it held.\n */\n async signOut(): Promise<Record<string, unknown>> {\n return this.request('POST', '/user/signout');\n }\n\n /**\n * Refresh the current login JWT (see {@link Users.refreshToken}) and\n * apply the fresh token to this client, so subsequent requests use it.\n * Returns the fresh token for the caller to persist (e.g. session\n * storage) — the backend has already re-set the `login_token` cookie.\n *\n * If the client's auth state changes while the refresh is pending —\n * `clearJwtToken()` on sign-out, or `setJwtToken()` switching to another\n * session — the stale completion is discarded and this rejects with a\n * `session_changed` `DelopayError` (status 0), so the explicit change\n * wins and the caller never persists a token for a session that is gone.\n *\n * Otherwise throws like any other request; in particular a 401 means the\n * session is dead (expired/blacklisted/revoked), a 429 means a refresh\n * was already minted for this session within the last minute, and a 400\n * means this token has no revocable session to slide (no `jti` — team\n * impersonation is the case in practice) and can never be refreshed,\n * though it stays valid for ordinary calls.\n */\n async refreshSession(): Promise<TokenResponse> {\n const originatingToken = this.jwtToken;\n const response = await this.request<TokenResponse>('POST', '/user/token/refresh');\n if (this.jwtToken !== originatingToken) {\n throw new DelopayError(\n 'Auth state changed while the refresh was pending; refreshed token discarded',\n {\n status: 0,\n code: 'session_changed',\n type: 'session_changed',\n },\n );\n }\n this.setJwtToken(response.token);\n return response;\n }\n\n /** `path` on the base URL, with the query string `query` makes. */\n private buildUrl(path: string, query?: RequestOptions['query']): string {\n let url = `${this.baseUrl}${path}`;\n if (query) {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) continue;\n if (Array.isArray(value)) {\n for (const v of value) {\n if (v !== undefined && v !== null) params.append(key, String(v));\n }\n } else {\n params.set(key, String(value));\n }\n }\n const qs = params.toString();\n if (qs) {\n url += `?${qs}`;\n }\n }\n return url;\n }\n\n /** The credential header: the JWT when one is set, else the API key. */\n /**\n * The client's `X-Profile-Id`, unless the call names one itself (in any\n * letter case: two spellings would be sent as one joined value).\n */\n private profileHeaders(callHeaders?: Record<string, string>): Record<string, string> {\n if (this.profileId === undefined) return {};\n const named = Object.keys(callHeaders ?? {}).some(\n (name) => name.toLowerCase() === 'x-profile-id',\n );\n return named ? {} : { 'X-Profile-Id': this.profileId };\n }\n\n private authHeaders(): Record<string, string> {\n if (this.jwtToken) return { Authorization: `Bearer ${this.jwtToken}` };\n if (this.apiKey) return { 'api-key': this.apiKey };\n return {};\n }\n\n /** One debug event, when `debug` is on. */\n private log(event: 'request' | 'response' | 'retry', data: Record<string, unknown>): void {\n if (!this.debug) return;\n if (this.logger) {\n this.logger(event, data);\n return;\n }\n if (event === 'request')\n console.log(`[delopay] ${data.method as string} ${data.url as string}`);\n else if (event === 'response')\n console.log(\n `[delopay] ${data.status as number} ${data.method as string} ${data.path as string}`,\n );\n else\n console.log(\n `[delopay] retry ${data.attempt as number}/${data.maxRetries as number} ${data.method as string} ${data.path as string}`,\n );\n }\n\n /**\n * Open a `GET` `text/event-stream` and read it as it arrives.\n *\n * `request()` keeps every chunk of a body until the body ends, which a\n * stream that stays open for half an hour must not do; this reads the body\n * chunk by chunk through {@link EventStreamParser} and keeps nothing it has\n * dispatched. Credentials, the base URL, debug logging and the mapping of a\n * non-2xx answer to `DelopayError` / `DelopayAuthenticationError` are the\n * ones `request()` uses.\n *\n * Never retried, and never reconnected: the caller owns reconnection.\n * Resolves once the response headers arrive; rejects on a non-2xx answer,\n * on a 2xx that is not `text/event-stream` (code `NOT_EVENT_STREAM`), and\n * with `TIMEOUT`, `NETWORK` or `ABORTED` like `request()`.\n */\n protected async openEventStream(\n path: string,\n options: EventStreamRequestOptions = {},\n ): Promise<EventStreamConnection> {\n const url = this.buildUrl(path, options.query);\n const lastEventId = options.lastEventId ?? '';\n const headers: Record<string, string> = {\n ...this.authHeaders(),\n ...this.profileHeaders(options.headers),\n Accept: 'text/event-stream',\n ...(lastEventId ? { 'Last-Event-ID': lastEventId } : {}),\n ...options.headers,\n };\n const idleMs = options.idleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS;\n const callerSignal = options.signal;\n const aborted = () =>\n new DelopayError('Request aborted', { status: 0, code: 'ABORTED', type: 'abort_error' });\n if (callerSignal?.aborted) throw aborted();\n\n const idleCtrl = new AbortController();\n const closeCtrl = new AbortController();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const stopIdleTimer = () => {\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n };\n const startIdleTimer = () => {\n stopIdleTimer();\n if (!idleCtrl.signal.aborted) timer = setTimeout(() => idleCtrl.abort(), idleMs);\n };\n const combined = combineSignals(\n callerSignal\n ? [idleCtrl.signal, closeCtrl.signal, callerSignal]\n : [idleCtrl.signal, closeCtrl.signal],\n );\n const release = () => {\n stopIdleTimer();\n combined.dispose();\n };\n const timedOut = () =>\n new DelopayError(`Event stream silent for ${idleMs} ms`, {\n status: 0,\n code: 'TIMEOUT',\n type: 'timeout_error',\n });\n const network = (cause: unknown) =>\n new DelopayError(\n `Network error: ${cause instanceof Error ? cause.message : String(cause ?? 'stream failed')}`,\n { status: 0, code: 'NETWORK', type: 'network_error' },\n );\n\n this.log('request', { method: 'GET', url: redactUrlForLogging(url), path });\n startIdleTimer();\n let response: Response;\n try {\n response = await fetch(url, { method: 'GET', headers, signal: combined.signal });\n } catch (err) {\n release();\n if (callerSignal?.aborted) throw aborted();\n if (idleCtrl.signal.aborted) throw timedOut();\n throw network(err);\n }\n\n const requestId =\n response.headers?.get('x-request-id') ?? response.headers?.get('x-trace-id') ?? undefined;\n this.log('response', { status: response.status, method: 'GET', path, requestId });\n\n if (!response.ok) {\n // Read under the idle timer: a body that never ends gives up as empty.\n const error = await errorFromResponse(response, requestId);\n release();\n throw error;\n }\n\n const body = response.body;\n const contentType = response.headers?.get('content-type') ?? '';\n const mediaType = (contentType.split(';')[0] ?? '').trim().toLowerCase();\n if (mediaType !== 'text/event-stream' || !body || typeof body.getReader !== 'function') {\n release();\n body?.cancel().catch(noop);\n throw new DelopayError(\n mediaType === 'text/event-stream'\n ? 'The event stream has no readable body'\n : `Expected a text/event-stream response, got ${contentType ? `\"${contentType}\"` : 'no content type'}`,\n {\n status: response.status,\n code: 'NOT_EVENT_STREAM',\n type: 'invalid_response',\n requestId,\n },\n );\n }\n\n // The idle timer runs only while a read is pending: a consumer busy with\n // an event, or one that has not started iterating, is not silence.\n stopIdleTimer();\n const reader = body.getReader();\n const parser = new EventStreamParser(lastEventId);\n const decoder = new TextDecoder();\n const stopped = () => Boolean(callerSignal?.aborted) || closeCtrl.signal.aborted;\n let finished = false;\n const finish = () => {\n if (finished) return;\n finished = true;\n release();\n reader.cancel().catch(noop);\n };\n\n async function* dispatches(): AsyncGenerator<EventStreamDispatch, void, undefined> {\n try {\n for (;;) {\n let result: ReadableStreamReadResult<Uint8Array>;\n startIdleTimer();\n try {\n result = await readChunk(reader, combined.signal);\n } catch (err) {\n if (callerSignal?.aborted || closeCtrl.signal.aborted) return;\n if (idleCtrl.signal.aborted) throw timedOut();\n throw network(err instanceof BodyStreamFailure ? err.cause : err);\n } finally {\n stopIdleTimer();\n }\n if (result.done) {\n // An event the stream did not finish with a blank line is\n // discarded, as the standard has it; only completed ones count.\n for (const dispatch of parser.push(decoder.decode())) {\n if (stopped()) return;\n yield dispatch;\n }\n return;\n }\n if (!result.value || result.value.byteLength === 0) continue;\n for (const dispatch of parser.push(decoder.decode(result.value, { stream: true }))) {\n // Aborted or closed while the consumer held the previous one.\n if (stopped()) return;\n yield dispatch;\n }\n }\n } finally {\n finish();\n }\n }\n\n return {\n dispatches: dispatches(),\n close: () => {\n closeCtrl.abort();\n finish();\n },\n };\n }\n\n /**\n * Make a raw HTTP request to the Delopay API.\n *\n * You rarely need to call this directly — prefer the typed resource methods.\n * Use it only for endpoints not yet covered by a resource class.\n *\n * @param method - HTTP method (`GET`, `POST`, `PUT`, `PATCH`, `DELETE`).\n * @param path - API path starting with `/` (e.g. `/payments`).\n * @param options - Optional body, query parameters, and headers.\n * @returns Parsed JSON response body typed as `T`.\n * @throws {DelopayAuthenticationError} On 401 responses.\n * @throws {DelopayError} On all other non-2xx responses, timeouts, and network errors.\n */\n async request<T>(method: string, path: string, options?: RequestOptions): Promise<T> {\n const url = this.buildUrl(path, options?.query);\n\n let headers: Record<string, string> = {\n ...this.authHeaders(),\n ...this.profileHeaders(options?.headers),\n ...options?.headers,\n };\n\n // FormData / Blob / ArrayBuffer / URLSearchParams pass through unchanged so callers\n // can send multipart uploads. The runtime (browser or Node 18+ fetch) sets the\n // appropriate Content-Type including the multipart boundary, so we don't touch it.\n const isRawBody =\n options?.body !== undefined &&\n options?.body !== null &&\n (options.body instanceof FormData ||\n options.body instanceof Blob ||\n options.body instanceof ArrayBuffer ||\n options.body instanceof URLSearchParams);\n\n if (options?.body && !isRawBody) {\n headers['Content-Type'] = 'application/json';\n }\n\n // Serialize body once so circular-reference errors surface immediately and big payloads\n // aren't re-stringified on every retry attempt. Raw bodies pass through untouched.\n let serializedBody: BodyInit | undefined;\n if (isRawBody) {\n serializedBody = options?.body as BodyInit;\n } else if (options?.body) {\n serializedBody = JSON.stringify(options.body);\n }\n\n let idempotencyKey = findIdempotencyKey(headers)?.trim();\n if (options && Object.prototype.hasOwnProperty.call(options, 'bodyIdempotencyKey')) {\n const bodyKey = options?.bodyIdempotencyKey;\n const serialized: unknown =\n !isRawBody && typeof serializedBody === 'string' ? JSON.parse(serializedBody) : null;\n const actualKey =\n serialized && typeof serialized === 'object' && !Array.isArray(serialized)\n ? ((serialized as Record<string, unknown>).idempotency_key ?? null)\n : null;\n const suppliedHeaders = Object.keys(headers).filter(\n (name) => name.toLowerCase() === 'idempotency-key',\n );\n if (\n (bodyKey !== null && typeof bodyKey !== 'string') ||\n actualKey !== bodyKey ||\n suppliedHeaders.some(\n (name) => headers[name] !== bodyKey || headers[name]?.trim() !== headers[name],\n )\n ) {\n throw new DelopayError('Request retry keys must match the JSON body key', {\n status: 0,\n code: 'IDEMPOTENCY_KEY_MISMATCH',\n type: 'invalid_request',\n });\n }\n idempotencyKey = bodyKey?.trim();\n // Collapse differently cased copies so fetch cannot combine them into a\n // different header value. Other caller headers remain untouched.\n if (suppliedHeaders.length > 0) {\n headers = {\n ...Object.fromEntries(\n Object.entries(headers).filter(([name]) => name.toLowerCase() !== 'idempotency-key'),\n ),\n 'Idempotency-Key': idempotencyKey ?? '',\n };\n }\n }\n const isRetryable =\n method === 'GET' ||\n method === 'DELETE' ||\n (idempotencyKey !== undefined && idempotencyKey !== '');\n\n const callerSignal = options?.signal;\n if (callerSignal?.aborted) {\n throw new DelopayError('Request aborted', {\n status: 0,\n code: 'ABORTED',\n type: 'abort_error',\n });\n }\n\n const timeoutMs = options?.timeout ?? this.timeout;\n\n let lastError: unknown;\n let retryAfterOverrideMs: number | null = null;\n\n const safeUrl = () => redactUrlForLogging(url);\n const emit = (event: 'request' | 'response' | 'retry', data: Record<string, unknown>) =>\n this.log(event, data);\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n if (attempt > 0) {\n const base = Math.min(500 * 2 ** (attempt - 1), 5000);\n // Full jitter: pick uniformly in [0, base) to avoid synchronized retry storms.\n const jittered = Math.random() * base;\n const delay = Math.max(retryAfterOverrideMs ?? 0, jittered);\n retryAfterOverrideMs = null;\n await new Promise((resolve) => setTimeout(resolve, delay));\n emit('retry', { attempt, maxRetries: this.maxRetries, method, path });\n }\n\n const timeoutCtrl = new AbortController();\n let timeoutId = setTimeout(() => timeoutCtrl.abort(), timeoutMs);\n // With a progress listener the timeout measures silence, not the whole\n // download: each sign of life restarts it.\n const restartIdleTimer = () => {\n if (timeoutCtrl.signal.aborted) return;\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => timeoutCtrl.abort(), timeoutMs);\n };\n const combined = combineSignals(\n callerSignal ? [timeoutCtrl.signal, callerSignal] : [timeoutCtrl.signal],\n );\n\n try {\n emit('request', { method, url: safeUrl(), path });\n\n const response = await fetch(url, {\n method,\n headers,\n body: serializedBody,\n signal: combined.signal,\n ...(options?.keepalive !== undefined ? { keepalive: options.keepalive } : {}),\n });\n\n const requestId =\n response.headers?.get('x-request-id') ?? response.headers?.get('x-trace-id') ?? undefined;\n\n emit('response', { status: response.status, method, path, requestId });\n\n if (!response.ok) {\n // A 401 that is our credential's comes back as a\n // DelopayAuthenticationError; its status is never transient, so it\n // is thrown below without a retry.\n const error = await errorFromResponse(response, requestId);\n\n // Retry on 5xx and 429 (rate limit). 4xx other than 429 are not transient.\n const isTransientStatus = response.status >= 500 || response.status === 429;\n if (isTransientStatus && isRetryable && attempt < this.maxRetries) {\n if (response.status === 429) {\n retryAfterOverrideMs = parseRetryAfter(response.headers?.get('retry-after') ?? null);\n }\n lastError = error;\n continue;\n }\n\n throw error;\n }\n\n if (options?.onDownloadProgress) {\n return (await receiveWithProgress(\n response,\n options.responseType,\n options.onDownloadProgress,\n attempt,\n combined.signal,\n restartIdleTimer,\n )) as T;\n }\n if (options?.responseType === 'blob') {\n return (await response.blob()) as T;\n }\n if (options?.responseType === 'arraybuffer') {\n return (await response.arrayBuffer()) as T;\n }\n const text = await response.text();\n return (text ? JSON.parse(text) : undefined) as T;\n } catch (err) {\n if (err instanceof DelopayError || err instanceof DelopayAuthenticationError) {\n throw err;\n }\n if (err instanceof ListenerFailure) {\n throw err.cause;\n }\n if (err instanceof BodyStreamFailure) {\n const cause = err.cause;\n const detail =\n cause instanceof Error ? cause.message : String(cause ?? 'body stream failed');\n lastError = new DelopayError(`Network error: ${detail}`, {\n status: 0,\n code: 'NETWORK',\n type: 'network_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n if (err instanceof Error && err.name === 'AbortError') {\n if (callerSignal?.aborted) {\n throw new DelopayError('Request aborted', {\n status: 0,\n code: 'ABORTED',\n type: 'abort_error',\n });\n }\n lastError = new DelopayError('Request timed out', {\n status: 0,\n code: 'TIMEOUT',\n type: 'timeout_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n if (err instanceof TypeError) {\n lastError = new DelopayError(`Network error: ${err.message}`, {\n status: 0,\n code: 'NETWORK',\n type: 'network_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n throw err;\n } finally {\n clearTimeout(timeoutId);\n combined.dispose();\n }\n }\n\n throw lastError;\n }\n\n /**\n * Auto-paginate a list endpoint. Yields items one by one, fetching\n * the next page automatically when the current one is exhausted.\n *\n * Delopay list endpoints use one of two pagination styles, so this helper\n * supports both:\n * - **Offset** (default) — for endpoints like `customers.list` that accept\n * `offset`/`limit`. Each page advances `offset` by the number of items returned.\n * - **Cursor** — for endpoints like `payments.list` and `payouts.list` that page\n * with `starting_after`/`limit` (they ignore `offset`). Pass a `cursor` extractor\n * that returns the id of an item; the next page is requested with\n * `starting_after` set to the last item's id.\n *\n * @param listFn - A function that takes the paging params and returns `{ data: T[] }` or `T[]`.\n * @param params - Additional parameters to pass to every page request.\n * @param options - Page size (number) for offset mode, or `{ pageSize?, cursor? }`.\n * Provide `cursor` to switch to cursor pagination.\n *\n * @example\n * ```typescript\n * // Offset endpoint (customers):\n * for await (const c of delopay.paginate((p) => delopay.customers.list(p))) {\n * console.log(c.customer_id);\n * }\n *\n * // Cursor endpoint (payments): extract the id used as the next cursor.\n * for await (const payment of delopay.paginate(\n * (p) => delopay.payments.list(p),\n * undefined,\n * { cursor: (p) => p.payment_id },\n * )) {\n * console.log(payment.payment_id);\n * }\n * ```\n */\n async *paginate<T, P extends Record<string, unknown>>(\n listFn: (\n params: P & { limit: number; offset?: number; starting_after?: string },\n ) => Promise<{ data: T[] } | T[]>,\n params?: P,\n options?: number | { pageSize?: number; cursor?: (item: T) => string | undefined },\n ): AsyncGenerator<T> {\n const pageSize = typeof options === 'number' ? options : (options?.pageSize ?? 50);\n const cursorOf = typeof options === 'object' ? options.cursor : undefined;\n let offset = 0;\n let after: string | undefined;\n while (true) {\n const page = { ...((params ?? {}) as P), limit: pageSize } as P & {\n limit: number;\n offset?: number;\n starting_after?: string;\n };\n if (cursorOf) {\n if (after !== undefined) page.starting_after = after;\n } else {\n page.offset = offset;\n }\n const result = await listFn(page);\n const items = Array.isArray(result) ? result : result.data;\n if (items.length === 0) break;\n for (const item of items) {\n yield item;\n }\n if (items.length < pageSize) break;\n if (cursorOf) {\n const last = items[items.length - 1];\n if (last === undefined) break;\n after = cursorOf(last);\n if (after === undefined) break;\n } else {\n offset += items.length;\n }\n }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/skyline/Programming/delopay/delopay-typescript-sdk/dist/chunk-K36XUB3A.cjs","../src/resources/settlement.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACyDO,SAAS,kBAAA,CAAmB,MAAA,EAAgE;AACjG,EAAA,OAAO,wCAAA;AAAA,IACL;AAAA,MACE,SAAA,EAAW,MAAA,CAAO,SAAA;AAAA,MAClB,UAAA,EAAY,MAAA,CAAO,UAAA;AAAA,MACnB,KAAA,EAAO,MAAA,CAAO,KAAA;AAAA,MACd,MAAA,EAAQ,MAAA,CAAO,MAAA;AAAA,MACf,aAAA,EAAe,MAAA,CAAO,aAAA;AAAA,MACtB,WAAA,EAAa,MAAA,CAAO,WAAA;AAAA,MACpB,SAAA,EAAW,MAAA,CAAO,SAAA;AAAA,MAClB,OAAA,EAAS,MAAA,CAAO,OAAA;AAAA,MAChB,UAAA,EAAY,MAAA,CAAO;AAAA,IACrB,CAAA;AAAA,IACA,CAAC,eAAe;AAAA,EAClB,CAAA;AACF;AAGA,SAAS,eAAA,CAAgB,MAAA,EAA8D;AACrF,EAAA,OAAO;AAAA,IACL,UAAA,EAAY,MAAA,CAAO,UAAA;AAAA,IACnB,QAAA,EAAU,MAAA,CAAO,QAAA;AAAA,IACjB,SAAA,EAAW,MAAA,CAAO,SAAA;AAAA,IAClB,KAAA,EAAO,MAAA,CAAO,KAAA;AAAA,IACd,MAAA,EAAQ,MAAA,CAAO,MA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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAY4C,EAAA;AACkB,IAAA;AAC9D,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWmC,EAAA;AACyB,IAAA;AAClD,MAAA;AACH,MAAA;AACwB,MAAA;AAC5B,IAAA;AACH,EAAA;AAKmC,EAAA;AACrB,IAAA;AACV,MAAA;AAC0D,MAAA;AAC1D,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU+C,EAAA;AACY,IAAA;AAC1B,MAAA;AAC1B,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYmC,EAAA;AACyB,IAAA;AAClD,MAAA;AACH,MAAA;AACwB,MAAA;AAC5B,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAS+C,EAAA;AACY,IAAA;AAC1B,MAAA;AAC1B,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAM+C,EAAA;AACjB,IAAA;AAC9B,EAAA;AAMiB,EAAA;AAC0C,IAAA;AAChB,MAAA;AACzB,MAAA;AACX,MAAA;AACJ,IAAA;AACH,EAAA;AAAA;AAGwF,EAAA;AAC1E,IAAA;AACV,MAAA;AAC0D,MAAA;AAC1D,MAAA;AACK,QAAA;AACuC,QAAA;AAC5B,QAAA;AAChB,MAAA;AACF,IAAA;AACF,EAAA;AAAA;AAMyC,EAAA;AAC3B,IAAA;AACV,MAAA;AAC0D,MAAA;AAC1D,MAAA;AACK,QAAA;AAC+C,QAAA;AACpD,MAAA;AACF,IAAA;AACF,EAAA;AACF;AD/MgE;AACA;AACA;AACA;AACA","file":"/Users/skyline/Programming/delopay/delopay-typescript-sdk/dist/chunk-K36XUB3A.cjs","sourcesContent":[null,"import type {\n NativeSettlementPreviewRequest,\n NativeSettlementPreviewResponse,\n NativeSettlementReportCreateRequest,\n NativeSettlementReport,\n NativeSettlementReportExport,\n NativeSettlementListRequest,\n NativeSettlementReportListResponse,\n NativeSettlementPayoutCreateRequest,\n NativeSettlementPayout,\n NativeSettlementPayoutListResponse,\n NativeSettlementFeeRefreshRequest,\n NativeSettlementFeeRefreshResponse,\n NativeSettlementPdfRequest,\n ProcessorCostEventsRequest,\n ProcessorCostEventsResponse,\n ProcessorCostPeriodRequest,\n ProcessorCostPeriodResponse,\n ProviderHoldsRequest,\n ProviderHoldsResponse,\n FeeStatementDetail,\n SettlementBackfillRequest,\n SettlementBackfillResponse,\n SettlementCostParams,\n SettlementCostResponse,\n SettlementCurrentParams,\n SettlementCurrentResponse,\n SettlementLineListParams,\n SettlementLineListResponse,\n SettlementOverviewParams,\n SettlementOverviewResponse,\n SettlementStatementListParams,\n SettlementStatementListResponse,\n ShopFeeConfigParams,\n ShopFeeConfigResponse,\n ShopVisibilityResponse,\n ShopVisibilityUpdateRequest,\n StatementAdjustment,\n StatementAdjustmentCreateRequest,\n StatementAdjustmentListResponse,\n StatementGenerateRequest,\n StatementPayoutUpdateRequest,\n StatementPayoutRecordRequest,\n StatementPayoutListResponse,\n StatementAdvance,\n StatementAdvanceRecordRequest,\n SettlementAdvanceListRequest,\n SettlementAdvanceListResponse,\n SettlementPeriodListParams,\n SettlementPeriodPreviewParams,\n SettlementPeriodPreviewResponse,\n SettlementPeriodListResponse,\n StatementPdfParams,\n} from '../types';\nimport type { RequestExtras, RequestFn, RequestOptions } from '../client';\nimport { csvQuery } from '../listQuery';\n\n/**\n * The statement list's query: `test_mode` always travels, `false` included,\n * and several payout statuses travel as one comma-separated value.\n */\nexport function statementListQuery(params: SettlementStatementListParams): RequestOptions['query'] {\n return csvQuery(\n {\n test_mode: params.test_mode,\n profile_id: params.profile_id,\n limit: params.limit,\n offset: params.offset,\n payout_status: params.payout_status,\n period_from: params.period_from,\n period_to: params.period_to,\n sort_by: params.sort_by,\n sort_order: params.sort_order,\n },\n ['payout_status'],\n );\n}\n\n/** The query of a native report or payout list. */\nfunction nativeListQuery(params: NativeSettlementListRequest): RequestOptions['query'] {\n return {\n profile_id: params.profile_id,\n currency: params.currency,\n test_mode: params.test_mode,\n limit: params.limit,\n offset: params.offset,\n sort_by: params.sort_by,\n sort_order: params.sort_order,\n };\n}\n\nfunction exportHeaders(options: RequestExtras | undefined, accept: string): Record<string, string> {\n const headers = new Headers(options?.headers);\n headers.set('Accept', accept);\n const output: Record<string, string> = {};\n headers.forEach((value, key) => {\n output[key] = value;\n });\n return output;\n}\n\n/**\n * Hosted-shop settlement: monthly statements, the live current-period\n * rollup, per-line detail, fee schedules and backfills.\n *\n * Every read takes an explicit `test_mode` — test and live figures must\n * never blend, so the environment lives in the signature rather than in a\n * default. `false` is transmitted, not dropped.\n *\n * Shop-owner responses are redacted server-side: absent platform-fee fields\n * are a permission boundary, not a gap — never re-derive them client-side.\n */\nexport class Settlement {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Read signed refund/dispute processor fees and report availability.\n * Merchant scope and connector grants apply. Empty movements confirm zero\n * only when the source is reported and complete.\n * Supply payment_id without year/month for all history. force_sync reads\n * provider reports for this page; it requires payment_id and limit <= 20,\n * and never issues a payment, refund or dispute action.\n * Omit test_mode for every reporting partition of one payment; period\n * queries default to live. Each source states its reporting partition.\n */\n async listProcessorCostEvents(\n params: ProcessorCostEventsRequest,\n options?: RequestExtras,\n ): Promise<ProcessorCostEventsResponse> {\n return this.request('GET', '/settlement/processor-cost-events', {\n query: {\n profile_id: params.profile_id,\n payment_id: params.payment_id,\n year: params.year,\n month: params.month,\n test_mode: params.test_mode,\n limit: params.limit,\n offset: params.offset,\n force_sync: params.force_sync,\n },\n ...options,\n });\n }\n\n /**\n * Per-shop settlement rollup for the host merchant: unpaid totals and the\n * running current period, one row per shop.\n *\n * `GET /settlement/overview`\n */\n async overview(\n params: SettlementOverviewParams,\n options?: RequestExtras,\n ): Promise<SettlementOverviewResponse> {\n return this.request('GET', '/settlement/overview', {\n query: { test_mode: params.test_mode },\n ...options,\n });\n }\n\n /**\n * Live rollup of the current (not yet statemented) period.\n *\n * `GET /settlement/current`\n */\n async current(\n params: SettlementCurrentParams,\n options?: RequestExtras,\n ): Promise<SettlementCurrentResponse> {\n return this.request('GET', '/settlement/current', {\n query: { test_mode: params.test_mode, profile_id: params.profile_id },\n ...options,\n });\n }\n\n /**\n * What a period's payments cost, and what was left over: gross, the\n * platform fee, hosting fees, what the rails took, and the margin, with a\n * per-connector breakdown.\n *\n * Send `year` and `month` together to report one UTC calendar month, or\n * neither for the running month so far.\n *\n * **Host-only.** The response is the host's cost base, which a shop owner\n * must never see, so a profile-scoped caller is refused with a 403 rather\n * than given a redacted shell. Gate the surface on the caller's scope\n * instead of calling it and handling the failure. Connector-restricted\n * roles cannot read this merchant-wide aggregate; fee-event reads retain\n * their connector grants.\n *\n * Two things not to flatten when rendering the result:\n * `margin_usd` is absent — not zero — whenever `margin_quality` is\n * `'unknown'`, and `unlined_captured_attempt_count` (cost definitely\n * missing) means something different from `unlined_unresolved_attempt_count`\n * (mostly ordinary abandonment).\n *\n * `GET /settlement/cost`\n *\n * @example\n * ```typescript\n * const cost = await delopay.settlement.cost({ test_mode: false, year: 2026, month: 7 });\n * if (cost.margin_quality === 'unknown') {\n * // cost.margin_usd is absent — say so, do not render 0.00\n * }\n * ```\n */\n async cost(\n params?: SettlementCostParams,\n options?: RequestExtras,\n ): Promise<SettlementCostResponse> {\n return this.request('GET', '/settlement/cost', {\n query: {\n profile_id: params?.profile_id,\n test_mode: params?.test_mode,\n year: params?.year,\n month: params?.month,\n },\n ...options,\n });\n }\n\n /**\n * What a period's payments cost at the rails, grouped by shop, connector\n * and payment method. Answers for **every** merchant, including one that\n * hosts nobody — it reads the per-attempt settlement record rather than the\n * settlement lines, which exist only where hosting fees are configured.\n *\n * A sibling of {@link Settlement.cost} rather than a widening of it. That\n * endpoint is a profit statement whose revenue term is hosting income, and\n * a merchant who hosts nobody has none. This publishes cost and never\n * margin.\n *\n * Send `year` and `month` together to report one UTC calendar month, or\n * neither for the running month so far.\n *\n * **The response carries no period total, and a caller must not compute\n * one here.** Every figure keeps the unit the rail reported it in, and the\n * unit is part of each bucket's key, so adding two buckets is not addition.\n * Convert caller-side if you need one number, and say which rates you used.\n * The counts are totalled, because a count has no unit.\n *\n * Two distinctions not to flatten when rendering a bucket:\n * `cost_amount` covers `reported_count + estimated_count` attempts out of\n * `attempt_count` and is a lower bound whenever those disagree; and\n * `unavailable_count` (the rail says it has no figure) means something\n * different from `unwritten_count` (a gap in our own recording).\n *\n * **Merchant scope.** A token scoped to a single shop, a role narrowed to\n * specific connector accounts, or a role without the settlement-read\n * permission group is refused `403`: what a rail charged is the merchant's\n * own cost base, and here it is the whole response, so there is nothing\n * coherent to redact down to. Gate the surface on the caller's scope rather\n * than calling it and handling the failure.\n *\n * `GET /settlement/processor-cost`\n *\n * @example\n * ```typescript\n * const period = await delopay.settlement.processorCost({\n * test_mode: false,\n * year: 2026,\n * month: 7,\n * });\n * for (const bucket of period.buckets) {\n * // Each bucket is its own unit — render per bucket, never a sum.\n * console.log(bucket.connector, bucket.cost_amount, bucket.cost_currency);\n * }\n * ```\n */\n async processorCost(\n params?: ProcessorCostPeriodRequest,\n options?: RequestExtras,\n ): Promise<ProcessorCostPeriodResponse> {\n return this.request('GET', '/settlement/processor-cost', {\n query: {\n profile_id: params?.profile_id,\n test_mode: params?.test_mode,\n year: params?.year,\n month: params?.month,\n },\n ...options,\n });\n }\n\n /**\n * What the payment providers say about one period's money, per connector\n * account and currency: of the payments made in the period, how much the\n * provider still holds, has released into its balance, has paid out to a\n * bank, or says nothing about.\n *\n * Amounts are the payments' gross in their own currency, never converted,\n * so render per bucket and never sum across currencies. A provider that\n * reports no settlement is `unknown`, never available. An amount is `null`\n * where no payment of the bucket carried one, never `0`.\n *\n * Give both `from` and `to`, or neither for the running calendar month.\n *\n * `GET /settlement/provider-holds`\n */\n async providerHolds(\n params?: ProviderHoldsRequest,\n options?: RequestExtras,\n ): Promise<ProviderHoldsResponse> {\n return this.request('GET', '/settlement/provider-holds', {\n query: {\n profile_id: params?.profile_id,\n test_mode: params?.test_mode,\n from: params?.from,\n to: params?.to,\n },\n ...options,\n });\n }\n\n /**\n * List generated settlement statements, the newest period first unless\n * `sort_by` says otherwise. Several `payout_status` values match a\n * statement in any of them.\n *\n * `GET /settlement/statements`\n */\n async listStatements(\n params: SettlementStatementListParams,\n options?: RequestExtras,\n ): Promise<SettlementStatementListResponse> {\n return this.request('GET', '/settlement/statements', {\n query: statementListQuery(params),\n ...options,\n });\n }\n\n /**\n * One statement with its per-connector/currency breakdown.\n *\n * `GET /settlement/statements/{statementId}`\n */\n async retrieveStatement(\n statementId: string,\n options?: RequestExtras,\n ): Promise<FeeStatementDetail> {\n return this.request(\n 'GET',\n `/settlement/statements/${encodeURIComponent(statementId)}`,\n options,\n );\n }\n\n /**\n * Generate (or regenerate) the statement for one shop and period: a\n * calendar month by `year` and `month`, or any period by its `period_start`.\n *\n * `POST /settlement/statements/generate`\n */\n async generateStatement(\n params: StatementGenerateRequest,\n options?: RequestExtras,\n ): Promise<FeeStatementDetail> {\n return this.request('POST', '/settlement/statements/generate', {\n body: params,\n ...options,\n });\n }\n\n /**\n * Record payout progress on a statement (`unpaid` / `partial` / `paid`).\n *\n * Subject to the caller's `settlement_payout` operation limit — a\n * per-operation ceiling, a windowed total, a windowed count, or any\n * combination: an over-limit call fails with `DE_01` and nothing is\n * recorded. There is no approval route out of it — four-eyes needs an\n * executor that can run the operation once somebody says yes, and only\n * refunds have one, so a settlement rule can only block.\n *\n * `POST /settlement/statements/{statementId}/payout`\n */\n async updateStatementPayout(\n statementId: string,\n params: StatementPayoutUpdateRequest,\n options?: RequestExtras,\n ): Promise<FeeStatementDetail> {\n return this.request(\n 'POST',\n `/settlement/statements/${encodeURIComponent(statementId)}/payout`,\n { body: params, ...options },\n );\n }\n\n /** Append one external transfer record. Send a stable idempotency_key for safe retries. */\n async recordStatementPayout(\n statementId: string,\n params: StatementPayoutRecordRequest,\n options?: RequestExtras,\n ): Promise<FeeStatementDetail> {\n return this.request(\n 'POST',\n `/settlement/statements/${encodeURIComponent(statementId)}/payout`,\n {\n body: params,\n ...options,\n bodyIdempotencyKey: params.idempotency_key ?? null,\n },\n );\n }\n\n /** Read individual transfer records, their signed total, and any overpayment. */\n async listStatementPayouts(\n statementId: string,\n options?: RequestExtras,\n ): Promise<StatementPayoutListResponse> {\n return this.request(\n 'GET',\n `/settlement/statements/${encodeURIComponent(statementId)}/payouts`,\n options,\n );\n }\n\n /** Record a transfer against a shop's period before its statement exists. */\n async recordAdvance(\n params: StatementAdvanceRecordRequest,\n options?: RequestExtras,\n ): Promise<StatementAdvance> {\n return this.request('POST', '/settlement/advances', {\n body: params,\n ...options,\n bodyIdempotencyKey: params.idempotency_key ?? null,\n });\n }\n\n async listAdvances(\n params: SettlementAdvanceListRequest,\n options?: RequestExtras,\n ): Promise<SettlementAdvanceListResponse> {\n return this.request('GET', '/settlement/advances', {\n query: {\n profile_id: params.profile_id,\n year: params.year,\n month: params.month,\n period_start: params.period_start,\n test_mode: params.test_mode,\n },\n ...options,\n });\n }\n\n /**\n * A shop's statement periods, newest first: the running one and those that\n * closed in the last twelve months. Each `period_start` names its period to\n * {@link generateStatement}, {@link recordAdvance} and {@link listAdvances}.\n *\n * `GET /settlement/periods`\n */\n async listPeriods(\n params: SettlementPeriodListParams,\n options?: RequestExtras,\n ): Promise<SettlementPeriodListResponse> {\n return this.request('GET', '/settlement/periods', {\n query: { profile_id: params.profile_id },\n ...options,\n });\n }\n\n /**\n * The next six statement periods a value of the `settlement.statement_period`\n * setting would make, before it is saved: for a shop, the rest of its running\n * period and the change at its next boundary. The value is judged as a save\n * would judge it, so a value the account cannot save is refused here too.\n * Writes nothing.\n *\n * `POST /settlement/periods/preview`\n */\n async previewPeriods(\n params: SettlementPeriodPreviewParams,\n options?: RequestExtras,\n ): Promise<SettlementPeriodPreviewResponse> {\n return this.request('POST', '/settlement/periods/preview', {\n body: params,\n ...options,\n });\n }\n\n /**\n * Export a statement as PDF, or with `format` as CSV, JSON\n * (`StatementDocument`) or XLSX. Returns the raw bytes as a `Blob`, with\n * the same auth, retries and error handling as every other call — persist\n * or object-URL it caller-side.\n *\n * `GET /settlement/statements/{statementId}/pdf`\n *\n * @example\n * ```typescript\n * const pdf = await delopay.settlement.downloadStatementPdf('stmt_1', {\n * currency: 'EUR',\n * include_transactions: true,\n * });\n * const url = URL.createObjectURL(pdf);\n * ```\n */\n async downloadStatementPdf(\n statementId: string,\n params?: StatementPdfParams,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request('GET', `/settlement/statements/${encodeURIComponent(statementId)}/pdf`, {\n query: {\n currency: params?.currency,\n include_transactions: params?.include_transactions,\n format: params?.format,\n },\n responseType: 'blob',\n ...options,\n });\n }\n\n /**\n * The individual settled attempts of one shop's calendar month.\n *\n * `GET /settlement/lines`\n */\n async listLines(\n params: SettlementLineListParams,\n options?: RequestExtras,\n ): Promise<SettlementLineListResponse> {\n return this.request('GET', '/settlement/lines', {\n query: {\n profile_id: params.profile_id,\n year: params.year,\n month: params.month,\n period_start: params.period_start,\n test_mode: params.test_mode,\n limit: params.limit,\n offset: params.offset,\n },\n ...options,\n });\n }\n\n /**\n * The fee schedules that currently apply to a shop.\n *\n * `GET /settlement/fee-config`\n */\n async feeConfig(\n params: ShopFeeConfigParams,\n options?: RequestExtras,\n ): Promise<ShopFeeConfigResponse> {\n return this.request('GET', '/settlement/fee-config', {\n query: { profile_id: params.profile_id },\n ...options,\n });\n }\n\n /**\n * Enqueue a settlement-line backfill over historical attempts. Attempts\n * already covered by a line are always skipped.\n *\n * `POST /settlement/backfill`\n */\n async backfill(\n params?: SettlementBackfillRequest,\n options?: RequestExtras,\n ): Promise<SettlementBackfillResponse> {\n return this.request('POST', '/settlement/backfill', { body: params, ...options });\n }\n\n /**\n * Toggle whether a shop's owner can see their own settlement figures.\n *\n * `POST /settlement/shops/visibility`\n */\n async setShopVisibility(\n params: ShopVisibilityUpdateRequest,\n options?: RequestExtras,\n ): Promise<ShopVisibilityResponse> {\n return this.request('POST', '/settlement/shops/visibility', {\n body: params,\n ...options,\n });\n }\n\n /**\n * Manual adjustments recorded on a statement.\n *\n * `GET /settlement/statements/{statementId}/adjustments`\n */\n async listStatementAdjustments(\n statementId: string,\n options?: RequestExtras,\n ): Promise<StatementAdjustmentListResponse> {\n return this.request(\n 'GET',\n `/settlement/statements/${encodeURIComponent(statementId)}/adjustments`,\n options,\n );\n }\n\n /**\n * Add a manual adjustment to a statement. Positive `amount_usd` charges\n * the shop (reducing their payout); negative credits them.\n *\n * Subject to the caller's `settlement_adjustment` operation limit: an\n * over-limit call fails with `DE_01` and no adjustment is added. Both\n * windows count every add, and a credit counts at its magnitude. A\n * settlement rule can only block — approval is refund-only, for the reason\n * given on `updateStatementPayout()`. When another add by the same user\n * changes the window while this one is being admitted, the call fails with\n * HTTP 412 and nothing is written; retrying the same request is safe.\n *\n * `POST /settlement/statements/{statementId}/adjustments`\n */\n async createStatementAdjustment(\n statementId: string,\n params: StatementAdjustmentCreateRequest,\n options?: RequestExtras,\n ): Promise<StatementAdjustment> {\n return this.request(\n 'POST',\n `/settlement/statements/${encodeURIComponent(statementId)}/adjustments`,\n { body: params, ...options },\n );\n }\n\n /**\n * Remove a manual adjustment from a statement.\n *\n * The adjustment still counts against the caller's `settlement_adjustment`\n * limit window it was added in: removing it does not give back its count or\n * amount.\n *\n * `DELETE /settlement/statements/{statementId}/adjustments/{adjustmentId}`\n */\n async deleteStatementAdjustment(\n statementId: string,\n adjustmentId: string,\n options?: RequestExtras,\n ): Promise<void> {\n return this.request(\n 'DELETE',\n `/settlement/statements/${encodeURIComponent(statementId)}/adjustments/${encodeURIComponent(adjustmentId)}`,\n options,\n );\n }\n\n /**\n * Calculate a period in its transaction currency. Requires a host-level\n * dashboard JWT and settlement read permission. Profile users and roles\n * restricted to selected connector accounts cannot read this aggregate.\n * Rates apply once to the period total. Unknown or estimated fees keep\n * dependent amounts provisional. Native money values remain integer strings.\n */\n async previewNative(\n params: NativeSettlementPreviewRequest,\n options?: RequestExtras,\n ): Promise<NativeSettlementPreviewResponse> {\n return this.request('POST', '/settlement/native/preview', { body: params, ...options });\n }\n\n /**\n * Recalculate and freeze an immutable report version. Requires settlement\n * edit permission. Explicitly allow provisional figures when source fees\n * are incomplete. A report records a calculation and sends no money.\n * Reuse the same idempotency key when retrying the same request.\n */\n async createNativeReport(\n params: NativeSettlementReportCreateRequest,\n options?: RequestExtras,\n ): Promise<NativeSettlementReport> {\n return this.request('POST', '/settlement/native/reports', {\n body: params,\n ...options,\n bodyIdempotencyKey: params.idempotency_key,\n });\n }\n\n async retrieveNativeReport(\n reportId: string,\n options?: RequestExtras,\n ): Promise<NativeSettlementReport> {\n return this.request(\n 'GET',\n `/settlement/native/reports/${encodeURIComponent(reportId)}`,\n options,\n );\n }\n\n /**\n * List report summaries without fetching every source row in each saved\n * snapshot, the newest first. `sort_by` takes `period` here; another value\n * is refused.\n */\n async listNativeReports(\n params: NativeSettlementListRequest,\n options?: RequestExtras,\n ): Promise<NativeSettlementReportListResponse> {\n return this.request('GET', '/settlement/native/reports', {\n query: nativeListQuery(params),\n ...options,\n });\n }\n\n /**\n * Record a transfer already made, under settlement write permission and\n * the caller's payout limits. This method never sends money. Native minor\n * units remain strings; negative records must name a same-scope reversal.\n * These records belong to the native ledger, separate from monthly USD\n * statement payouts and advances.\n */\n async recordNativePayout(\n params: NativeSettlementPayoutCreateRequest,\n options?: RequestExtras,\n ): Promise<NativeSettlementPayout> {\n return this.request('POST', '/settlement/native/payouts', {\n body: params,\n ...options,\n bodyIdempotencyKey: params.idempotency_key,\n });\n }\n\n /**\n * List recorded payouts, the earliest value date first. `sort_by` takes\n * `value_date` or `amount` here; another value is refused.\n */\n async listNativePayouts(\n params: NativeSettlementListRequest,\n options?: RequestExtras,\n ): Promise<NativeSettlementPayoutListResponse> {\n return this.request('GET', '/settlement/native/payouts', {\n query: nativeListQuery(params),\n ...options,\n });\n }\n\n /** Refresh a bounded page of provider fee evidence. Follow next_offset while has_more is true. */\n async refreshNativeFees(\n params: NativeSettlementFeeRefreshRequest,\n options?: RequestExtras,\n ): Promise<NativeSettlementFeeRefreshResponse> {\n return this.request('POST', '/settlement/native/fees/refresh', { body: params, ...options });\n }\n\n async downloadNativeReportPdf(\n reportId: string,\n params?: NativeSettlementPdfRequest,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request('GET', `/settlement/native/reports/${encodeURIComponent(reportId)}/pdf`, {\n query: { include_transactions: params?.include_transactions },\n responseType: 'blob',\n ...options,\n });\n }\n\n /** Download the frozen source rows and calculation as CSV. */\n async downloadNativeReportCsv(reportId: string, options?: RequestExtras): Promise<Blob> {\n return this.request(\n 'GET',\n `/settlement/native/reports/${encodeURIComponent(reportId)}/export`,\n {\n ...options,\n headers: exportHeaders(options, 'text/csv'),\n responseType: 'blob',\n },\n );\n }\n\n /** Export the frozen report as JSON, excluding host account-level costs. */\n async exportNativeReportJson(\n reportId: string,\n options?: RequestExtras,\n ): Promise<NativeSettlementReportExport> {\n return this.request(\n 'GET',\n `/settlement/native/reports/${encodeURIComponent(reportId)}/export`,\n {\n ...options,\n headers: exportHeaders(options, 'application/json'),\n },\n );\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/skyline/Programming/delopay/delopay-typescript-sdk/dist/chunk-QXVMSF3D.cjs","../src/internal/resources/adminPortal.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACgOA,SAAS,wBAAA,CAAyB,MAAA,EAA8D;AAC9F,EAAA,MAAM,EAAE,WAAA,EAAa,GAAG,QAAQ,EAAA,mBAAI,MAAA,UAAU,CAAC,GAAA;AAC/C,EAAA,OAAO,EAAE,GAAG,mDAAA,OAA2B,CAAA,EAAG,GAAI,YAAA,EAAc,EAAE,YAAY,EAAA,EAAI,CAAC,EAAG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E;AAGkD;AACe,EAAA;AACjE;AD1tB0F;AACA;AACA;AACA","file":"/Users/skyline/Programming/delopay/delopay-typescript-sdk/dist/chunk-QXVMSF3D.cjs","sourcesContent":[null,"import type {\n BuyerRiskEvaluationsResponse,\n PreventionCaseDetail,\n PreventionCaseList,\n PreventionRefundActionList,\n PreventionRefundRule,\n ConnectionChecksResponse,\n RiskAdjustments,\n RiskTuningPreviewResponse,\n RiskTuningResponse,\n RiskTuningTarget,\n RiskTuningUpdateRequest,\n TokenResponse,\n} from '../../types';\nimport { riskTuningPath } from '../../resources/risk';\nimport { preventionCaseQuery } from '../../resources/chargebackPrevention';\nimport { statementListQuery } from '../../resources/settlement';\nimport type {\n BinaryExportOptions,\n CsvExportOptions,\n DynamicLineExportOptions,\n ExportEnvelope,\n ExportOptions,\n JsonExportOptions,\n BulkCreateProcessorCostSchedulesRequest,\n BuyerRefundRequestList,\n BuyerRefundRequestPageQuery,\n CreateProcessorCostScheduleRequest,\n ProcessorCostEventsResponse,\n ProcessorCostScheduleResponse,\n ReplaceProcessorCostScheduleRequest,\n UpdateProcessorCostScheduleRequest,\n FeeStatementDetail,\n MerchantAccountResponse,\n MerchantAccountUpdateRequest,\n PaymentAttemptsListResponse,\n PaymentClientContextListResponse,\n PaymentProductLines,\n InvoiceList,\n InvoicePageQuery,\n PaymentsDeleteResponse,\n PaymentIntegrationTestRequest,\n PaymentIntegrationTestResponse,\n PaymentStatusHistoryResponse,\n PaymentLogsResponse,\n PaymentLogConnectorCallDetail,\n PaymentLogIncomingWebhookDetail,\n PaymentLogOutgoingWebhookDetail,\n ProfileResponse,\n RefundListResponse,\n SellToRestrictionsResponse,\n SettlementAdvanceListRequest,\n SettlementAdvanceListResponse,\n SettlementCurrentParams,\n SettlementCurrentResponse,\n SettlementOverviewParams,\n SettlementPeriodListParams,\n SettlementPeriodListResponse,\n SettlementOverviewResponse,\n SettlementStatementListParams,\n SettlementStatementListResponse,\n StatementPdfParams,\n SubscriptionAnalyticsRequest,\n SubscriptionAnalyticsResponse,\n SubscriptionDrillRequest,\n ScopeDrillRequest,\n IndustryAnalytics,\n IndustryAnalyticsRequest,\n BuyerEvidenceInformationRequest,\n BuyerEvidenceNote,\n BuyerEvidenceQueue,\n BuyerEvidenceQueueQuery,\n BuyerEvidenceReply,\n BuyerEvidenceReviewCreate,\n BuyerEvidenceReviewDetail,\n MemberMethodAccessResponse,\n UpdateMemberMethodAccessRequest,\n MemberPermissionOverridesResponse,\n UpdateMemberPermissionOverridesRequest,\n MerchantRisk,\n AdminAnalyticsExclusionRequest,\n AdminAnalyticsExclusionResponse,\n AdminAnalyticsExclusionsResponse,\n AdminAnalyticsExclusionCopyRequest,\n AdminAnalyticsExclusionCopyResponse,\n MerchantExclusionsForAdminResponse,\n AdminAnalyticsShopsRequest,\n AdminAnalyticsConnectorsRequest,\n AnalyticsConnectorsRequest,\n AnalyticsConnectorsResponse,\n AnalyticsShopsRequest,\n AnalyticsShopsResponse,\n MerchantPersonFlagList,\n PaymentPersonResponse,\n PersonListParams,\n PersonListResponse,\n AdminRevokeUserSessionsResponse,\n LoginHistoryParams,\n LoginHistoryResponse,\n UserSessionListResponse,\n UserSessionRevokeResponse,\n PersonResponse,\n PersonScopeParams,\n RelatedPersonsResponse,\n VatRateListParams,\n VatRateListResponse,\n VatRateResponse,\n} from '../../types';\nimport type {\n RefundVolumeQuery,\n RefundVolumeResponse,\n UpdateRefundVolumeRequest,\n PlatformFeeReturnListResponse,\n PlatformFeeReturnQuery,\n RiskModelPatch,\n RiskModelResponse,\n RiskModelUpdateOptions,\n PlatformFeeReturnResponse,\n UpdatePlatformFeeReturnRequest,\n ConsolidateRolesRequest,\n ConsolidateRolesResponse,\n ConsolidationCandidatesResponse,\n CreateSharedRoleRequest,\n RetireSharedRolePreviewRequest,\n RetireSharedRolePreviewResponse,\n RetireSharedRoleRequest,\n SharedRoleApplied,\n SharedRoleChange,\n SharedRoleDetailResponse,\n SharedRoleListResponse,\n SharedRolePreviewResponse,\n UpdateSharedRoleRequest,\n AdminAttachVaultRequest,\n AdminAttachVaultResponse,\n AdminAttemptProcessorCost,\n AdminProcessorCostEventsParams,\n AdminVaultStateResponse,\n CardFundingBackfillRequest,\n CardFundingBackfillResponse,\n AdminCustomerListParams,\n AdminCustomerListResponse,\n AdminCustomerDetail,\n AdminTransactionExportParams,\n AdminTransactionExportRecord,\n AdminTransactionLineExportRecord,\n AdminTransactionListParams,\n AdminTransactionListResponse,\n AdminUnresolvedRefundListParams,\n AdminUnresolvedRefundListResponse,\n AdminAnalyticsRequest,\n PlatformAnalyticsResponse,\n OverviewStatsResponse,\n PaymentAnalyticsRequest,\n PaymentAnalyticsResponse,\n AnalyticsScopeRequest,\n ClientAnalyticsRequest,\n DeviceDrillRequest,\n DeviceIntelligencePaymentsParams,\n DeviceIntelligencePaymentsResponse,\n DeviceIntelligenceUsageParams,\n DeviceIntelligenceUsageResponse,\n GeoDrillRequest,\n DrillResponse,\n BuyerRiskAccuracyQuery,\n BuyerRiskAccuracyReport,\n BuyerRiskAccuracyPaymentsRequest,\n DevicesAnalyticsResponse,\n GeoAnalyticsResponse,\n AnalyticsScopeResponse,\n AdminLedgerAnalyticsRequest,\n AdminLedgerAnalyticsResponse,\n AdminOrphanedBillingProfilesResponse,\n AdminCreateUserForMerchantRequest,\n AdminUpdateUserRequest,\n AdminUserResponse,\n AdminUserDetailResponse,\n AdminPersonListParams,\n AdminPersonListResponse,\n AdminTransactionDetail,\n FlaggedElsewhereList,\n FlaggedPersonList,\n FlaggedPersonListParams,\n PersonFlagCreate,\n PersonFlagList,\n PersonFlagMatchSettings,\n PersonFlagMatchUpdate,\n PersonFlagStatusList,\n PersonFlagUpdate,\n PersonFlagView,\n BuyerEvidenceAssign,\n BuyerEvidenceDeadlineChange,\n RiskBackfillPreview,\n RiskBackfillRequest,\n RiskBackfillResponse,\n RiskBackfillStatus,\n MerchantRiskActionCatalogEntry,\n MerchantRiskActionConfirmRequest,\n MerchantRiskActionDismissRequest,\n MerchantRiskActionLiftRequest,\n MerchantRiskPaymentsStopRequest,\n MerchantRiskActionResponse,\n MerchantRiskBlockedAttemptList,\n MerchantRiskBlockedAttemptListParams,\n MerchantRiskExemptionCreateRequest,\n MerchantRiskExemptionResponse,\n MerchantRiskExemptionRevokeRequest,\n MerchantRiskPolicyPreviewRequest,\n MerchantRiskPolicyPreviewResponse,\n MerchantRiskStageResponse,\n ConnectionCheckPaymentsParams,\n ConnectionCheckPaymentsResponse,\n ConnectionCheckUsageParams,\n ConnectionCheckUsageResponse,\n AdminPreventionCaseFilters,\n AdminPreventionCaseListRequest,\n AdminPreventionConnectionList,\n AdminPreventionConnectionListRequest,\n AdminPreventionMerchantListParams,\n AdminPreventionRefundActionListRequest,\n AdminPreventionRefundRuleList,\n AdminPreventionRefundRuleListRequest,\n AdminPreventionRefundRuleStop,\n AdminPreventionTrendParams,\n PreventionMerchantList,\n PreventionSummary,\n PreventionTrend,\n CreateVatRateRequest,\n UpdateVatRateRequest,\n VatRateDeleteResponse,\n StaffMerchantAccessResponse,\n StaffMerchantAccessUpdateRequest,\n StaffRoleSupportAccess,\n StaffRoleSupportAccessList,\n StaffRoleSupportAccessUpdateRequest,\n} from '../types';\nimport type { RequestExtras, RequestFn, RequestOptions } from '../../client';\nimport { runExport } from '../../exportDownload';\nimport { csvQuery } from '../../listQuery';\n\n/** The case list's filters on an operator read, lists comma-separated. */\nfunction adminPreventionCaseQuery(params?: AdminPreventionCaseFilters): RequestOptions['query'] {\n const { merchant_id, ...filters } = params ?? {};\n return { ...preventionCaseQuery(filters), ...(merchant_id ? { merchant_id } : {}) };\n}\n\nexport class AdminPortal {\n /** Read refund treatment and the scope supplying its effective value. */\n async getRefundVolume(\n merchantId: string,\n query: RefundVolumeQuery = {},\n ): Promise<RefundVolumeResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/refund-volume`,\n {\n query: { ...query },\n },\n );\n }\n\n /** Change future monthly tier snapshots; existing snapshots and statement lines retain their prices. */\n async updateRefundVolume(\n merchantId: string,\n body: UpdateRefundVolumeRequest,\n query: RefundVolumeQuery = {},\n ): Promise<RefundVolumeResponse> {\n return this.request(\n 'PUT',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/refund-volume`,\n {\n query: { ...query },\n body,\n },\n );\n }\n\n /** Read whether refunds return their share of the platform fee, and the scope supplying it. */\n async getPlatformFeeReturn(\n merchantId: string,\n query: PlatformFeeReturnQuery = {},\n ): Promise<PlatformFeeReturnResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/platform-fee-return`,\n {\n query: { ...query },\n },\n );\n }\n\n /** Change the fee return for refunds that succeed from now on; earlier refunds keep their decision. */\n async updatePlatformFeeReturn(\n merchantId: string,\n body: UpdatePlatformFeeReturnRequest,\n query: PlatformFeeReturnQuery = {},\n ): Promise<PlatformFeeReturnResponse> {\n return this.request(\n 'PUT',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/platform-fee-return`,\n {\n query: { ...query },\n body,\n },\n );\n }\n\n /** What each successful refund of one payment returned of the platform fee. */\n async listPaymentPlatformFeeReturns(\n merchantId: string,\n paymentId: string,\n ): Promise<PlatformFeeReturnListResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/transactions/${encodeURIComponent(paymentId)}/platform-fee-returns`,\n );\n }\n\n constructor(private readonly request: RequestFn) {}\n\n /**\n * The deployment's merchant roles: shared roles, the roles defined in code,\n * and every merchant's own custom roles. `GET /admin-portal/merchant-roles`\n */\n async listSharedRoles(): Promise<SharedRoleListResponse> {\n return this.request('GET', '/admin-portal/merchant-roles');\n }\n\n /** `GET /admin-portal/merchant-roles/{roleId}` */\n async getSharedRole(roleId: string): Promise<SharedRoleDetailResponse> {\n return this.request('GET', `/admin-portal/merchant-roles/${encodeURIComponent(roleId)}`);\n }\n\n /**\n * Define a role once and offer it to every merchant, or to the ones listed.\n * Offering never assigns it. `POST /admin-portal/merchant-roles`\n */\n async createSharedRole(body: CreateSharedRoleRequest): Promise<SharedRoleDetailResponse> {\n return this.request('POST', '/admin-portal/merchant-roles', { body });\n }\n\n /**\n * What a change would do, without writing anything. Apply it with\n * `updateSharedRole` and the `version` this returns.\n * `POST /admin-portal/merchant-roles/{roleId}/preview`\n */\n async previewSharedRole(\n roleId: string,\n change: SharedRoleChange,\n ): Promise<SharedRolePreviewResponse> {\n return this.request(\n 'POST',\n `/admin-portal/merchant-roles/${encodeURIComponent(roleId)}/preview`,\n { body: change },\n );\n }\n\n /**\n * Apply a reviewed change. A change that takes access away needs\n * `acknowledge_sign_out` and signs out every holder.\n * `PUT /admin-portal/merchant-roles/{roleId}`\n */\n async updateSharedRole(\n roleId: string,\n body: UpdateSharedRoleRequest,\n ): Promise<SharedRoleApplied> {\n return this.request('PUT', `/admin-portal/merchant-roles/${encodeURIComponent(roleId)}`, {\n body,\n });\n }\n\n /** `POST /admin-portal/merchant-roles/{roleId}/retire/preview` */\n async previewRetireSharedRole(\n roleId: string,\n body: RetireSharedRolePreviewRequest = {},\n ): Promise<RetireSharedRolePreviewResponse> {\n return this.request(\n 'POST',\n `/admin-portal/merchant-roles/${encodeURIComponent(roleId)}/retire/preview`,\n { body },\n );\n }\n\n /**\n * Retire a shared role, moving its holders to the replacement.\n * `POST /admin-portal/merchant-roles/{roleId}/retire`\n */\n async retireSharedRole(\n roleId: string,\n body: RetireSharedRoleRequest,\n ): Promise<SharedRoleApplied> {\n return this.request(\n 'POST',\n `/admin-portal/merchant-roles/${encodeURIComponent(roleId)}/retire`,\n { body },\n );\n }\n\n /**\n * Merchant-specific roles whose holders could move to this shared role, and\n * what each move would change. `GET /admin-portal/merchant-roles/{roleId}/consolidation`\n */\n async sharedRoleConsolidationCandidates(\n roleId: string,\n ): Promise<ConsolidationCandidatesResponse> {\n return this.request(\n 'GET',\n `/admin-portal/merchant-roles/${encodeURIComponent(roleId)}/consolidation`,\n );\n }\n\n /** `POST /admin-portal/merchant-roles/{roleId}/consolidate` */\n async consolidateIntoSharedRole(\n roleId: string,\n body: ConsolidateRolesRequest,\n ): Promise<ConsolidateRolesResponse> {\n return this.request(\n 'POST',\n `/admin-portal/merchant-roles/${encodeURIComponent(roleId)}/consolidate`,\n { body },\n );\n }\n\n /**\n * One page of merchants. Without `sort_by` the caller's favorite merchants\n * come first; with one, favorites are not moved. Several `billing_status`\n * values match a merchant in any of them. `GET /admin-portal/customers`\n */\n async listCustomers(params?: AdminCustomerListParams): Promise<AdminCustomerListResponse> {\n return this.request('GET', '/admin-portal/customers', {\n query: csvQuery(params, ['billing_status']),\n });\n }\n\n async getCustomer(customerId: string): Promise<AdminCustomerDetail> {\n return this.request('GET', `/admin-portal/customers/${encodeURIComponent(customerId)}`);\n }\n\n async listTransactions(\n params?: AdminTransactionListParams,\n ): Promise<AdminTransactionListResponse> {\n const query = transactionListQuery(params);\n return this.request('GET', '/admin-portal/transactions', {\n query,\n });\n }\n\n /**\n * Persons of every merchant account, connected accounts included, or of the\n * one merchant named in `merchant_id`. Each row is one merchant's person\n * and names that merchant; persons of two merchants are never merged,\n * whatever they share. `search` is matched at every merchant listed.\n *\n * A `limit` outside 1 to 100, a `search` longer than 320 characters, or\n * `sort_by: 'captured'` without a three-letter `captured_currency` is a\n * `400`.\n *\n * `GET /admin-portal/persons`\n */\n async listPersonsAcrossMerchants(\n params?: AdminPersonListParams,\n ): Promise<AdminPersonListResponse> {\n if (params === undefined) {\n return this.request('GET', '/admin-portal/persons');\n }\n return this.request('GET', '/admin-portal/persons', { query: params as PersonQuery });\n }\n\n /**\n * One page of ONE merchant's persons: the same query and response as the\n * merchant-facing `persons.list`, admin-authenticated. A person stays one\n * merchant's; `listPersonsAcrossMerchants` lists several merchants' side by\n * side.\n *\n * `GET /admin-portal/persons/{merchantId}`\n */\n async listPersons(merchantId: string, params?: PersonListParams): Promise<PersonListResponse> {\n return this.request('GET', adminPersons(merchantId), {\n query: params as PersonQuery | undefined,\n });\n }\n\n /**\n * One person of a merchant, as the merchant-facing `persons.retrieve`\n * returns it.\n *\n * `GET /admin-portal/persons/{merchantId}/{personId}`\n */\n async getPerson(\n merchantId: string,\n personId: string,\n params?: PersonScopeParams,\n ): Promise<PersonResponse> {\n return this.request('GET', `${adminPersons(merchantId)}/${encodeURIComponent(personId)}`, {\n query: params as PersonQuery | undefined,\n });\n }\n\n /**\n * The persons of a merchant that may be the same person as this one, as\n * the merchant-facing `persons.related` returns them.\n *\n * `GET /admin-portal/persons/{merchantId}/{personId}/related`\n */\n async listRelatedPersons(\n merchantId: string,\n personId: string,\n params?: PersonScopeParams,\n ): Promise<RelatedPersonsResponse> {\n return this.request(\n 'GET',\n `${adminPersons(merchantId)}/${encodeURIComponent(personId)}/related`,\n { query: params as PersonQuery | undefined },\n );\n }\n\n /**\n * The person of one payment of a merchant, as the merchant-facing\n * `persons.ofPayment` returns it.\n *\n * `GET /admin-portal/persons/{merchantId}/payment/{paymentId}`\n */\n async getPaymentPerson(\n merchantId: string,\n paymentId: string,\n params?: PersonScopeParams,\n ): Promise<PaymentPersonResponse> {\n return this.request(\n 'GET',\n `${adminPersons(merchantId)}/payment/${encodeURIComponent(paymentId)}`,\n { query: params as PersonQuery | undefined },\n );\n }\n\n /**\n * Every staff flag of a person, active and removed, newest first, with\n * those of the persons merged into it. A merged person reads as the person\n * it merged into. Staff only; a flag changes no payment.\n *\n * `GET /admin-portal/persons/{merchantId}/{personId}/flags`\n */\n async listPersonFlags(merchantId: string, personId: string): Promise<PersonFlagList> {\n return this.request('GET', personFlags(merchantId, personId));\n }\n\n /**\n * Flags a person for staff. The flag changes no payment and the merchant\n * never sees it. A merged person's flag goes on the person it merged into.\n * A person already flagged is refused with `IR_38` (400); a staff role that\n * may not flag buyers gets a `403`.\n *\n * `POST /admin-portal/persons/{merchantId}/{personId}/flags`\n */\n async flagPerson(\n merchantId: string,\n personId: string,\n body: PersonFlagCreate,\n ): Promise<PersonFlagView> {\n return this.request('POST', personFlags(merchantId, personId), { body });\n }\n\n /**\n * Replaces an active flag's reason and note at the `version` read. A\n * colleague's newer change, or a removal, since that read is refused with\n * `IR_16` (400) rather than overwritten.\n *\n * `PUT /admin-portal/persons/{merchantId}/{personId}/flags/{flagId}`\n */\n async updatePersonFlag(\n merchantId: string,\n personId: string,\n flagId: string,\n body: PersonFlagUpdate,\n ): Promise<PersonFlagView> {\n return this.request(\n 'PUT',\n `${personFlags(merchantId, personId)}/${encodeURIComponent(flagId)}`,\n { body },\n );\n }\n\n /**\n * Removes a flag at the `version` read: the flag stops and stays in the\n * history with who removed it and when, which is what this answers. A\n * colleague's change since that read is refused with `IR_16` (400).\n *\n * `DELETE /admin-portal/persons/{merchantId}/{personId}/flags/{flagId}?version=`\n */\n async removePersonFlag(\n merchantId: string,\n personId: string,\n flagId: string,\n version: number,\n ): Promise<PersonFlagView> {\n return this.request(\n 'DELETE',\n `${personFlags(merchantId, personId)}/${encodeURIComponent(flagId)}`,\n { query: { version } },\n );\n }\n\n /**\n * The merchant's own flags on one of its persons, active and removed, as\n * the merchant's team set them: read only, staff never set, change or\n * remove them. A merged person reads as the person it merged into. A\n * person the merchant does not have is not found (`404`).\n *\n * `GET /admin-portal/persons/{merchantId}/{personId}/merchant-flags`\n */\n async listMerchantPersonFlags(\n merchantId: string,\n personId: string,\n ): Promise<MerchantPersonFlagList> {\n return this.request(\n 'GET',\n `${adminPersons(merchantId)}/${encodeURIComponent(personId)}/merchant-flags`,\n );\n }\n\n /**\n * One page of a merchant's persons with an active flag, newest flag first.\n * A flag on a merged person is listed under the person it merged into, and\n * a person with two active flags is listed once, with the newer one.\n *\n * `GET /admin-portal/persons/{merchantId}/flagged`\n */\n async listFlaggedPersons(\n merchantId: string,\n params?: FlaggedPersonListParams,\n ): Promise<FlaggedPersonList> {\n if (params === undefined) {\n return this.request('GET', `${adminPersons(merchantId)}/flagged`);\n }\n return this.request('GET', `${adminPersons(merchantId)}/flagged`, {\n query: params as PersonQuery,\n });\n }\n\n /**\n * Whether each of 1 to 100 persons of a merchant is flagged, one answer\n * per asked person in the order asked. A merged person answers for the\n * person it merged into; an unknown person is not flagged. No id, or more\n * than 100, is a `400`.\n *\n * `GET /admin-portal/persons/{merchantId}/flag-status?person_ids=`\n */\n async personFlagStatus(\n merchantId: string,\n personIds: readonly string[],\n ): Promise<PersonFlagStatusList> {\n return this.request('GET', `${adminPersons(merchantId)}/flag-status`, {\n query: { person_ids: personIds.join(',') },\n });\n }\n\n /**\n * Persons flagged by staff at other merchants who share an identifier with\n * this person's 100 most recent payments, each once, newest flag first,\n * by the identifiers switched on in {@link AdminPortal.getPersonFlagMatch}:\n * the email, the DeloPay device id, the phone, the card by its processor's\n * fingerprint, the card's first eight digits, last four and expiry, the\n * customer reference, and the network address within 7 days (never a\n * hosting, proxy, VPN or Tor network, nor one more than 5 persons use). An\n * email or a device counts only while both payments still carry it as an\n * identifier that is not common, and only between payments of the same\n * mode (test or live) of merchants that are not archived, within the last\n * 365 days. Device traits never match. A hint only: the persons stay\n * separate and nothing is written.\n *\n * `GET /admin-portal/persons/{merchantId}/{personId}/flagged-elsewhere`\n */\n async listFlaggedElsewhere(merchantId: string, personId: string): Promise<FlaggedElsewhereList> {\n return this.request(\n 'GET',\n `${adminPersons(merchantId)}/${encodeURIComponent(personId)}/flagged-elsewhere`,\n );\n }\n\n /**\n * Which identifiers match a flagged person, one switch per identifier, for\n * staff's hint in {@link AdminPortal.listFlaggedElsewhere}. While nothing\n * is saved, every identifier is on but `card_number` and `ip`, and\n * `revision` is `null`.\n *\n * `GET /admin-portal/persons/flag-match`\n */\n async getPersonFlagMatch(): Promise<PersonFlagMatchSettings> {\n return this.request('GET', '/admin-portal/persons/flag-match');\n }\n\n /**\n * Replaces every identifier switch. A switch turned off removes its\n * matches at once, and every change is recorded in the settings history\n * (entity type `setting`). Send the `revision` you read as\n * `expected_revision`: a save over a newer value is refused with `400` and\n * code `IR_16`, and writes nothing. A role that may not set flags gets\n * `403`.\n *\n * `PUT /admin-portal/persons/flag-match`\n */\n async updatePersonFlagMatch(params: PersonFlagMatchUpdate): Promise<PersonFlagMatchSettings> {\n return this.request('PUT', '/admin-portal/persons/flag-match', { body: params });\n }\n\n /**\n * The admin transaction search as a file. `GET /admin-portal/transactions/export`\n *\n * Takes the same filters as {@link AdminPortal.listTransactions}, sent the\n * same way, and returns the whole match set rather than a page — bounded at\n * 25,000 rows (500 for `pdf`) and refused past that with `DE_07` rather than\n * truncated. Every page of it is read inside one database snapshot, so a\n * payment updated while the file downloads is neither repeated nor skipped.\n *\n * `csv` and `json` are streamed and held to their `X-Delopay-Record-Count`;\n * see {@link ExportTransferOptions} for progress, cancellation and the\n * `EXPORT_INCOMPLETE` check. The format is negotiated by `Accept` and\n * defaults to `json`.\n */\n async exportTransactions(\n params?: AdminTransactionExportParams,\n options?: JsonExportOptions,\n ): Promise<ExportEnvelope<AdminTransactionExportRecord>>;\n async exportTransactions(\n params: AdminTransactionExportParams | undefined,\n options: BinaryExportOptions,\n ): Promise<Blob>;\n async exportTransactions(\n params: AdminTransactionExportParams | undefined,\n options: ExportOptions,\n ): Promise<ExportEnvelope<AdminTransactionExportRecord> | Blob>;\n async exportTransactions(\n params?: AdminTransactionExportParams,\n options?: ExportOptions,\n ): Promise<ExportEnvelope<AdminTransactionExportRecord> | Blob> {\n return runExport(\n this.request,\n 'GET',\n '/admin-portal/transactions/export',\n { query: transactionListQuery(params) },\n options,\n );\n }\n\n /**\n * The admin transaction search as a file, one row per product line.\n * `GET /admin-portal/transactions/export/lines`\n *\n * The same filters as {@link AdminPortal.exportTransactions}, sent the same\n * way; one row per product line the matched payments recorded, plus one\n * `row_kind: 'no_lines'` row for each payment that recorded none. `csv` or\n * `json` only: the server refuses a PDF with `422`.\n */\n async exportTransactionLines(\n params?: AdminTransactionExportParams,\n options?: JsonExportOptions,\n ): Promise<ExportEnvelope<AdminTransactionLineExportRecord>>;\n async exportTransactionLines(\n params: AdminTransactionExportParams | undefined,\n options: CsvExportOptions,\n ): Promise<Blob>;\n async exportTransactionLines(\n params: AdminTransactionExportParams | undefined,\n options: DynamicLineExportOptions,\n ): Promise<ExportEnvelope<AdminTransactionLineExportRecord> | Blob>;\n async exportTransactionLines(\n params?: AdminTransactionExportParams,\n options?: JsonExportOptions | CsvExportOptions | DynamicLineExportOptions,\n ): Promise<ExportEnvelope<AdminTransactionLineExportRecord> | Blob> {\n return runExport(\n this.request,\n 'GET',\n '/admin-portal/transactions/export/lines',\n { query: transactionListQuery(params) },\n options,\n );\n }\n\n /**\n * Full detail for a single transaction of ANY merchant — the same\n * `PaymentResponse` the merchant `payments.retrieve` returns, with what only\n * staff see beside it (`person_flagged`, `flagged_elsewhere`). Admin-scoped:\n * the JWT (or admin API key) does not need to belong to the payment's\n * merchant; the backend resolves the owning merchant and reads it read-only\n * (no connector sync).\n */\n async getTransaction(paymentId: string): Promise<AdminTransactionDetail> {\n return this.request('GET', `/admin-portal/transactions/${encodeURIComponent(paymentId)}`);\n }\n\n /**\n * A payment's buyer risk evaluations, newest first, across every merchant:\n * the same answer as the merchant's `payments.buyerRisk()`.\n *\n * `GET /admin-portal/transactions/{paymentId}/buyer-risk`\n */\n async getTransactionBuyerRisk(paymentId: string): Promise<BuyerRiskEvaluationsResponse> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/buyer-risk`,\n );\n }\n\n /**\n * A payment's connection checks, newest first, across every merchant: the\n * same answer as the merchant's `identityVerifications.connectionChecks()`.\n *\n * `GET /admin-portal/transactions/{paymentId}/connection-checks`\n */\n async getTransactionConnectionChecks(paymentId: string): Promise<ConnectionChecksResponse> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/connection-checks`,\n );\n }\n\n /**\n * Every account that rates buyer addresses over the last `days` days: its\n * merchant's and its shop's name, its provider and label, whether it can\n * check at all and which credentials it has, and its checks per environment\n * (counts and error rate, anonymising connections, failures by reason,\n * ratings by risk level, finished checks per day, the provider's answer\n * time, its latest check and latest rating). The flat counts stay the live\n * and test totals.\n *\n * `GET /admin-portal/connection-checks`\n */\n async connectionCheckUsage(\n params: ConnectionCheckUsageParams = {},\n ): Promise<ConnectionCheckUsageResponse> {\n return this.request('GET', '/admin-portal/connection-checks', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * The same overview over the last 7 days.\n *\n * @deprecated Use `connectionCheckUsage`, which takes a period.\n * `GET /admin-portal/connection-checks`\n */\n async getConnectionCheckUsage(): Promise<ConnectionCheckUsageResponse> {\n return this.request('GET', '/admin-portal/connection-checks');\n }\n\n /**\n * The checks behind one number of the connection check overview, with their\n * payments, one page at a time. With the same `days` and filters a list's\n * `total` is the count it was opened from. A row carries nothing about the\n * buyer, the checked address included.\n *\n * `GET /admin-portal/connection-checks/payments`\n */\n async connectionCheckPayments(\n params: ConnectionCheckPaymentsParams = {},\n ): Promise<ConnectionCheckPaymentsResponse> {\n return this.request('GET', '/admin-portal/connection-checks/payments', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /** The same frozen purchase lines available on the merchant payment read. */\n async getTransactionProductLines(paymentId: string): Promise<PaymentProductLines> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/product-lines`,\n );\n }\n\n /**\n * Per-attempt history (retries across connectors, decline reasons) for a\n * single transaction of ANY merchant.\n */\n async getTransactionAttempts(paymentId: string): Promise<PaymentAttemptsListResponse> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/attempts`,\n );\n }\n\n /**\n * Status timeline (intent / attempt / refund / dispute transitions) for a\n * single transaction of ANY merchant. `complete: false` marks timelines\n * partially reconstructed from current records.\n */\n async getTransactionStatusHistory(paymentId: string): Promise<PaymentStatusHistoryResponse> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/status-history`,\n );\n }\n\n /**\n * The traffic of a transaction of ANY merchant: provider requests, provider\n * webhooks and shop webhooks, oldest first, without payloads. Same shape as\n * `payments.listLogs`.\n */\n async getTransactionLogs(paymentId: string): Promise<PaymentLogsResponse> {\n return this.request('GET', `/admin-portal/transactions/${encodeURIComponent(paymentId)}/logs`);\n }\n\n /** One provider request of a transaction of ANY merchant, with its masked payloads. */\n async getTransactionLogConnectorCall(\n paymentId: string,\n callId: string,\n ): Promise<PaymentLogConnectorCallDetail> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/logs/connector-calls/${encodeURIComponent(callId)}`,\n );\n }\n\n /** One provider webhook of a transaction of ANY merchant, with its masked headers and body. */\n async getTransactionLogIncomingWebhook(\n paymentId: string,\n eventId: string,\n ): Promise<PaymentLogIncomingWebhookDetail> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/logs/incoming-webhooks/${encodeURIComponent(eventId)}`,\n );\n }\n\n /** Every delivery attempt of one shop webhook of a transaction of ANY merchant. */\n async getTransactionLogOutgoingWebhook(\n paymentId: string,\n initialAttemptId: string,\n ): Promise<PaymentLogOutgoingWebhookDetail> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/logs/outgoing-webhooks/${encodeURIComponent(initialAttemptId)}`,\n );\n }\n\n /**\n * The invoices and credit notes issued for a transaction of ANY merchant,\n * each its own row, newest first. At most 100 per page.\n * `GET /admin-portal/transactions/{paymentId}/invoices`\n */\n async getTransactionInvoices(paymentId: string, params?: InvoicePageQuery): Promise<InvoiceList> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/invoices`,\n { query: params === undefined ? undefined : { ...params } },\n );\n }\n\n /**\n * One invoice of ANY merchant as a PDF: the stored copy of an issued\n * document, a live render of a draft, the snapshot under a VOIDED banner for\n * a voided one.\n * `GET /admin-portal/invoices/{invoiceId}/pdf`\n */\n async downloadInvoicePdf(invoiceId: string): Promise<Blob> {\n return this.request('GET', `/admin-portal/invoices/${encodeURIComponent(invoiceId)}/pdf`, {\n responseType: 'blob',\n });\n }\n\n /**\n * Refunds for a single transaction of ANY merchant.\n */\n async getTransactionRefunds(paymentId: string): Promise<RefundListResponse> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/refunds`,\n );\n }\n\n /**\n * The refund requests buyers raised from the customer portal about a single\n * transaction of ANY merchant, newest first, one page at a time\n * (`total_count` counts them all). Read-only.\n * `GET /admin-portal/transactions/{paymentId}/refund-requests`\n */\n async getTransactionRefundRequests(\n paymentId: string,\n params?: BuyerRefundRequestPageQuery,\n ): Promise<BuyerRefundRequestList> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/refund-requests`,\n { query: params === undefined ? undefined : { ...params } },\n );\n }\n\n /**\n * Refunds of ANY merchant mirrored from a connector webhook at a\n * non-terminal status that no sync can advance. Newest first unless\n * `sort_by` says otherwise. Several `connector`, `status` or `sync_reason`\n * values match a refund with any of them.\n */\n async listUnresolvedRefunds(\n params?: AdminUnresolvedRefundListParams,\n ): Promise<AdminUnresolvedRefundListResponse> {\n return this.request('GET', '/admin-portal/refunds/unresolved', {\n query: csvQuery(params, ['connector', 'status', 'sync_reason']),\n });\n }\n\n // --- Buyer evidence review --------------------------------------------------\n\n /**\n * DeloPay's review queue of buyers' evidence, the nearest target first\n * unless `sort_by` says otherwise, across merchants unless `merchant_id` or\n * `profile_id` narrows it. Several `state` values match a case in any of\n * them.\n */\n async listBuyerEvidence(params?: BuyerEvidenceQueueQuery): Promise<BuyerEvidenceQueue> {\n return this.request('GET', '/admin-portal/buyer-evidence', {\n query: csvQuery(params, ['state']),\n });\n }\n\n /**\n * Chargeback prevention connections across merchants, or of one merchant,\n * newest first, one page at a time (`limit` 1 to 200, default 50), with how\n * many match in all.\n */\n async listChargebackPreventionConnections(\n params?: AdminPreventionConnectionListRequest,\n ): Promise<AdminPreventionConnectionList> {\n return this.request('GET', '/admin-portal/chargeback-prevention/connections', {\n query: params as Record<string, string | number | boolean | null | undefined>,\n });\n }\n\n /** Chargeback prevention cases across merchants, or of one merchant. */\n async listChargebackPreventionCases(\n params?: AdminPreventionCaseListRequest,\n ): Promise<PreventionCaseList> {\n const { merchant_id, ...filters } = params ?? {};\n return this.request('GET', '/admin-portal/chargeback-prevention/cases', {\n query: { ...preventionCaseQuery(filters), ...(merchant_id ? { merchant_id } : {}) },\n });\n }\n\n /**\n * Chargeback prevention refund rules across merchants, or of one merchant,\n * each with what its actions add up to.\n */\n async listChargebackPreventionRefundRules(\n params?: AdminPreventionRefundRuleListRequest,\n ): Promise<AdminPreventionRefundRuleList> {\n return this.request('GET', '/admin-portal/chargeback-prevention/refund-rules', {\n query: params as Record<string, string | number | boolean | null | undefined>,\n });\n }\n\n /**\n * Turn a merchant's refund rule off. Its settings are kept, and what it\n * already did is still settled and reported.\n */\n async stopChargebackPreventionRefundRule(\n body: AdminPreventionRefundRuleStop,\n ): Promise<PreventionRefundRule> {\n return this.request('POST', '/admin-portal/chargeback-prevention/refund-rules/disable', {\n body,\n });\n }\n\n /** What refund rules did, across merchants or for one merchant. */\n async listChargebackPreventionRefundActions(\n params?: AdminPreventionRefundActionListRequest,\n ): Promise<PreventionRefundActionList> {\n return this.request('GET', '/admin-portal/chargeback-prevention/refund-actions', {\n query: params as Record<string, string | number | boolean | null | undefined>,\n });\n }\n\n /**\n * Counts and money of the chargeback prevention cases the filters select,\n * per environment, from one snapshot: by outcome, match status and\n * provider, open cases by deadline, and the amounts at stake per currency.\n * The filters are the case list's, so `total` is the list's `total` for the\n * same filters. Amounts are never converted; live and test never added.\n */\n async chargebackPreventionSummary(\n params?: AdminPreventionCaseFilters,\n ): Promise<PreventionSummary> {\n return this.request('GET', '/admin-portal/chargeback-prevention/summary', {\n query: adminPreventionCaseQuery(params),\n });\n }\n\n /**\n * Chargeback prevention alerts raised per UTC day over the last `days` days\n * (1 to 90, default 30), by outcome, per environment, with the share of\n * matched alerts that became a chargeback.\n */\n async chargebackPreventionTrend(params?: AdminPreventionTrendParams): Promise<PreventionTrend> {\n const { days, ...filters } = params ?? {};\n return this.request('GET', '/admin-portal/chargeback-prevention/trend', {\n query: { ...adminPreventionCaseQuery(filters), ...(days !== undefined ? { days } : {}) },\n });\n }\n\n /**\n * Merchants per environment with what their chargeback prevention cases\n * say, one page at a time: open, overdue and unmatched cases, chargebacks\n * and the open amount per currency.\n */\n async chargebackPreventionMerchants(\n params?: AdminPreventionMerchantListParams,\n ): Promise<PreventionMerchantList> {\n const { sort, sort_order, limit, offset, ...filters } = params ?? {};\n return this.request('GET', '/admin-portal/chargeback-prevention/merchants', {\n query: {\n ...adminPreventionCaseQuery(filters),\n ...(sort !== undefined ? { sort } : {}),\n ...(sort_order !== undefined ? { sort_order } : {}),\n ...(limit !== undefined ? { limit } : {}),\n ...(offset !== undefined ? { offset } : {}),\n },\n });\n }\n\n /** One chargeback prevention case of any merchant, with its history. */\n async getChargebackPreventionCase(caseId: string): Promise<PreventionCaseDetail> {\n return this.request(\n 'GET',\n `/admin-portal/chargeback-prevention/cases/${encodeURIComponent(caseId)}`,\n );\n }\n\n /** One case's evidence with every step and file, internal ones included. */\n async getBuyerEvidence(evidenceId: string): Promise<BuyerEvidenceReviewDetail> {\n return this.request('GET', `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}`);\n }\n\n /** Download a file of a case's evidence. */\n async downloadBuyerEvidenceFile(evidenceId: string, fileId: string): Promise<Blob> {\n return this.request(\n 'GET',\n `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/files/${encodeURIComponent(fileId)}`,\n { responseType: 'blob' },\n );\n }\n\n /**\n * Ask the buyer for more, by a cut-off. Refused once a result has closed\n * the review.\n */\n async requestBuyerEvidenceInformation(\n evidenceId: string,\n params: BuyerEvidenceInformationRequest,\n ): Promise<BuyerEvidenceReviewDetail> {\n return this.request(\n 'POST',\n `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/information-requests`,\n { body: params },\n );\n }\n\n /** An answer the buyer sees. */\n async replyToBuyerEvidence(\n evidenceId: string,\n params: BuyerEvidenceReply,\n ): Promise<BuyerEvidenceReviewDetail> {\n return this.request(\n 'POST',\n `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/replies`,\n { body: params },\n );\n }\n\n /**\n * Record the result, which closes the review. It never refunds a payment\n * and never decides a dispute with the payment provider.\n */\n async reviewBuyerEvidence(\n evidenceId: string,\n params: BuyerEvidenceReviewCreate,\n ): Promise<BuyerEvidenceReviewDetail> {\n return this.request(\n 'POST',\n `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/reviews`,\n { body: params },\n );\n }\n\n /** Move the buyer's cut-off, with a reason the buyer sees. */\n async moveBuyerEvidenceDeadline(\n evidenceId: string,\n params: BuyerEvidenceDeadlineChange,\n ): Promise<BuyerEvidenceReviewDetail> {\n return this.request(\n 'PUT',\n `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/deadline`,\n { body: params },\n );\n }\n\n /** Make a user responsible for the review: an id, `me`, or `null` for nobody. */\n async assignBuyerEvidence(\n evidenceId: string,\n params: BuyerEvidenceAssign,\n ): Promise<BuyerEvidenceReviewDetail> {\n return this.request(\n 'PUT',\n `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/reviewer`,\n { body: params },\n );\n }\n\n /** An internal note, never shown to the buyer. */\n async noteBuyerEvidence(\n evidenceId: string,\n params: BuyerEvidenceNote,\n ): Promise<BuyerEvidenceReviewDetail> {\n return this.request(\n 'POST',\n `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}/notes`,\n { body: params },\n );\n }\n\n async analytics(params: AdminAnalyticsRequest): Promise<PlatformAnalyticsResponse> {\n return this.request('GET', '/admin-portal/analytics', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n async overviewStats(): Promise<OverviewStatsResponse> {\n return this.request('GET', '/admin-portal/overview-stats');\n }\n\n async paymentAnalytics(params: PaymentAnalyticsRequest): Promise<PaymentAnalyticsResponse> {\n return this.request('GET', '/admin-portal/payment-analytics', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * One drill level of the analytics dashboard: the scope's daily series +\n * processor mix and its direct children's series. Range / metric / donut\n * toggles apply client-side; only a drill (passing merchant_id / project_id\n * / shop_id) fetches the next level.\n */\n async analyticsScope(params?: AnalyticsScopeRequest): Promise<AnalyticsScopeResponse> {\n return this.request('GET', '/admin-portal/analytics/scope', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * The operators' own analytics exclusions, oldest first, with the payments\n * each one matched in the lookback window. They change the admin's\n * analytics only; a merchant's own rules never change the admin's figures.\n * `GET /admin-portal/analytics/exclusions`\n */\n async listAnalyticsExclusions(): Promise<AdminAnalyticsExclusionsResponse> {\n return this.request('GET', '/admin-portal/analytics/exclusions');\n }\n\n /**\n * Write a new operator rule. Omitting `merchant_id` applies it to every\n * merchant; omitting `surfaces` means **all five**, not none.\n * `POST /admin-portal/analytics/exclusions`\n */\n async createAnalyticsExclusion(\n rule: AdminAnalyticsExclusionRequest,\n ): Promise<AdminAnalyticsExclusionResponse> {\n return this.request('POST', '/admin-portal/analytics/exclusions', { body: rule });\n }\n\n /**\n * Replace an operator rule **completely** — send the whole rule, including\n * an explicit `null` for every optional field you mean to clear.\n * `PUT /admin-portal/analytics/exclusions/{id}`\n */\n async updateAnalyticsExclusion(\n id: string,\n rule: AdminAnalyticsExclusionRequest,\n ): Promise<AdminAnalyticsExclusionResponse> {\n return this.request('PUT', `/admin-portal/analytics/exclusions/${encodeURIComponent(id)}`, {\n body: rule,\n });\n }\n\n /**\n * Delete an operator rule. Returns the rule as it was.\n * `DELETE /admin-portal/analytics/exclusions/{id}`\n */\n async deleteAnalyticsExclusion(id: string): Promise<AdminAnalyticsExclusionResponse> {\n return this.request('DELETE', `/admin-portal/analytics/exclusions/${encodeURIComponent(id)}`);\n }\n\n /**\n * A merchant's own exclusions, read-only, each with the operator rule that\n * already holds it (`admin_rule_id`).\n * `GET /admin-portal/analytics/exclusions/merchant/{merchant_id}`\n */\n async listMerchantAnalyticsExclusions(\n merchantId: string,\n ): Promise<MerchantExclusionsForAdminResponse> {\n return this.request(\n 'GET',\n `/admin-portal/analytics/exclusions/merchant/${encodeURIComponent(merchantId)}`,\n );\n }\n\n /**\n * Copy some of a merchant's rules into the operators' rules, each scoped to\n * that merchant. A copy is independent of its source; a rule an operator\n * rule already holds is skipped with a reason.\n * `POST /admin-portal/analytics/exclusions/copy`\n */\n async copyAnalyticsExclusions(\n body: AdminAnalyticsExclusionCopyRequest,\n ): Promise<AdminAnalyticsExclusionCopyResponse> {\n return this.request('POST', '/admin-portal/analytics/exclusions/copy', { body });\n }\n\n /**\n * Shop comparison: one series per shop over one window, with whole-window\n * and previous-window totals. With `merchant_id`, that merchant's shops;\n * without it, the top `limit` (default 50) shops of every merchant by\n * successful volume, the rest summed into `others`. Same contract as the\n * merchant surface's `analytics.shops`. `GET /admin-portal/analytics/shops`\n */\n async analyticsShops(params: AdminAnalyticsShopsRequest = {}): Promise<AnalyticsShopsResponse> {\n const query: AnalyticsShopsRequest = params;\n return this.request('GET', '/admin-portal/analytics/shops', {\n query: query as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * Every shop's device intelligence account, with its merchant's and its own\n * name and its assessments per environment over the last `days` days: counts\n * and error rate, failures by reason, finished assessments per day and\n * provider, the last recorded assessment, browser payments against assessed\n * ones, and the payments held for a missing assessment. The error rate counts\n * finished assessments: one still running and a payment naming no buyer are\n * not errors.\n * `GET /admin-portal/device-intelligence`\n */\n async deviceIntelligenceUsage(\n params: DeviceIntelligenceUsageParams = {},\n ): Promise<DeviceIntelligenceUsageResponse> {\n return this.request('GET', '/admin-portal/device-intelligence', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * The payments behind one number of the device intelligence overview, one\n * page at a time: the assessments it counts, the payments held for a missing\n * assessment, or the browser payments without a device signal. With the same\n * `days` a list's `total` is the count it was opened from. A row carries\n * nothing about the buyer.\n * `GET /admin-portal/device-intelligence/payments`\n */\n async deviceIntelligencePayments(\n params: DeviceIntelligencePaymentsParams = {},\n ): Promise<DeviceIntelligencePaymentsResponse> {\n return this.request('GET', '/admin-portal/device-intelligence/payments', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * PSP analytics across merchants: the merchant surface's\n * `analytics.connectors`, with `merchant_id` optional (omitted, every\n * merchant, broken down by merchant) and each account's merchant named.\n * `GET /admin-portal/analytics/connectors`\n */\n async analyticsConnectors(\n params: AdminAnalyticsConnectorsRequest = {},\n ): Promise<AnalyticsConnectorsResponse> {\n const query: AnalyticsConnectorsRequest = params;\n return this.request('GET', '/admin-portal/analytics/connectors', {\n query: query as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * Industry analytics across merchants: the merchant surface's\n * `analytics.industries`, with `merchant_id` optional (omitted, every\n * merchant the caller may read). Contributors are merchants rather than\n * shops, the `unmapped` group gathers every merchant-defined industry, and\n * `merchants` and `new_merchants` are filled. Needs the industry analytics\n * staff group. `GET /admin-portal/analytics/industries`\n */\n async analyticsIndustries(params: IndustryAnalyticsRequest = {}): Promise<IndustryAnalytics> {\n return this.request('GET', '/admin-portal/analytics/industries', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * Device analytics over the canonical client-context observation per\n * payment, rooted at all merchants and drillable via `merchant_id` /\n * `project_id` / `shop_id` like `analyticsScope`. Answers 200 with\n * `enabled: false` when the client-context optimisation-use switch is off.\n */\n async analyticsDevices(params?: ClientAnalyticsRequest): Promise<DevicesAnalyticsResponse> {\n return this.request('GET', '/admin-portal/analytics/devices', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * Geo analytics over the canonical client-context observation per payment,\n * rooted at all merchants. `mode` selects the location claim (`ip` default,\n * `billing`).\n */\n async analyticsGeo(params?: ClientAnalyticsRequest): Promise<GeoAnalyticsResponse> {\n return this.request('GET', '/admin-portal/analytics/geo', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * The recent payments behind one clicked geo target (map country/city or\n * local-hours heatmap cell), rooted at all merchants. Capped at 50 rows,\n * newest first, with the full match count alongside.\n */\n async analyticsGeoTransactions(params: GeoDrillRequest): Promise<DrillResponse> {\n return this.request('GET', '/admin-portal/analytics/geo/transactions', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * The recent payments behind one clicked device target (browser/platform\n * family, device-model label or device class), rooted at all merchants.\n * 50 rows per page (`offset` for the next page), newest first.\n */\n async analyticsDeviceTransactions(params: DeviceDrillRequest): Promise<DrillResponse> {\n return this.request('GET', '/admin-portal/analytics/devices/transactions', {\n // A discriminated union carries no index signature, so the widening\n // goes via `unknown` — the union is the point.\n query: params as unknown as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * The payments behind one clicked element of the admin payments dashboard\n * (processor / method slice, outcome segment, series bucket or breakdown\n * row), rooted at all merchants. Same contract as the merchant surface's\n * `analytics.scopeTransactions`. `GET /admin-portal/analytics/scope/transactions`\n */\n async analyticsScopeTransactions(params: ScopeDrillRequest): Promise<DrillResponse> {\n return this.request('GET', '/admin-portal/analytics/scope/transactions', {\n query: params as unknown as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * Subscription analytics over `subscription` and `invoice`, rooted at all\n * merchants and drillable via `merchant_id` / `project_id` / `shop_id` like\n * `analyticsScope`. The `children` block at the root is the merchant\n * breakdown — there is no separate endpoint for it.\n *\n * Half the figures are **stocks** (a snapshot at the window's end, not a sum\n * over it), so `est_monthly_volume_usd` and `active` can match across a\n * 7-day and a 30-day window while `billed_volume_usd` does not. Day\n * granularity only.\n */\n async analyticsSubscriptions(\n params?: SubscriptionAnalyticsRequest,\n ): Promise<SubscriptionAnalyticsResponse> {\n return this.request('GET', '/admin-portal/analytics/subscriptions', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * The billing cycles behind one clicked element of the admin subscription\n * dashboard: an invoice outcome, a processor slice on either axis, a plan\n * row, a subscription status, a movement component, a series bucket or a\n * breakdown row. 50 rows per page (`offset` for the next), newest first,\n * with the full match count alongside.\n *\n * A cycle that never reached a payment is listed too — that is what \"still\n * unpaid\" means — and carries its invoice id as `payment_id` with\n * `invoice_id` set to the same value.\n */\n async analyticsSubscriptionsList(params: SubscriptionDrillRequest): Promise<DrillResponse> {\n return this.request('GET', '/admin-portal/analytics/subscriptions/list', {\n // A discriminated union carries no index signature, so the widening\n // goes via `unknown` — the union is the point, and the query builder\n // only ever reads own enumerable keys.\n query: params as unknown as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * How accurate buyer risk scores were in a period, against what later\n * happened to the payments: fraud, clean, pending and never charged, how\n * well the flagged bands caught the fraud, each band and signal, and the\n * buyers the score stopped who later paid with no fraud. Stores nothing.\n * `GET /admin-portal/buyer-risk/accuracy`\n */\n async buyerRiskAccuracy(params: BuyerRiskAccuracyQuery = {}): Promise<BuyerRiskAccuracyReport> {\n return this.request('GET', '/admin-portal/buyer-risk/accuracy', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * The payments behind one number of {@link AdminPortal.buyerRiskAccuracy}:\n * the payments a signal fired on, those in a band, a flagged × outcome cell,\n * the interventions or the false declines. Paged, sorted and searchable\n * like the analytics drills, and answered in the same shape, with each\n * row's band, score, outcome and applied action.\n * `GET /admin-portal/buyer-risk/accuracy/payments`\n */\n async buyerRiskAccuracyPayments(\n params: BuyerRiskAccuracyPaymentsRequest = {},\n ): Promise<DrillResponse> {\n return this.request('GET', '/admin-portal/buyer-risk/accuracy/payments', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * Platform billing dashboard: total balance across all ledger accounts (+\n * the net change), top-ups, fees collected, and the day-by-day ledger flow.\n * All amounts are in USD minor units.\n */\n async ledgerAnalytics(\n params?: AdminLedgerAnalyticsRequest,\n ): Promise<AdminLedgerAnalyticsResponse> {\n return this.request('GET', '/admin-portal/ledger-analytics', {\n query: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * Billing profiles no operator listing can reach, and the accounts that may\n * have taken one over.\n *\n * Deleting a merchant account leaves its billing profile — with its\n * balance, its Stripe customer and its saved card — behind, and the\n * Merchants listing enumerates merchant accounts, so such a profile is\n * absent from every operator surface rather than flagged on one. This reads\n * from the billing side instead, so it finds them.\n *\n * Both lists come back complete rather than paged: the healthy answer is two\n * empty arrays, and a truncated answer to *\"is the set empty\"* would read as\n * a clean bill of health.\n *\n * `adoption_candidates` are candidates, not findings — confirm a row against\n * the audit log before acting on it.\n */\n async orphanedBillingProfiles(): Promise<AdminOrphanedBillingProfilesResponse> {\n return this.request('GET', '/admin-portal/billing/orphaned-profiles');\n }\n\n /**\n * Retrieve a merchant account via the admin portal. Unlike\n * `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API\n * key) and does not require the JWT to be scoped to the target merchant.\n */\n async retrieveAccount(merchantId: string): Promise<MerchantAccountResponse> {\n return this.request('GET', `/admin-portal/accounts/${encodeURIComponent(merchantId)}`);\n }\n\n /**\n * Update a merchant account via the admin portal. Authenticated via admin JWT\n * or admin API key.\n */\n async updateAccount(\n merchantId: string,\n params: MerchantAccountUpdateRequest,\n ): Promise<MerchantAccountResponse> {\n return this.request('POST', `/admin-portal/accounts/${encodeURIComponent(merchantId)}`, {\n body: params,\n });\n }\n\n /**\n * Delete a merchant account via the admin portal. Authenticated via admin JWT\n * or admin API key.\n */\n async deleteAccount(merchantId: string): Promise<MerchantAccountResponse> {\n return this.request('DELETE', `/admin-portal/accounts/${encodeURIComponent(merchantId)}`);\n }\n\n /**\n * Create a brand-new user attached to the given merchant. The user is\n * marked `is_verified = true` so the admin can hand off credentials\n * immediately — no email round-trip is sent.\n */\n async createUserForMerchant(\n customerId: string,\n body: AdminCreateUserForMerchantRequest,\n ): Promise<AdminUserResponse> {\n return this.request('POST', `/admin-portal/customers/${encodeURIComponent(customerId)}/users`, {\n body,\n });\n }\n\n /**\n * Edit a user record. Any subset of fields may be supplied. `role_id`\n * requires `merchant_id`. `password` triggers a password reset (validated\n * against signup policy + JWT blacklist). `reset_2fa` clears TOTP state\n * so the user re-enrolls on next login. `is_active` supports both\n * directions: false soft-disables, true reactivates a soft-disabled user.\n *\n * Throws a `400` with `code === 'UR_66'` when the change would leave a\n * merchant with no administrator — `is_active: false` or `is_verified:\n * false` on, or a `role_id` demoting, the only active user whose role can\n * manage that merchant's users. Nothing is written. `error.data` carries a\n * {@link LastAdministratorRefusal} naming the merchant and which change was\n * refused; render that rather than the generic message.\n */\n async updateUser(userId: string, body: AdminUpdateUserRequest): Promise<AdminUserResponse> {\n return this.request('PATCH', `/admin-portal/users/${encodeURIComponent(userId)}`, { body });\n }\n\n /**\n * One user's account and its health: whether it is active and verified,\n * whether two-factor authentication is set up, when the password last\n * changed, the linked single sign-on providers, the newest successful and\n * failed sign-in, when the user was last seen and how many sessions are\n * live. Lists every membership the user holds in this tenant, invitations\n * and expired ones included, with its role and status. Never returns a\n * credential. `GET /admin-portal/users/{user_id}`\n *\n * Needs an internal role holding `ProfileUserRead`, or the admin API key.\n * A user with no membership in this tenant is a `404`.\n */\n async getUser(userId: string): Promise<AdminUserDetailResponse> {\n return this.request('GET', `/admin-portal/users/${encodeURIComponent(userId)}`);\n }\n\n /**\n * One user's sign-in history (successes and failures, method, address,\n * location and device), filtered, sorted and paged as\n * `users.listLoginActivity` is. Same access and `404` rule as `getUser`.\n * `GET /admin-portal/users/{user_id}/login-activity`\n */\n async listUserLoginActivity(\n userId: string,\n params?: LoginHistoryParams,\n ): Promise<LoginHistoryResponse> {\n const path = `/admin-portal/users/${encodeURIComponent(userId)}/login-activity`;\n if (params === undefined) {\n return this.request('GET', path);\n }\n return this.request('GET', path, {\n query: csvQuery(params, ['event_type', 'auth_method']),\n });\n }\n\n /**\n * One user's live sessions: neither signed out nor expired. `is_current`\n * marks the caller's own session only, when the caller looks at themselves.\n * Same access and `404` rule as `getUser`.\n * `GET /admin-portal/users/{user_id}/sessions`\n */\n async listUserSessions(userId: string): Promise<UserSessionListResponse> {\n return this.request('GET', `/admin-portal/users/${encodeURIComponent(userId)}/sessions`);\n }\n\n /**\n * End one session of the user: its token is refused on its next request.\n * Needs `UsersManage`. Recorded in the audit log. A session that has\n * already ended answers `revoked: false` and records nothing. A session of\n * another user is a `404`, as an unknown id is.\n * `POST /admin-portal/users/{user_id}/sessions/{session_id}/revoke`\n */\n async revokeUserSession(userId: string, sessionId: string): Promise<UserSessionRevokeResponse> {\n return this.request(\n 'POST',\n `/admin-portal/users/${encodeURIComponent(userId)}/sessions/${encodeURIComponent(sessionId)}/revoke`,\n );\n }\n\n /**\n * Sign the user out of every session and token, wherever they signed in.\n * Needs `UsersManage`. The account stays active and the user can sign in\n * again at once. Answers how many live sessions were ended. Recorded in the\n * audit log. `POST /admin-portal/users/{user_id}/sessions/revoke-all`\n */\n async revokeAllUserSessions(userId: string): Promise<AdminRevokeUserSessionsResponse> {\n return this.request(\n 'POST',\n `/admin-portal/users/${encodeURIComponent(userId)}/sessions/revoke-all`,\n );\n }\n\n /**\n * Which checkout payment methods a member of `merchantId` may change.\n * `GET /admin-portal/accounts/{merchant_id}/members/{user_id}/method-access`\n *\n * Any internal role may read it; `can_edit` is `false` for one without\n * `UsersManage`. A user holding no role in the merchant is a 404 `UR_68`.\n */\n async getMemberMethodAccess(\n merchantId: string,\n userId: string,\n ): Promise<MemberMethodAccessResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/members/${encodeURIComponent(userId)}/method-access`,\n );\n }\n\n /**\n * Limit a member of `merchantId` to some checkout payment methods, or give\n * every method back. Needs `UsersManage`. Recorded in the merchant's audit\n * log. `PUT /admin-portal/accounts/{merchant_id}/members/{user_id}/method-access`\n */\n async updateMemberMethodAccess(\n merchantId: string,\n userId: string,\n body: UpdateMemberMethodAccessRequest,\n ): Promise<MemberMethodAccessResponse> {\n return this.request(\n 'PUT',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/members/${encodeURIComponent(userId)}/method-access`,\n { body },\n );\n }\n\n /**\n * A member of `merchantId`'s permission overrides.\n * `GET /admin-portal/accounts/{merchant_id}/members/{user_id}/permission-overrides`\n *\n * Any internal role may read them; `can_edit` is `false` for one without\n * `UsersManage`. A user holding no role in the merchant is a 404 `UR_68`.\n */\n async getMemberPermissionOverrides(\n merchantId: string,\n userId: string,\n ): Promise<MemberPermissionOverridesResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/members/${encodeURIComponent(userId)}/permission-overrides`,\n );\n }\n\n /**\n * Replace a member of `merchantId`'s permission overrides. Needs\n * `UsersManage`; an operator is not limited by their own access. Recorded\n * in the merchant's audit log and applied to the member's next request.\n * `PUT /admin-portal/accounts/{merchant_id}/members/{user_id}/permission-overrides`\n */\n async updateMemberPermissionOverrides(\n merchantId: string,\n userId: string,\n body: UpdateMemberPermissionOverridesRequest,\n ): Promise<MemberPermissionOverridesResponse> {\n return this.request(\n 'PUT',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/members/${encodeURIComponent(userId)}/permission-overrides`,\n { body },\n );\n }\n\n /**\n * The caller's own merchant access: every merchant, or only the merchants\n * listed. Every employee reads their own.\n * `GET /admin-portal/staff/me/merchant-access`\n */\n async getOwnStaffMerchantAccess(): Promise<StaffMerchantAccessResponse> {\n return this.request('GET', '/admin-portal/staff/me/merchant-access');\n }\n\n /**\n * Which merchants one employee may reach in the admin dashboard and open\n * through the support switch. `can_edit` is `false` without user\n * management and for the caller's own access. A user who is not an\n * employee is a 404 `UR_73`.\n * `GET /admin-portal/staff/{user_id}/merchant-access`\n */\n async getStaffMerchantAccess(userId: string): Promise<StaffMerchantAccessResponse> {\n return this.request('GET', `/admin-portal/staff/${encodeURIComponent(userId)}/merchant-access`);\n }\n\n /**\n * Let one employee reach every merchant or only the merchants listed. Needs\n * `UsersManage`; nobody changes their own. Recorded in the audit log and\n * applied to the employee's next request, an open support session included.\n * Refusals are `UR_73` with a {@link StaffAccessRefusal}.\n * `PUT /admin-portal/staff/{user_id}/merchant-access`\n */\n async updateStaffMerchantAccess(\n userId: string,\n body: StaffMerchantAccessUpdateRequest,\n ): Promise<StaffMerchantAccessResponse> {\n return this.request(\n 'PUT',\n `/admin-portal/staff/${encodeURIComponent(userId)}/merchant-access`,\n { body },\n );\n }\n\n /**\n * Sign in as another staff member, to see and do what they may. Only an\n * administrator may, from their own session, and only as an active staff\n * member who is not an administrator. Answers the staff member's session\n * token for a tab of its own: no cookie is set and the caller's own session\n * stays as it is. The session ends one sign-in lifetime later, when the\n * administrator signs out in that tab, or when either person no longer\n * qualifies. Every change made in it is recorded under the administrator.\n *\n * Needs `UsersManage`, else a `403`. A refusal is a `400` `UR_33`: the\n * caller is no administrator, names themselves, an administrator or no\n * active staff member, or calls from a session that is not their own. The\n * admin API key signs in as nobody and is refused the same way.\n * `POST /admin-portal/staff/{user_id}/sign-in-as`\n */\n async signInAsStaffMember(userId: string): Promise<TokenResponse> {\n return this.request('POST', `/admin-portal/staff/${encodeURIComponent(userId)}/sign-in-as`);\n }\n\n /**\n * What holders of each staff role may do inside a merchant's dashboard\n * during a support session.\n * `GET /admin-portal/staff-roles/support-access`\n */\n async listStaffSupportAccess(): Promise<StaffRoleSupportAccessList> {\n return this.request('GET', '/admin-portal/staff-roles/support-access');\n }\n\n /**\n * Cap what holders of one staff role may do inside a merchant's dashboard,\n * or put the role back to the support switch's own decision. Needs\n * `UsersManage`. Recorded in the audit log and applied to open support\n * sessions from their next request.\n * `PUT /admin-portal/staff-roles/{role_id}/support-access`\n */\n async updateStaffSupportAccess(\n roleId: string,\n body: StaffRoleSupportAccessUpdateRequest,\n ): Promise<StaffRoleSupportAccess> {\n return this.request(\n 'PUT',\n `/admin-portal/staff-roles/${encodeURIComponent(roleId)}/support-access`,\n { body },\n );\n }\n\n /**\n * Soft-delete a user globally: deactivates the row, blacklists existing\n * JWTs, and wipes credentials. Distinct from `deleteUserRole`, which\n * removes a single role binding while leaving the user signed-in elsewhere.\n *\n * Throws the same `UR_66` as {@link updateUser} when the user is the last\n * administrator of any merchant they belong to, with `route: 'delete'`.\n */\n async deleteUser(userId: string): Promise<void> {\n return this.request('DELETE', `/admin-portal/users/${encodeURIComponent(userId)}`);\n }\n\n /**\n * Set a target merchant's shop iframe-allowed origins. Internal-admin\n * route — accepts an admin JWT or admin API key without requiring the\n * caller to be scoped to the target merchant. Pass `null` (or an empty\n * array) to clear the allowlist back to same-origin only.\n *\n * Server validates each origin: full origin (scheme + host[:port]),\n * no path/query/fragment, no wildcards.\n *\n * `POST /admin-portal/accounts/{merchantId}/business-profile/{profileId}/iframe-origins`\n */\n async updateShopIframeOrigins(\n merchantId: string,\n profileId: string,\n origins: string[] | null,\n ): Promise<ProfileResponse> {\n return this.request(\n 'POST',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/business-profile/${encodeURIComponent(profileId)}/iframe-origins`,\n { body: { iframe_allowed_origins: origins } },\n );\n }\n\n /**\n * Set (or clear) a target merchant shop's home country — the geo\n * dashboard's cross-border baseline. Internal-admin route. Pass `null` to\n * clear back to \"international / no home country\" (the default).\n *\n * `POST /admin-portal/accounts/{merchantId}/business-profile/{profileId}/home-country`\n */\n async updateShopHomeCountry(\n merchantId: string,\n profileId: string,\n homeCountry: string | null,\n ): Promise<ProfileResponse> {\n return this.request(\n 'POST',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/business-profile/${encodeURIComponent(profileId)}/home-country`,\n { body: { home_country: homeCountry } },\n );\n }\n\n /**\n * One merchant's sell-to restrictions — the merchant-wide policy and every\n * shop's effective policy. Read-only; staff change a policy through the\n * merchant routes.\n *\n * `GET /admin-portal/accounts/{merchantId}/sell-to-restrictions`\n */\n async getSellToRestrictions(merchantId: string): Promise<SellToRestrictionsResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/sell-to-restrictions`,\n );\n }\n\n /**\n * Soft-delete a transaction of ANY merchant. Only payments whose status\n * is in the admin delete policy can be deleted; the action is audited.\n *\n * `DELETE /admin-portal/transactions/{paymentId}`\n */\n async deleteTransaction(paymentId: string): Promise<PaymentsDeleteResponse> {\n return this.request('DELETE', `/admin-portal/transactions/${encodeURIComponent(paymentId)}`);\n }\n\n /**\n * Recover (undelete) a soft-deleted transaction. Audited.\n *\n * `POST /admin-portal/transactions/{paymentId}/recover`\n */\n async recoverTransaction(paymentId: string): Promise<PaymentsDeleteResponse> {\n return this.request(\n 'POST',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/recover`,\n );\n }\n\n /**\n * Mark a transaction of ANY merchant as an integration test, or remove the\n * mark. Recorded in the payment's status history as an operator's change.\n *\n * `POST /admin-portal/transactions/{paymentId}/integration-test`\n */\n async setTransactionIntegrationTest(\n paymentId: string,\n params: PaymentIntegrationTestRequest,\n ): Promise<PaymentIntegrationTestResponse> {\n return this.request(\n 'POST',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/integration-test`,\n { body: params },\n );\n }\n\n /**\n * Client/device observations captured while the buyer interacted with a\n * transaction of ANY merchant, oldest first.\n *\n * `GET /admin-portal/transactions/{paymentId}/client-context`\n */\n async getTransactionClientContext(paymentId: string): Promise<PaymentClientContextListResponse> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/client-context`,\n );\n }\n\n /**\n * What the rail charged for one attempt of a transaction of ANY merchant,\n * off the attempt's settlement line. `line_recorded: false` means\n * no line exists for the attempt; an absent amount is \"no figure\", never\n * zero.\n *\n * `GET /admin-portal/transactions/{paymentId}/attempts/{attemptId}/processor-cost`\n */\n async getTransactionAttemptProcessorCost(\n paymentId: string,\n attemptId: string,\n ): Promise<AdminAttemptProcessorCost> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/attempts/${encodeURIComponent(attemptId)}/processor-cost`,\n );\n }\n\n /** Read or refresh signed processor fees for a payment. Internal admin access required. */\n async getTransactionProcessorCostEvents(\n paymentId: string,\n params: AdminProcessorCostEventsParams = {},\n ): Promise<ProcessorCostEventsResponse> {\n return this.request(\n 'GET',\n `/admin-portal/transactions/${encodeURIComponent(paymentId)}/processor-cost-events`,\n {\n query: {\n test_mode: params.test_mode,\n year: params.year,\n month: params.month,\n limit: params.limit,\n offset: params.offset,\n force_sync: params.force_sync,\n },\n },\n );\n }\n\n /**\n * DeloPay's own processor cost schedules — our acquirer contract, which\n * prices every merchant that has no schedule of its own, except an account\n * a shop owner brought (that rate is in their contract, not ours, and lives\n * on the merchant surface).\n *\n * Never returned on the merchant surface: these rates are DeloPay's cost\n * base. The rows carry no merchant.\n *\n * `GET /admin-portal/processor-costs`\n */\n async listProcessorCostSchedules(): Promise<ProcessorCostScheduleResponse[]> {\n return this.request('GET', '/admin-portal/processor-costs');\n }\n\n /**\n * Record a DeloPay-wide cost schedule — what a rail charges DeloPay, for\n * rails that report no fee on the payment itself. A cost derived from one\n * of these is marked `estimated` on the settlement line, never `reported`.\n *\n * `POST /admin-portal/processor-costs`\n */\n async createProcessorCostSchedule(\n params: CreateProcessorCostScheduleRequest,\n ): Promise<ProcessorCostScheduleResponse> {\n return this.request('POST', '/admin-portal/processor-costs', { body: params });\n }\n\n /**\n * Record several DeloPay-wide schedules at once, all or none — copy a price\n * list across methods. 1 to 200 entries; an invalid entry is answered `422`\n * naming its index and nothing is stored. The answer lists them in request\n * order.\n *\n * `POST /admin-portal/processor-costs/bulk`\n */\n async bulkCreateProcessorCostSchedules(\n params: BulkCreateProcessorCostSchedulesRequest,\n ): Promise<ProcessorCostScheduleResponse[]> {\n return this.request('POST', '/admin-portal/processor-costs/bulk', { body: params });\n }\n\n /**\n * Close a window, deactivate a DeloPay-wide schedule or annotate it. The\n * rate itself is not editable: it priced transactions that already\n * happened, and a new rate is a new row.\n *\n * `PUT /admin-portal/processor-costs/{scheduleId}`\n */\n async updateProcessorCostSchedule(\n scheduleId: string,\n params: UpdateProcessorCostScheduleRequest,\n ): Promise<ProcessorCostScheduleResponse> {\n return this.request('PUT', `/admin-portal/processor-costs/${encodeURIComponent(scheduleId)}`, {\n body: params,\n });\n }\n\n /**\n * Close a DeloPay-wide schedule at `effective_from` and open its successor\n * with the same scope and the same end, in one step: no transaction is\n * priced by both rates, and none falls between them. Answers the successor.\n *\n * `POST /admin-portal/processor-costs/{scheduleId}/replace`\n */\n async replaceProcessorCostSchedule(\n scheduleId: string,\n params: ReplaceProcessorCostScheduleRequest,\n ): Promise<ProcessorCostScheduleResponse> {\n return this.request(\n 'POST',\n `/admin-portal/processor-costs/${encodeURIComponent(scheduleId)}/replace`,\n { body: params },\n );\n }\n\n /**\n * Delete a DeloPay-wide schedule. Restates nothing: every figure it derived\n * is already stamped on the settlement lines it priced.\n *\n * `DELETE /admin-portal/processor-costs/{scheduleId}`\n */\n async deleteProcessorCostSchedule(scheduleId: string): Promise<void> {\n return this.request(\n 'DELETE',\n `/admin-portal/processor-costs/${encodeURIComponent(scheduleId)}`,\n );\n }\n\n /**\n * The platform VAT rate table, every row past and future. With `on`, only\n * the row in force on that date for each country and category.\n *\n * `GET /admin-portal/vat-rates`\n */\n async listVatRates(params?: VatRateListParams): Promise<VatRateListResponse> {\n return this.request('GET', '/admin-portal/vat-rates', {\n query: { country: params?.country, on: params?.on },\n });\n }\n\n /**\n * Add a rate for a country and category from `valid_from` on. A rate change\n * is a new row with a later `valid_from`; the earlier row keeps pricing the\n * days before it. A second row for the same country, category and date is\n * refused with `IR_38`.\n *\n * `POST /admin-portal/vat-rates`\n */\n async createVatRate(params: CreateVatRateRequest): Promise<VatRateResponse> {\n return this.request('POST', '/admin-portal/vat-rates', { body: params });\n }\n\n /**\n * Change a rate's label, or the rate of a row that has not started yet. A\n * row in force (`valid_from` on or before today, UTC) keeps its rate:\n * payments were determined on it, and a new `rate_bp` is refused with\n * `DE_29` (409).\n *\n * `PUT /admin-portal/vat-rates/{rateId}`\n */\n async updateVatRate(rateId: string, params: UpdateVatRateRequest): Promise<VatRateResponse> {\n return this.request('PUT', `/admin-portal/vat-rates/${encodeURIComponent(rateId)}`, {\n body: params,\n });\n }\n\n /**\n * Delete a rate that has not started yet. A row in force is refused with\n * `DE_29` (409); add a row with a later `valid_from` instead.\n *\n * `DELETE /admin-portal/vat-rates/{rateId}`\n */\n async deleteVatRate(rateId: string): Promise<VatRateDeleteResponse> {\n return this.request('DELETE', `/admin-portal/vat-rates/${encodeURIComponent(rateId)}`);\n }\n\n /**\n * The USD transfers recorded in advance against one shop's statement\n * period. Same shapes as the merchant-facing `settlement.listAdvances`,\n * admin-authenticated and read-only: recording one stays a host action.\n * Name the period by `period_start` (as {@link listSettlementPeriods}\n * returns it), or by `year` and `month`, not both.\n *\n * `GET /admin-portal/accounts/{merchantId}/settlement/advances`\n */\n async listSettlementAdvances(\n merchantId: string,\n params: SettlementAdvanceListRequest,\n ): Promise<SettlementAdvanceListResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/advances`,\n {\n query: {\n profile_id: params.profile_id,\n year: params.year,\n month: params.month,\n period_start: params.period_start,\n test_mode: params.test_mode,\n },\n },\n );\n }\n\n /**\n * One shop's statement periods, newest first. Same shape as the\n * merchant-facing `settlement.listPeriods`, admin-authenticated.\n *\n * `GET /admin-portal/accounts/{merchantId}/settlement/periods`\n */\n async listSettlementPeriods(\n merchantId: string,\n params: SettlementPeriodListParams,\n ): Promise<SettlementPeriodListResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/periods`,\n { query: { profile_id: params.profile_id } },\n );\n }\n\n /**\n * A merchant's settlement statements. Same shapes as the merchant-facing\n * `settlement` resource, admin-authenticated.\n *\n * `GET /admin-portal/accounts/{merchantId}/settlement/statements`\n */\n async listSettlementStatements(\n merchantId: string,\n params: SettlementStatementListParams,\n ): Promise<SettlementStatementListResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/statements`,\n { query: statementListQuery(params) },\n );\n }\n\n /**\n * One settlement statement with its breakdown.\n * `GET /admin-portal/accounts/{merchantId}/settlement/statements/{statementId}`\n */\n async getSettlementStatement(\n merchantId: string,\n statementId: string,\n ): Promise<FeeStatementDetail> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/statements/${encodeURIComponent(statementId)}`,\n );\n }\n\n /**\n * Export a settlement statement as PDF. Returns the raw bytes as a `Blob`\n * with the same auth and error handling as every other call. `options`\n * takes a signal, a timeout and an `onDownloadProgress` listener for the\n * download's bytes (the PDF carries a `Content-Length`, so `total` is set).\n *\n * `GET /admin-portal/accounts/{merchantId}/settlement/statements/{statementId}/pdf`\n */\n async downloadSettlementStatementPdf(\n merchantId: string,\n statementId: string,\n params?: StatementPdfParams,\n options?: RequestExtras,\n ): Promise<Blob> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/statements/${encodeURIComponent(statementId)}/pdf`,\n {\n query: {\n currency: params?.currency,\n include_transactions: params?.include_transactions,\n format: params?.format,\n },\n responseType: 'blob',\n ...options,\n },\n );\n }\n\n /**\n * A merchant's per-shop settlement overview.\n * `GET /admin-portal/accounts/{merchantId}/settlement/overview`\n */\n async settlementOverview(\n merchantId: string,\n params: SettlementOverviewParams,\n ): Promise<SettlementOverviewResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/overview`,\n { query: { test_mode: params.test_mode } },\n );\n }\n\n /**\n * A merchant's live current-period settlement rollup.\n * `GET /admin-portal/accounts/{merchantId}/settlement/current`\n */\n async settlementCurrent(\n merchantId: string,\n params: SettlementCurrentParams,\n ): Promise<SettlementCurrentResponse> {\n return this.request(\n 'GET',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/settlement/current`,\n { query: { test_mode: params.test_mode, profile_id: params.profile_id } },\n );\n }\n\n /**\n * A merchant's vault state: the attach entitlement, and the vault\n * configuration of every shop.\n *\n * `GET /admin-portal/accounts/{merchantId}/vault`\n */\n async getVaultState(merchantId: string): Promise<AdminVaultStateResponse> {\n return this.request('GET', `/admin-portal/accounts/${encodeURIComponent(merchantId)}/vault`);\n }\n\n /**\n * Attach a vault to one of a merchant's shops — creates the vault\n * connector account and points the profile at it in one request. The\n * Collect credentials are verified write-only before anything is stored.\n *\n * `POST /admin-portal/accounts/{merchantId}/vault/attach`\n */\n async attachVault(\n merchantId: string,\n params: AdminAttachVaultRequest,\n ): Promise<AdminAttachVaultResponse> {\n return this.request(\n 'POST',\n `/admin-portal/accounts/${encodeURIComponent(merchantId)}/vault/attach`,\n { body: params },\n );\n }\n\n /**\n * Correct the funding type, issuing bank and issuing country recorded on\n * past card payments from the BIN table, across every merchant, oldest\n * first, one bounded page per call. Resume with the returned `next_after`\n * until it is `null`. A dry run, the default, reports without writing; a\n * payment that changed while the page ran is left alone and counted as a\n * conflict. Payments of merchants whose attempts are stored in Redis are\n * not corrected.\n *\n * `POST /admin-portal/card-funding/backfill`\n */\n async backfillCardFunding(\n params: CardFundingBackfillRequest = {},\n ): Promise<CardFundingBackfillResponse> {\n return this.request('POST', '/admin-portal/card-funding/backfill', { body: params });\n }\n\n /**\n * Every live shop of a merchant, worst first, with DeloPay's reference\n * assessment and, where a merchant adjustment applied, the adjusted one\n * beside it. Not narrowed to one shop: operators see the whole merchant.\n *\n * `GET /admin-portal/accounts/{merchant_id}/risk`\n */\n async getMerchantRisk(merchantId: string): Promise<MerchantRisk> {\n return this.request('GET', `/admin-portal/accounts/${encodeURIComponent(merchantId)}/risk`);\n }\n\n /**\n * A merchant's tuning of its own risk assessment at one scope, as the\n * merchant sees it, for operators.\n *\n * `GET /admin-portal/accounts/{merchant_id}/risk/tuning[/{projects|shops}/{id}]`\n */\n async getMerchantRiskTuning(\n merchantId: string,\n target: RiskTuningTarget = { scope: 'merchant' },\n ): Promise<RiskTuningResponse> {\n return this.request('GET', riskTuningPath(target, adminAccount(merchantId)));\n }\n\n /**\n * Replace a merchant's tuning at one scope on its behalf. Needs\n * `AccountManage`; the merchant sees the change as `platform_operator`, the\n * audit names the operator. Validated and revision-checked as the\n * merchant's own save is.\n *\n * `PUT /admin-portal/accounts/{merchant_id}/risk/tuning[/{projects|shops}/{id}]`\n */\n async updateMerchantRiskTuning(\n merchantId: string,\n target: RiskTuningTarget,\n params: RiskTuningUpdateRequest,\n ): Promise<RiskTuningResponse> {\n return this.request('PUT', riskTuningPath(target, adminAccount(merchantId)), {\n body: params,\n });\n }\n\n /**\n * Reset a merchant's tuning at one scope on its behalf.\n *\n * `DELETE /admin-portal/accounts/{merchant_id}/risk/tuning[/{projects|shops}/{id}]`\n */\n async resetMerchantRiskTuning(\n merchantId: string,\n target: RiskTuningTarget,\n expectedRevision: number,\n ): Promise<RiskTuningResponse> {\n return this.request('DELETE', riskTuningPath(target, adminAccount(merchantId)), {\n query: { expected_revision: expectedRevision },\n });\n }\n\n /**\n * Estimate a change to a merchant's tuning. Stores, scores and sends nothing.\n *\n * `POST /admin-portal/accounts/{merchant_id}/risk/tuning[/{projects|shops}/{id}]/preview`\n */\n async previewMerchantRiskTuning(\n merchantId: string,\n target: RiskTuningTarget,\n adjustments: RiskAdjustments,\n ): Promise<RiskTuningPreviewResponse> {\n return this.request('POST', `${riskTuningPath(target, adminAccount(merchantId))}/preview`, {\n body: { adjustments },\n });\n }\n\n /**\n * The shop risk model the daily scoring pass uses, where it comes from and\n * the `revision` to name when changing it. When no model can be used,\n * `model` is absent and `problem` says why.\n *\n * `GET /admin-portal/risk-model`\n */\n async getRiskModel(): Promise<RiskModelResponse> {\n return this.request('GET', '/admin-portal/risk-model');\n }\n\n /**\n * Change the shop risk model; the answer is the model stored. Name the\n * `revision` the change was made against so a save over a change made in\n * between is refused (`IR_16`) instead of overwriting it. An invalid\n * result, or a scoring change without a higher `model_version`, is refused\n * with the reason in `error.message`.\n *\n * `PUT /admin-portal/risk-model`\n */\n async updateRiskModel(\n patch: RiskModelPatch,\n options: RiskModelUpdateOptions = {},\n ): Promise<RiskModelResponse> {\n return this.request('PUT', '/admin-portal/risk-model', {\n body: patch,\n query: { revision: options.revision },\n });\n }\n\n /**\n * What recalculating the shop risk history over `range` would do, without\n * queuing it: its days, the first day whose counters are rebuilt, the model\n * it would score with now, and the run of the same range already recorded.\n * Refused exactly where `startRiskBackfill()` would be.\n *\n * `POST /admin-portal/risk-engine/backfill/preview`\n */\n async previewRiskBackfill(range: RiskBackfillRequest): Promise<RiskBackfillPreview> {\n return this.request('POST', '/admin-portal/risk-engine/backfill/preview', { body: range });\n }\n\n /**\n * Queue a recalculation of `range`. Days that already have a risk score keep\n * it, and recalculated days never alert. While the same range is queued or\n * running, nothing new is started and `enqueued` is `false`.\n *\n * `POST /admin-portal/risk-engine/backfill`\n */\n async startRiskBackfill(range: RiskBackfillRequest): Promise<RiskBackfillResponse> {\n return this.request('POST', '/admin-portal/risk-engine/backfill', { body: range });\n }\n\n /**\n * One recalculation by the `job_id` a preview or start returned.\n *\n * `GET /admin-portal/risk-engine/backfill/{job_id}`\n */\n async getRiskBackfill(jobId: string): Promise<RiskBackfillStatus> {\n return this.request('GET', `/admin-portal/risk-engine/backfill/${encodeURIComponent(jobId)}`);\n }\n\n /**\n * Where a merchant stands in the risk policy (`merchant_risk.policy`): the\n * policy in force, the stage, the conditions of the last evaluation with\n * their evidence, pending and past actions, exemptions and stage changes.\n *\n * `GET /admin-portal/accounts/{merchant_id}/risk/stage`\n */\n async getMerchantRiskStage(merchantId: string): Promise<MerchantRiskStageResponse> {\n return this.request('GET', `${adminAccount(merchantId)}/risk/stage`);\n }\n\n /**\n * Evaluate a merchant against its risk policy now, as the scoring pass\n * does, and answer where it stands afterwards. Needs `AccountManage`.\n *\n * `POST /admin-portal/accounts/{merchant_id}/risk/stage/evaluate`\n */\n async evaluateMerchantRiskStage(merchantId: string): Promise<MerchantRiskStageResponse> {\n return this.request('POST', `${adminAccount(merchantId)}/risk/stage/evaluate`, { body: {} });\n }\n\n /**\n * Apply a pending action that waits for an operator. An action already\n * decided, suppressed or expired is refused with `DE_19` (HTTP 409).\n *\n * `POST /admin-portal/accounts/{merchant_id}/risk/actions/{action_id}/confirm`\n */\n async confirmMerchantRiskAction(\n merchantId: string,\n actionId: string,\n params: MerchantRiskActionConfirmRequest = {},\n ): Promise<MerchantRiskActionResponse> {\n return this.request(\n 'POST',\n `${adminAccount(merchantId)}/risk/actions/${encodeURIComponent(actionId)}/confirm`,\n { body: params },\n );\n }\n\n /**\n * Dismiss a pending action with a reason; it never applies. An action\n * already decided is refused with `DE_19` (HTTP 409).\n *\n * `POST /admin-portal/accounts/{merchant_id}/risk/actions/{action_id}/dismiss`\n */\n async dismissMerchantRiskAction(\n merchantId: string,\n actionId: string,\n params: MerchantRiskActionDismissRequest,\n ): Promise<MerchantRiskActionResponse> {\n return this.request(\n 'POST',\n `${adminAccount(merchantId)}/risk/actions/${encodeURIComponent(actionId)}/dismiss`,\n { body: params },\n );\n }\n\n /**\n * Exempt a merchant from one action for one risk dimension, until\n * `expires_at` or for good. An exempted action is recorded as `suppressed`\n * with the exemption's id; the stage itself is still entered.\n *\n * `POST /admin-portal/accounts/{merchant_id}/risk/exemptions`\n */\n async createMerchantRiskExemption(\n merchantId: string,\n params: MerchantRiskExemptionCreateRequest,\n ): Promise<MerchantRiskExemptionResponse> {\n return this.request('POST', `${adminAccount(merchantId)}/risk/exemptions`, { body: params });\n }\n\n /**\n * End an exemption now, with a reason. It no longer suppresses anything\n * from the next evaluation on.\n *\n * `POST /admin-portal/accounts/{merchant_id}/risk/exemptions/{exemption_id}/revoke`\n */\n async revokeMerchantRiskExemption(\n merchantId: string,\n exemptionId: string,\n params: MerchantRiskExemptionRevokeRequest,\n ): Promise<MerchantRiskExemptionResponse> {\n return this.request(\n 'POST',\n `${adminAccount(merchantId)}/risk/exemptions/${encodeURIComponent(exemptionId)}/revoke`,\n { body: params },\n );\n }\n\n /**\n * Lift an applied `restrict_payments`, `hold_payouts` or `suspend` action\n * with a reason: what it blocked is allowed again, and nothing else\n * changes. The merchant stays in its stage and the action stays lifted for\n * the rest of that stage entry. An action that is not applied, not one of\n * those kinds, or already lifted is refused with `DE_19` (HTTP 409).\n *\n * `POST /admin-portal/accounts/{merchant_id}/risk/actions/{action_id}/lift`\n */\n async liftMerchantRiskAction(\n merchantId: string,\n actionId: string,\n params: MerchantRiskActionLiftRequest,\n ): Promise<MerchantRiskActionResponse> {\n return this.request(\n 'POST',\n `${adminAccount(merchantId)}/risk/actions/${encodeURIComponent(actionId)}/lift`,\n { body: params },\n );\n }\n\n /**\n * Stop new payments of one shop (`profile_id`), or of every shop of the\n * merchant, with a required reason. The stop is an\n * applied `restrict_payments` action of mode `operator`: payment create,\n * every confirm, the hosted checkout and its provider routes are refused\n * with `DE_22` before any provider is called. No template, connector\n * account, visibility, routing or stage change ends it; only\n * `liftMerchantRiskAction`, with a reason, does. A blank reason is\n * refused (HTTP 400), a shop of another merchant is not found (404), and a\n * scope an applied stop already covers is refused with `DE_19` (409).\n *\n * `POST /admin-portal/accounts/{merchant_id}/risk/stops`\n */\n async stopMerchantPayments(\n merchantId: string,\n params: MerchantRiskPaymentsStopRequest,\n ): Promise<MerchantRiskActionResponse> {\n return this.request('POST', `${adminAccount(merchantId)}/risk/stops`, { body: params });\n }\n\n /**\n * The payments and payouts a merchant's applied risk actions refused,\n * newest first; 50 unless `limit` (at most 200) says otherwise.\n *\n * `GET /admin-portal/accounts/{merchant_id}/risk/blocked-attempts`\n */\n async listMerchantRiskBlockedAttempts(\n merchantId: string,\n params?: MerchantRiskBlockedAttemptListParams,\n ): Promise<MerchantRiskBlockedAttemptList> {\n return this.request('GET', `${adminAccount(merchantId)}/risk/blocked-attempts`, {\n query: params === undefined ? undefined : { ...params },\n });\n }\n\n /**\n * Every merchant risk action kind and whether this platform can use it,\n * with its default mode, its scopes and what it blocks.\n *\n * `GET /admin-portal/risk/actions/catalog`\n */\n async getMerchantRiskActionCatalog(): Promise<MerchantRiskActionCatalogEntry[]> {\n return this.request('GET', '/admin-portal/risk/actions/catalog');\n }\n\n /**\n * Which merchants a risk policy, saved or not, would put in each stage now,\n * from their stored signals, and what each action would block there.\n * Writes nothing. A policy a settings write would refuse is refused the\n * same way (HTTP 422).\n *\n * `POST /admin-portal/risk/policy/preview`\n */\n async previewMerchantRiskPolicy(\n params: MerchantRiskPolicyPreviewRequest,\n ): Promise<MerchantRiskPolicyPreviewResponse> {\n return this.request('POST', '/admin-portal/risk/policy/preview', { body: params });\n }\n}\n\nfunction transactionListQuery(params?: AdminTransactionListParams): RequestOptions['query'] {\n if (!params) return undefined;\n const {\n statuses,\n connectors,\n payment_methods,\n payment_method_types,\n currencies,\n merchant_connector_ids,\n connector_settlement_statuses,\n routing_approaches,\n failure_substatuses,\n product_ids,\n buyer_risk_band,\n merchant_ids,\n ...query\n } = params;\n return {\n ...query,\n ...(statuses?.length ? { statuses: statuses.join(',') } : {}),\n ...(connectors?.length ? { connectors: connectors.join(',') } : {}),\n ...(payment_methods?.length ? { payment_methods: payment_methods.join(',') } : {}),\n ...(payment_method_types?.length\n ? { payment_method_types: payment_method_types.join(',') }\n : {}),\n ...(currencies?.length ? { currencies: currencies.join(',') } : {}),\n ...(merchant_connector_ids?.length\n ? { merchant_connector_ids: merchant_connector_ids.join(',') }\n : {}),\n ...(connector_settlement_statuses?.length\n ? { connector_settlement_statuses: connector_settlement_statuses.join(',') }\n : {}),\n ...(routing_approaches?.length ? { routing_approaches: routing_approaches.join(',') } : {}),\n ...(failure_substatuses?.length ? { failure_substatuses: failure_substatuses.join(',') } : {}),\n ...(product_ids?.length ? { product_ids: product_ids.join(',') } : {}),\n ...(buyer_risk_band?.length ? { buyer_risk_band: buyer_risk_band.join(',') } : {}),\n ...(merchant_ids?.length ? { merchant_ids: merchant_ids.join(',') } : {}),\n };\n}\n\ntype PersonQuery = Record<string, string | number | boolean | null | undefined>;\n\n/** The admin-portal prefix of one merchant's person routes. */\nfunction adminPersons(merchantId: string): string {\n return `/admin-portal/persons/${encodeURIComponent(merchantId)}`;\n}\n\n/** The admin-portal path of one person's staff flags. */\nfunction personFlags(merchantId: string, personId: string): string {\n return `${adminPersons(merchantId)}/${encodeURIComponent(personId)}/flags`;\n}\n\n/** The admin-portal prefix of one merchant's account routes. */\nfunction adminAccount(merchantId: string): string {\n return `/admin-portal/accounts/${encodeURIComponent(merchantId)}`;\n}\n"]}
|