Skip to main content

Tasks — Shop/Cashier → Player (Phase 2)

Spec: shop-cashier-to-player · Mockup: Deposits tab

Dependencies: Phase 1 complete (tasks Agent → Shop); Cashier deposit flow (Cashier spec).

V1 scope: Deposit only. Redemption → Phase 3 tasks. Auto-settled, 1:1 cash:credit, detail view-only.


Phase 1 — Schema (shared with Phase 3)

#TaskNotes
1.1Add flow shop_player_deposit to cash_transaction_flowPhase 2 ships first; shop_player_redemption may be same migration
1.2Add player to hierarchy_owner_type
1.3Nullable columns cashier_transaction_id, shift_id
1.4Update constants/cashTransaction.js
1.5Doc schema-cash-transactions

Phase 2 — Backend biz (deposit only)

#TaskNotes
2.1createCounterDepositCashTransaction in cashTransactionBizServiceseller=shop, buyer=player
2.2Hook after shopPlayerBizService._adjustCreditsAddOnly when transfer succeeds
2.3expected_cash = credit_amount; metadata.grossMarginSnapshot shop.costRate
2.4Attach cashier_transaction_id + shift_id from ledgerContextCashier path
2.5performed_by_type: cashier | shop
2.6Link payment + wallet txs
2.7Idempotency by reqId
2.8Unit tests deposit + margin + cashier linkDo not test redeem here

Phase 3 — Shop portal API (deposit filter)

#TaskNotes
3.1GET /api/shop/cash-transactions?flow=shop_player_deposit
3.2Detail + export scoped to deposit
3.3Summary: Cash In, gross margin aggregateFull filter, not page only

Phase 4 — Shop portal UI

#TaskNotes
4.1Tab Receivable — DepositsMockup phase2 deposit tab
4.2Summary cards Cash In + Margin
4.3Extend PortalCashTransactionsLedger filter shop_player_deposit
4.4Do not build redemption tab — Phase 3

Phase 5 — QA (deposit)

#ScenarioExpected
5.1Cashier deposit 50, cost rate 0.80cash tx margin $10; cashDelta +50
5.2Shop manual add (card)cash tx; no shift link
5.3Insufficient shop credit400, no cash tx
5.4Player wrong shop403

Order

Schema (1) → Deposit biz hook (2) → Shop API deposit (3) → UI tab Deposits (4) → QA (5)

Then Phase 3 redemption.