Skip to main content

Shop/Cashier → Player (Counter Deposit)

Phase 2 trong chuồi Cash Settlement — sau Phase 1 hierarchy (Admin → SA → Agent → Shop).

Player đưa tiền tại quầy → Shop/Cashier xác nhận → credit cộng vào player wallet, shop CDN wallet bị trừ tương ứng.

Player đưa cash → Cashier/Shop xác nhận → credit vào Player → ghi sổ đối soát (Cash In)

Luồng redemption (Player đổi credit lấy tiền mặt) là Phase 3 riêng: Player → Shop/Cashier.

Mockup: Phase 2 — Deposits tab · Cashier spec: Cashier Management spec


Vị trí trong hệ thống

flowchart LR
subgraph P1["Phase 1"]
AG[Agent] --> SH[Shop CDN wallet]
end
subgraph P2["Phase 2"]
SH --> P[Player wallet]
end
subgraph P3["Phase 3"]
P --> SH2[Shop — redemption]
end
P1 --> P2
P2 -.-> P3

Shop phải có đủ credit trong CDN wallet (từ Phase 1 Agent→Shop) trước khi cấp credit cho Player.

Khác Phase 1 hierarchy: deposit counter auto-settled khi complete — cash và credit di chuyển đồng thời, V1 không công nợ tạm.


Ai làm gì

Vai tròHành động
PlayerĐưa tiền tại quầy; nhận credit ngay sau khi Cashier/Shop xác nhận
CashierTìm player, nhập số tiền/credit, xác nhận deposit (cash only, trong active shift)
Shop ManagerCó thể add credit thủ công từ Shop portal (cash / card / bank transfer)
Hệ thốngDebit shop CDN wallet, credit player wallet, ghi audit, cập nhật shift Cash In

Hai kênh thực hiện

KênhVai tròĐiều kiệnAPI
Cashier portalCashier tại quầyActive shift bắt buộc; cash onlyPOST /cashier/players/:id/deposit
Shop portalShop ManagerKhông bắt buộc shiftPOST /shop/players/:id/credits (action: add)

Cashier path ghi cashier_transactions (shift reconciliation). Shop Manager path ghi shop_action_logs. Cả hai chưa ghi cash_transactions ledger (target Phase 2).


Thông tin bắt buộc

Cashier portal (V1)

TrườngBắt buộcMô tả
PlayerPlayer thuộc shop
Số credit / số tiềnV1: 1:1 — 50 credits = $50 cash
Hình thức✅ (cố định)cash
Shift / Cashier / Device✅ (hệ thống)Tự gắn từ session + active shift

Shop portal (manual add)

TrườngBắt buộcMô tả
PlayerPlayer thuộc shop
Số creditSố dương, > 0
payment_methodcash | card | bank transfer
actionadd

Công thức tiền & margin

V1 counter deposit: 1 credit = $1 USD (face value cho Player).

Chỉ sốCông thức
Cash received (expected)credit_amount
Shop CDN costcredit_amount × shop.costRate (snapshot)
Shop gross margincredit_amount × (1 − shop.costRate) — metadata báo cáo

Ví dụ: cost rate 0.80, deposit 50 credits:

MụcGiá trị
Cash received$50.00
Shop CDN cost$40.00
Gross margin$10.00
Shop CDN wallet−50
Player wallet+50

Counter deposit luôn debit wallet shop hiện tạieffectiveLevel chỉ snapshot báo cáo.


Quy tắc nghiệp vụ

  1. Player thuộc shop, không bị ban.
  2. Shop có đủ credit CDN wallet.
  3. Cashier: active shift bắt buộc; không OTP.
  4. Sau complete: không sửa / hủy / reverse.
  5. cashDelta = +amount (cash) → Cash In trong shift.

Ledger đề xuất (cash_transactions)

FieldValue
flowshop_player_deposit
sellershop / shop uuid
buyerplayer / player uuid
expected_cash= credit_amount (1:1 V1)
statuspaid_full (auto)

Links: payment_transaction_id, wallet txs, cashier_transaction_id (cashier path), shift_id.


Backend hiện tại

Cashier: cashierTransactionBizService.depositCredits
→ playerCreditPort.transferCreditsAtCounter (deposit)
→ shopPlayerBizService._adjustCreditsAdd
→ walletTransferService (shop → player)
→ PaymentTransaction (provider: shop_player_cash)
→ CashierTransaction (type: deposit_credits)

Shop: shopPlayerBizService.adjustPlayerCredits (action: add)
→ cùng _adjustCreditsAdd (không qua shift)

API

Đã có

MethodEndpointBody
POST/api/cashier/players/:id/deposit{ "amount": number }
POST/api/shop/players/:id/credits{ "action": "add", "amount": N, "payment_method": "cash" }

Target Phase 2

MethodEndpointMô tả
GET/api/shop/cash-transactions?flow=shop_player_depositList deposits
GET/api/shop/cash-transactions/:idDetail
GET/api/shop/cash-transactions/exportCSV

UI đề xuất (Shop portal)

Tab Receivable — Deposits trên mockup phase2-counter:

  • Summary: Counter Cash In, Gross margin (today)
  • Bảng: player, cashier, credits, cash received, margin, receipt
  • Detail view-only

Cashier portal: tx nằm trong Active Shift — không cần ledger riêng V1.


Hiện trạng

Thành phầnTrạng thái
Wallet transfer shop → player
payment_transactions + cashier_transactions
cash_transactions flow shop_player_deposit
Shop portal deposit ledger

Tasks: tasks-shop-cashier-to-player


Liên quan