diff options
Diffstat (limited to 'internal/casino/types.go')
| -rw-r--r-- | internal/casino/types.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/casino/types.go b/internal/casino/types.go index f6a828d..9a3f0a1 100644 --- a/internal/casino/types.go +++ b/internal/casino/types.go @@ -237,6 +237,11 @@ type Wallet interface { // refund could not be made durable: nothing was returned and the stakes // remain pending for a later attempt or startup recovery. RefundOutstanding() (chips, credits int, err error) + // RefundStakes returns the named pending stakes in kind — chips as chips, + // credits as credits — and removes them from the ledger in one save. It is + // the take-back path for a seat that holds specific handles; unlike + // PayCredits it never converts casino-only chips into spendable credits. + RefundStakes(stakeIDs ...string) error } type EventType string @@ -381,3 +386,11 @@ type Participant struct { SitOutAfter bool LeaveAfter bool } + +// SettlementBalanceNeeded reports whether a settlement should print the seat's +// balance: the seat is leaving, sitting out after the round, or disconnected, +// and the payout did not fail. Shared by every table so the rule lives in one +// place instead of being copy-pasted per game. +func (p *Participant) SettlementBalanceNeeded(payoutFailed bool) bool { + return !payoutFailed && (p.LeaveAfter || p.SitOutAfter || !p.Connected) +} |
