import { PaymentMethod } from "../types.js"; import { PaymentMethodsRef } from "../../pay/toB/paymentMethods/index.js"; import React from "react"; //#region src/components/checkout/paymentRuntime/PaymentMethodRuntime.d.ts type PaymentMethodRuntimeStatus = 'success' | 'failed' | 'cancelled' | 'provider-handled' | 'cancel-order'; interface PaymentMethodRuntimeResult { status: PaymentMethodRuntimeStatus; amount: number; serviceCharge?: { amount?: string | number; percentage?: string | number; } | null; metadata?: Record; raw?: any; message?: string; /** * 支付记录已交给本地收尾/恢复流程,调用方不能再删除或重新保存草稿。 */ preservePendingPayment?: boolean; } interface PaymentMethodRuntimePreparedPayment { paymentNumber: string; salesId: string; } interface PaymentMethodRuntimeExecuteParams { method: PaymentMethod & Record; amount: string | number; currencySymbol?: string; deviceNumber?: string; /** EFTPOS Provider 打开前已经写入订单草稿的 pending 支付会话。 */ preparedPayment?: PaymentMethodRuntimePreparedPayment; /** Auxiliary notifications; delivery never gates a payment attempt. */ onAttemptStarted?: () => void; onAttemptFailed?: () => void; /** The provider dialog has closed; cancellation cleanup is still pending. */ onCancelSettling?: () => void; } interface PaymentMethodRuntimeRef { execute(params: PaymentMethodRuntimeExecuteParams): Promise; /** Checkout legacy handler 迁移期的底层兼容入口。 */ onPay: PaymentMethodsRef['onPay']; /** Checkout legacy PiPayment handler 迁移期的底层兼容入口。 */ openPi: (options: any) => boolean; } //#endregion export { PaymentMethodRuntimeRef };