Files
thebet365/apps/player/src/utils/walletTx.ts
Mars afb5c5437e feat: 充值订单审计与重新申请,优化赛事展示和余额刷新
- 新增 deposit_order_audit_logs 表,记录提交/审批/拒绝/撤销/重提全链路
- 管理端充值单页增加审计历史;玩家端充值历史支持时间线与重新申请
- 已拒绝订单可原单号重提;撤销入账使用 PLAYER_DEPOSIT_REVERSAL 并加强幂等
- 结算后清除热门标记,允许归档已结算赛事,完善今日赛事时区窗口
- 足球页今日/早盘独立折叠;资料与余额在进入钱包/个人页及下注后自动刷新
- 补充投注玩法、结算返水规则文档;新增 smoke/settlement CLI 脚本

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-15 14:52:05 +08:00

90 lines
2.9 KiB
TypeScript

export const TX_KEY_MAP: Record<string, string> = {
MANUAL_DEPOSIT: 'wallet.tx_deposit',
ADMIN_DEPOSIT: 'wallet.tx_admin_deposit',
AGENT_DEPOSIT: 'wallet.tx_agent_deposit',
INITIAL_DEPOSIT: 'wallet.tx_admin_deposit',
MANUAL_WITHDRAW: 'wallet.tx_withdraw',
ADMIN_WITHDRAW: 'wallet.tx_admin_withdraw',
AGENT_WITHDRAW: 'wallet.tx_agent_withdraw',
MANUAL_ADJUST: 'wallet.tx_adjust',
BET_FREEZE: 'wallet.tx_bet_freeze',
BET_DEDUCT: 'wallet.tx_bet_deduct',
BET_SETTLE_WIN: 'wallet.tx_bet_win',
BET_SETTLE_LOSE: 'wallet.tx_bet_lose',
BET_SETTLE_PUSH: 'wallet.tx_bet_push',
BET_WIN: 'wallet.tx_bet_win',
BET_REFUND: 'wallet.tx_bet_refund',
BET_VOID: 'wallet.tx_bet_void',
BET_VOID_REFUND: 'wallet.tx_bet_void',
CASHBACK: 'wallet.tx_cashback',
CASHBACK_DEPOSIT: 'wallet.tx_cashback',
RESETTLE_REVERSE: 'wallet.tx_resettle',
DEPOSIT: 'wallet.tx_deposit',
WITHDRAW: 'wallet.tx_withdraw',
PLAYER_DEPOSIT: 'wallet.tx_player_deposit',
PLAYER_DEPOSIT_REVERSAL: 'wallet.tx_player_deposit_reversal',
};
export function txTypeKey(type: string): string {
return TX_KEY_MAP[type.toUpperCase()] ?? '';
}
export function txDisplayType(tx: { displayType?: string; transactionType: string }): string {
return tx.displayType?.trim() || tx.transactionType;
}
export function txSummaryLabel(
tx: {
summary?: string | null;
summaryKind?: 'opening_bonus' | null;
referenceType?: string | null;
},
t: (key: string, params?: Record<string, unknown>) => string,
): string {
if (tx.summaryKind === 'opening_bonus') {
return t('wallet.summary_opening_bonus');
}
const summary = tx.summary?.trim();
if (!summary) return '';
if (tx.referenceType === 'BET') {
return t('wallet.summary_bet', { betNo: summary });
}
return summary;
}
export function isDepositType(type: string): boolean {
const t = type.toUpperCase();
return (t.includes('DEPOSIT') || t === 'CASHBACK_DEPOSIT') && !isCashbackType(type) && t !== 'PLAYER_DEPOSIT_REVERSAL';
}
export function isDepositReversalType(type: string): boolean {
return type.toUpperCase() === 'PLAYER_DEPOSIT_REVERSAL';
}
export function txRemarkLabel(
tx: { transactionType: string; remark?: string | null; referenceId?: string | null },
t: (key: string, params?: Record<string, unknown>) => string,
): string {
const type = tx.transactionType.toUpperCase();
const remark = tx.remark?.trim() ?? '';
if (type === 'PLAYER_DEPOSIT_REVERSAL') {
return t('wallet.remark_deposit_revoke_generic');
}
return remark;
}
export function isWithdrawType(type: string): boolean {
const t = type.toUpperCase();
if (t === 'PLAYER_DEPOSIT_REVERSAL') return false;
return t.includes('WITHDRAW');
}
export function isBetType(type: string): boolean {
return type.toUpperCase().startsWith('BET_') || type.toUpperCase() === 'RESETTLE_REVERSE';
}
export function isCashbackType(type: string): boolean {
const t = type.toUpperCase();
return t === 'CASHBACK' || t === 'CASHBACK_DEPOSIT';
}