gen cardId
This commit is contained in:
@@ -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}`;
|
||||
}
|
||||
Reference in New Issue
Block a user