Files
mercadodevida/work/current.md
2026-08-23 07:51:56 +02:00

27 lines
1.7 KiB
Markdown

# F-191 — POS terminal and daily cash close reconciliation
Design and implement terminal and daily cash close balancing: card/cash returns and pending payments.
## Scope
- POS cashiers can **close their session** (cash close): finalize expected vs actual cash count, handle over/short.
- `POST /pos/sessions/:id/close` accepts `actualCashCents` and calculates `varianceCents = actualCashCents - expectedCashCents`. Stores `varianceCents` and `closedAt` on `pos_cash_sessions`.
- Closed sessions can no longer accept new sales or rest-payments.
- `GET /pos/sessions/:id` returns session summary including total sales, cash received, expected cash, variance.
- `GET /pos/sessions` lists all sessions (open and closed) for a terminal or store.
- Admin view: list all cash sessions across terminals with variance. Filter by date range, store, terminal.
- `expected_cash_cents` is already maintained atomically by sale/rest-payment/return operations.
- Pending (PENDING state) POS orders from a closed session are still payable via rest-payment from an OPEN session (separate session, same terminal).
## Out of scope
- Bank deposit slip generation.
- Multi-terminal reconciliation in a single close.
- Automatic variance alerts (out of scope, can be added later).
## Acceptance
1. Cashier can close an open session; session transitions to `CLOSED` and `expected_cash_cents` is frozen.
2. Closing with exact cash (variance=0) is accepted without warning.
3. Closing with over/short is accepted; variance is stored and visible in admin session list.
4. No new sales can be started on a closed session.
5. Pending orders from a closed session can still be completed via rest-payment from an open session.
6. `verify.sh` green, typecheck green, all tests pass.