feat(wallet): 增强资金流水和信用账本的公共类型过滤,支持游戏结算和账单结算
Some checks failed
lotterLaravel CI / test (push) Has been cancelled
lotterLaravel E2E / e2e-api (push) Has been cancelled

This commit is contained in:
2026-06-30 17:55:16 +08:00
parent f1f68d09d3
commit ed5a983003
8 changed files with 384 additions and 24 deletions

View File

@@ -352,6 +352,66 @@ test('admin lists wallet transactions and filters abnormal', function (): void {
->assertJsonPath('data.items.0.status', 'pending_reconcile');
});
test('admin wallet transactions accepts public flow type filters', function (): void {
$token = makeAdminToken();
$player = Player::query()->create([
'site_code' => 'main',
'site_player_id' => 'public-flow-filter',
'username' => null,
'nickname' => null,
'default_currency' => 'NPR',
'status' => 0,
]);
$wallet = PlayerWallet::query()->create([
'player_id' => $player->id,
'wallet_type' => 'lottery',
'currency_code' => 'NPR',
'balance' => 5000,
'frozen_balance' => 0,
'status' => 0,
'version' => 1,
]);
foreach ([
['WX_admin_bet', 'bet_deduct', 2],
['WX_admin_prize', 'settle_payout', 1],
['WX_admin_reversal', 'bet_reverse', 1],
] as [$txnNo, $bizType, $direction]) {
WalletTxn::query()->create([
'txn_no' => $txnNo,
'player_id' => $player->id,
'wallet_id' => $wallet->id,
'biz_type' => $bizType,
'biz_no' => $txnNo,
'direction' => $direction,
'amount' => 100,
'balance_before' => 1000,
'balance_after' => 1000,
'status' => 'posted',
]);
}
$this->withHeader('Authorization', 'Bearer '.$token)
->getJson('/api/v1/admin/wallet/transactions?biz_type=bet')
->assertOk()
->assertJsonPath('data.total', 1)
->assertJsonPath('data.items.0.biz_type', 'bet_deduct');
$this->withHeader('Authorization', 'Bearer '.$token)
->getJson('/api/v1/admin/wallet/transactions?biz_type=prize')
->assertOk()
->assertJsonPath('data.total', 1)
->assertJsonPath('data.items.0.biz_type', 'settle_payout');
$this->withHeader('Authorization', 'Bearer '.$token)
->getJson('/api/v1/admin/wallet/transactions?biz_type=reversal')
->assertOk()
->assertJsonPath('data.total', 1)
->assertJsonPath('data.items.0.biz_type', 'bet_reverse');
});
test('admin transfer reverse is idempotent under concurrent reconcile', function (): void {
$player = Player::query()->create([
'site_code' => 'main',