Files
rnpay/utils/walletCardId.ts
T
2026-07-20 00:27:31 +08:00

25 lines
859 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { WalletType } from 'rnwalletman';
/** 钱包类型 → 卡 ID 编码,与 walletman/card_id.go 保持一致 */
export const WALLET_TYPE_CODES: Record<string, string> = {
[WalletType.PAYTM_PERSONAL]: '01',
[WalletType.PHONEPE_PERSONAL]: '02',
[WalletType.MOBIKWIK_PERSONAL]: '03',
[WalletType.FREECHARGE_PERSONAL]: '04',
[WalletType.AMAZONPAY_PERSONAL]: '05',
[WalletType.PAYTM_BUSINESS]: '11',
[WalletType.PHONEPE_BUSINESS]: '12',
[WalletType.GOOGLEPAY_BUSINESS]: '13',
[WalletType.BHARATPE_BUSINESS]: '14',
};
/** 生成稳定卡 ID{userId}_{walletTypeCode}_{phone} */
export function buildWalletCardId(
userId: number | string,
walletType: WalletType | string,
phone: string,
): string {
const code = WALLET_TYPE_CODES[String(walletType)] || '00';
return `${userId}_${code}_${phone}`;
}