import type { PaymentProviderAdapter, VerifyTransactionResult } from "../interfaces.js"; import type { ID } from "../types.js"; import type { Operation } from "../schemas.js"; import type { OperationsDomain, SettleOptions } from "./operations.js"; import type { PayLogger } from "../interfaces.js"; export interface VerifyByOperationContext { operation: Operation; provider: string; defaultReference?: string; } export interface VerifyByOperationInput { operationId: ID; /** * Optional idempotency key to prevent duplicate verifications if the same * verification request is retried. Enables replay-safe verification. */ idempotencyKey?: string; /** * Optional provider-specific reference resolver. If omitted, defaults to * operation.externalId. */ resolveReference?: (context: VerifyByOperationContext) => string | undefined | Promise; /** * Apply status transitions when verify result is final. Defaults to true. */ applyTransitions?: boolean; /** * Optional settle options (except providerFees, which is sourced from verify). */ settleOptions?: Omit; } /** Result of a successful {@link VerificationDomain.verifyByOperation} call. */ export interface VerifyByOperationResult { /** The operation that was verified. */ operationId: ID; /** The provider adapter used for verification. */ provider: string; /** The provider reference that was passed to the adapter (externalId or custom resolver output). */ usedReference: string; /** Raw verification result returned by the provider adapter. */ verification: VerifyTransactionResult; /** The operation after any status transitions were applied. */ operation: Operation; } /** Verification domain — actively poll provider APIs to confirm transaction status. */ export interface VerificationDomain { /** * Verify the status of a pending or processing operation by querying the * payment provider's API directly. * * If `applyTransitions` is `true` (default), automatically calls * {@link OperationsDomain.settle} or {@link OperationsDomain.fail} based on * the provider response. * * Useful for polling flows and background reconciliation jobs. * * @param input - Verification parameters. * @returns Verification result including the provider response and updated operation. * @throws {OperationNotFoundError} if the operation does not exist. * @throws {ProviderNotConfiguredError} if the operation's provider is not registered. * * @example * ```ts * const result = await pay.verification.verifyByOperation({ * operationId: op.id, * applyTransitions: true, * }); * // result.operation.status === "completed" | "failed" * ``` */ verifyByOperation(input: VerifyByOperationInput): Promise; /** * Look up a transaction directly by its provider-side reference, without a * corresponding local operation. * * @alpha Designed but not yet implemented. Calling this method will always * throw {@link OperationNotSupportedError} until a future release. * * @param providerReference - The provider's transaction reference string. * @param provider - The provider adapter to query. * @throws {OperationNotSupportedError} always — not yet implemented. */ verifyByReference(providerReference: string, provider: string): Promise; } export declare function createVerificationDomain(providers: Map, operations: Pick, logger?: PayLogger): VerificationDomain; //# sourceMappingURL=verification.d.ts.map