@pisell/pisellos
Version:
一个可扩展的前端模块化SDK框架,支持插件系统
123 lines (122 loc) • 4.35 kB
TypeScript
import { WalletPassPayment, WalletDeductionRecommendParams, WalletRecommendItem, UserIdentificationCodeParams, UserIdentificationCodeItem, SearchIdentificationCodeParams, SearchIdentificationCodeItem, SearchIdentificationCodeResult, WalletInitBusinessData } from './types';
import type { PaymentModule } from './index';
/**
* 钱包支付实现
*/
export declare class WalletPassPaymentImpl implements WalletPassPayment {
private paymentModule;
private walletRecommendList;
private userIdentificationCodes;
private searchResults;
private walletParams;
private walletInitData;
constructor(paymentModule: PaymentModule);
/**
* 发送事件的辅助方法
* 支持使用WalletPassHooks或PaymentHooks
*/
private emitEvent;
/**
* 生成钱包API默认参数
* 根据业务数据生成标准的钱包API参数,并存储在模块中
*/
generateWalletParams(businessData: WalletInitBusinessData): WalletDeductionRecommendParams;
/**
* 获取已存储的钱包参数
* 返回之前生成并存储的钱包参数
*/
getStoredWalletParams(): WalletDeductionRecommendParams | null;
/**
* 清理已存储的钱包参数
* 清除之前存储的钱包参数
*/
clearStoredWalletParams(): void;
/**
* 从业务数据初始化钱包数据
* 内部生成参数,然后调用标准的初始化流程
*/
initializeWalletDataFromBusinessAsync(businessData: WalletInitBusinessData): Promise<{
walletRecommendList: WalletRecommendItem[];
userIdentificationCodes: UserIdentificationCodeItem[];
transformList: any[];
noApplicableVoucher: any[];
products: any[];
}>;
/**
* 获取订单基础详情
*/
getOrderBasicDetailAsync(orderId: string): Promise<any>;
/**
* 初始化钱包数据
* 先获取推荐列表,再获取用户识别码列表(顺序执行)
*/
initializeWalletDataAsync(baseParams: WalletDeductionRecommendParams): Promise<{
walletRecommendList: WalletRecommendItem[];
userIdentificationCodes: UserIdentificationCodeItem[];
transformList: any[];
noApplicableVoucher: any[];
products: any[];
}>;
getWalletPassRecommendListAsync(params: WalletDeductionRecommendParams): Promise<WalletRecommendItem[]>;
formatWalletPassList2PreparePayments(list: WalletRecommendItem[]): {
voucher_id: number;
amount: number;
tag: string;
}[];
getUserIdentificationCodeListAsync(params: UserIdentificationCodeParams): Promise<UserIdentificationCodeItem[]>;
/**
* 搜索识别码信息
* 通过识别码搜索相关的钱包通行证信息
* 基于 WalletDeductionRecommendParams 参数结构
* 特殊逻辑:当识别码长度为9位且前3位为"000"时,调用 /wallet/detail/search 接口
*/
searchIdentificationCodeAsync(params: SearchIdentificationCodeParams, config?: {
noCache?: boolean;
}): Promise<SearchIdentificationCodeResult>;
processWalletPayment(amount: number, orderUuid: string, voucherId?: string): Promise<void>;
getWalletBalance(voucherId: string): Promise<number>;
/**
* 获取缓存的钱包推荐列表
*/
getWalletRecommendList(): WalletRecommendItem[];
/**
* 获取缓存的用户识别码列表
*/
getUserIdentificationCodes(): UserIdentificationCodeItem[];
/**
* 清除钱包推荐列表
*/
clearWalletRecommendList(): void;
/**
* 清除用户识别码列表
*/
clearUserIdentificationCodes(): void;
/**
* 获取缓存的搜索结果列表
*/
getSearchResults(): SearchIdentificationCodeItem[];
/**
* 根据识别码查找搜索结果
*/
findSearchResultByCode(code: string): SearchIdentificationCodeItem | undefined;
/**
* 清除搜索结果缓存
*/
clearSearchResults(): void;
/**
* 获取存储的钱包初始化数据
*/
getStoredWalletInitData(): {
transformList: any[];
noApplicableVoucher: any[];
products: any[];
} | null;
/**
* 清除存储的钱包初始化数据
*/
clearStoredWalletInitData(): void;
/**
* 清除所有缓存数据
*/
clearAllCache(): void;
}