import { ListReaderParams, PaymentReader, PaymentResult, PaymentSchemaAction, PiPaymentCreateOptions, PiPaymentDraftState, PiPaymentPayParams, PiPaymentRefundParams, PiPaymentRuntime, PiPaymentSessionListener, PiPaymentSessionState, PiPaymentUpdateInput } from './types'; /** * 交易级 PiPayment session。 * 它持有单笔 UI 流程内的 draft、attempt、schema、action lock 和 listener。 */ export declare class PiPaymentSession { /** 前端 session id。 */ readonly sessionId: string; /** SDK runtime。 */ private runtime; /** 当前 route adapter。 */ private adapter; /** session 事件发射器。 */ private emitter; /** session 日志空间。 */ private logger; /** session 被销毁时通知 SDK 移除管理引用。 */ private onDestroy?; /** 当前完整状态。 */ private state; /** 当前 attempt 的 AbortController。 */ private abortController?; /** 当前 attempt mode。 */ private activeMode?; /** 当前 attempt resolve。 */ private activeResolve?; /** 当前 attempt reject。 */ private activeReject?; /** 当前 attempt 唯一的执行实例;所有 action 都回到该实例。 */ private activeMethod?; /** 已提交 action 集合。 */ private submittedActions; constructor(sessionId: string, runtime: PiPaymentRuntime, options: PiPaymentCreateOptions, onDestroy?: (session: PiPaymentSession) => void); /** 订阅 session 生命周期事件。 */ subscribe(listener: PiPaymentSessionListener): () => void; /** 同步读取当前完整状态快照。 */ getState(): PiPaymentSessionState; /** 更新 session draft,只允许在没有 active attempt 时调用。 */ update(input: PiPaymentUpdateInput): PiPaymentDraftState; /** 查询 eftpos paired card readers。 */ listReaders(params?: ListReaderParams): Promise; /** 发起支付 attempt。 */ pay(params?: PiPaymentPayParams): Promise; /** 发起退款 attempt。 */ refund(params?: PiPaymentRefundParams): Promise; /** 执行支付页 schema button action。 */ action(action: PaymentSchemaAction): Promise; /** 销毁当前 session,清理 listener、请求和日志。 */ destroy(): void; /** 发起 pay/refund attempt,并保持 actionRequired 时的 Promise pending。 */ private startAttempt; /** 校验当前状态是否允许新 attempt。 */ private assertCanStartAttempt; /** 创建 adapter 执行 attempt 需要的上下文。 */ private createAttemptContext; /** 设置当前执行页 schema 并发出 schemaChange。 */ private setSchema; /** 更新 session 生命周期状态。 */ private setStatus; /** 标记交易推进类 action 已提交。 */ private markActionSubmitted; /** 完成成功终态并 settle active Promise。 */ private finishSuccess; /** 完成失败终态并 settle active Promise。 */ private finishFailed; /** 发出状态变更事件。 */ private emitStateChange; /** 清理并释放当前 attempt 的唯一执行实例。 */ private cleanupActiveMethod; }