feat(core): harden sessions settlement and credit activity
This commit is contained in:
@@ -100,7 +100,7 @@ final class PlayerCreditService
|
||||
}
|
||||
}
|
||||
|
||||
public function holdForBet(Player $player, int $amountMinor): void
|
||||
public function holdForBet(Player $player, int $amountMinor, ?int $ticketOrderId = null): void
|
||||
{
|
||||
if ($amountMinor <= 0) {
|
||||
return;
|
||||
@@ -155,8 +155,8 @@ final class PlayerCreditService
|
||||
'owner_id' => $player->id,
|
||||
'amount' => -$amountMinor,
|
||||
'reason' => 'bet_hold',
|
||||
'ref_type' => 'bet',
|
||||
'ref_id' => null,
|
||||
'ref_type' => $ticketOrderId !== null && $ticketOrderId > 0 ? 'ticket_order' : 'bet',
|
||||
'ref_id' => $ticketOrderId !== null && $ticketOrderId > 0 ? $ticketOrderId : null,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
@@ -289,14 +289,14 @@ final class PlayerCreditService
|
||||
}
|
||||
}
|
||||
|
||||
public function assertMayPlaceBet(Player $player, int $amountMinor): void
|
||||
public function assertMayPlaceBet(Player $player, int $amountMinor, ?int $ticketOrderId = null): void
|
||||
{
|
||||
if (! PlayerFundingMode::usesCredit($player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->assertCreditGuards($player);
|
||||
$this->holdForBet($player, $amountMinor);
|
||||
$this->holdForBet($player, $amountMinor, $ticketOrderId);
|
||||
}
|
||||
|
||||
private function assertCreditGuards(Player $player): void
|
||||
|
||||
Reference in New Issue
Block a user