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)
| # | Task | Notes |
|---|---|---|
| 1.1 | Add flow shop_player_deposit to cash_transaction_flow | Phase 2 ships first; shop_player_redemption may be same migration |
| 1.2 | Add player to hierarchy_owner_type | |
| 1.3 | Nullable columns cashier_transaction_id, shift_id | |
| 1.4 | Update constants/cashTransaction.js | |
| 1.5 | Doc schema-cash-transactions |
Phase 2 — Backend biz (deposit only)
| # | Task | Notes |
|---|---|---|
| 2.1 | createCounterDepositCashTransaction in cashTransactionBizService | seller=shop, buyer=player |
| 2.2 | Hook after shopPlayerBizService._adjustCreditsAdd | Only when transfer succeeds |
| 2.3 | expected_cash = credit_amount; metadata.grossMargin | Snapshot shop.costRate |
| 2.4 | Attach cashier_transaction_id + shift_id from ledgerContext | Cashier path |
| 2.5 | performed_by_type: cashier | shop | |
| 2.6 | Link payment + wallet txs | |
| 2.7 | Idempotency by reqId | |
| 2.8 | Unit tests deposit + margin + cashier link | Do not test redeem here |
Phase 3 — Shop portal API (deposit filter)
| # | Task | Notes |
|---|---|---|
| 3.1 | GET /api/shop/cash-transactions?flow=shop_player_deposit | |
| 3.2 | Detail + export scoped to deposit | |
| 3.3 | Summary: Cash In, gross margin aggregate | Full filter, not page only |
Phase 4 — Shop portal UI
| # | Task | Notes |
|---|---|---|
| 4.1 | Tab Receivable — Deposits | Mockup phase2 deposit tab |
| 4.2 | Summary cards Cash In + Margin | |
| 4.3 | Extend PortalCashTransactionsLedger filter shop_player_deposit | |
| 4.4 | Do not build redemption tab — Phase 3 |
Phase 5 — QA (deposit)
| # | Scenario | Expected |
|---|---|---|
| 5.1 | Cashier deposit 50, cost rate 0.80 | cash tx margin $10; cashDelta +50 |
| 5.2 | Shop manual add (card) | cash tx; no shift link |
| 5.3 | Insufficient shop credit | 400, no cash tx |
| 5.4 | Player wrong shop | 403 |
Order
Schema (1) → Deposit biz hook (2) → Shop API deposit (3) → UI tab Deposits (4) → QA (5)
Then Phase 3 redemption.