gen cardId

This commit is contained in:
2026-07-20 00:27:31 +08:00
parent b47f6019af
commit 5b0a3569a5
2 changed files with 53 additions and 11 deletions
+24
View File
@@ -0,0 +1,24 @@
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}`;
}