Skip to main content

F012 — Bet Cancellation

Business Rule

At any point during a betting window (HOLE, FLOP, TURN), the player may cancel pending bets. Cancellation:
  • Removes pending bets from the display
  • Restores the game state to whatever has been committed to the server
Bets are only deducted from credits / committed to the server at different points per version:
  • JS / TS: Bet is reflected immediately in UI; TS deducts credits immediately, JS deducts in batch at CC_DEDUCT_BETS
  • UMA: Bets are NOT committed to the API until the Deal button (spin) is pressed; cancel before Deal results in zero committed bets for the current stage

JavaScript Reference

Source: hedgeem-v4/odobo/src/js/buttons.js
  • CancelButtonPressed() calls ClearRoundBets() which zeros handBetValue[hand][GetDealStatus()] for all hands at the current deal stage.
  • Credits have not yet been deducted (deduction happens at CC_DEDUCT_BETS), so cancel is a pure UI reset.
  • Cancel scope: current stage only, all hands

TypeScript Implementation

Source: standalone_reference_client/src/engine/GameEngine.ts
  • Per-hand cancel button calls cancelBets(handIndex) which removes bets for that hand from all stages and refunds credits immediately.
  • Cancel scope: all stages, per-hand (intentional difference from JS — see F011 design differences)

UMA Implementation

Source: gameClient/builds/hedgeem/platform.js Cancel is triggered when game.min.js sends a connect:GameRequest with any non-spin action (typically action: 'cancel'). Platform.js responds by:
  1. Fetching /api/tables/{tableId}/state (the current committed server state)
  2. Rebuilding buildGameStatus(currentHoleState, state) from the API response
  3. Re-publishing Api:action:dataReceived with the refreshed state
  4. Setting window._cancelRefreshDone = true
Since bets are only sent to the API at spin time (Deal button press), cancel before any spin always produces a zero-bet state. Cancel after a spin preserves any bets already committed in prior stages.
Test helper: window._platformApi.triggerCancel() fires the cancel packet directly, bypassing the need to click the GDK cancel button.

Acceptance Criteria

UMA-testable ACs (via state bridge)

Version Parity

Test Coverage

Playwright spec: tests/features/F012-bet-cancellation.spec.ts — AC1–AC5 (UMA). Run with:
  • F011 — Bet Placement (bets that cancel would remove)
  • F010 — Chip Denominations (the chip value that was pending)
  • F016 — Credits Wallet (TS only: cancel refunds credits immediately)