2.8 KiB
2.8 KiB
F-188 — Implementer evidence
Delivered
- Backend:
validatePaymentAllocationsaccepts under-allocated amounts and rejects only overpayments (POS_PAYMENT_OVERPAYMENT, replacingPOS_PAYMENT_TOTAL_MISMATCH). - Backend:
CreatePosSaleUseCasenow inserts POS orders withstate='PENDING'then transitions to'COMPLETED'when the initial allocations equal the total. Response gainsstate,paidCents,outstandingCents. - Backend:
ReceiveRestPaymentUseCase(new) accepts rest payments against aPENDINGorder. Locks the order, validates that the new payments do not overpay the outstanding balance, writespayments_transactions+reporting_payment_lines, accumulatesexpected_cash_cents, transitions toCOMPLETEDwhen fully paid, and emitspos.sale.partial/pos.sale.fulfilledaudit events. Idempotency-keyed retries do not duplicate transactions. - Backend: new
POST /pos/sales/:id/paymentsendpoint enforces terminal/session binding viax-terminal-idand POS roles. - Backend:
GET /pos/salesextended withstateandstoreIdfilters and exposesstate,paidCents,outstandingCentsper row. - Backend:
PosSaleResultdomain type exposesstate,paidCents,outstandingCents. - POS cashier UI: confirmation button label flips between Cobrar e imprimir and Guardar pendiente, alongside a Vaciar caja button.
- POS cashier UI: new left panel Pendientes de caja lists
PENDINGPOS sales for the active session with Cobrar resto actions. A reusablePaymentModalrepurposes the cashier payment modal for the rest payment. - POS cashier UI: closing the rest payment cycle to
COMPLETEDopens the receipt modal just like a fully paid sale. - Tests: real PostgreSQL
pos-pending-payments.itest.ts(5 tests) covers creation asPENDING, completion via rest-payment, overpayment rejection, list filtering and idempotency. Updated payment-allocation unit test (4 tests).
Validation
- Backend, POS, admin typecheck: PASS.
- Backend, POS, admin production build: PASS.
- Real-PostgreSQL sequential suite: 360/360 PASS across 80 files.
- Backend unit tests after update: 268/268 PASS.
- POS unit tests + new integration: 5/5 PASS.
- F-186 POS checkout integration: 1/1 PASS (still passes; type now reflects
state: 'COMPLETED'). - Migration cycle: 4/4 PASS.
- Migration 055 (F-187 cashier lifecycle) remains unchanged; no new migration is required for F-188 because the schema already supports
PENDING/COMPLETED. - Targeted ESLint + Prettier on every changed file: PASS.
./scripts/verify.sh: PASS.
Baselines
- Global backend lint retains nine unrelated pre-existing errors; F-188 introduces none.
- Boundary check retained the unrelated security-module logging import; F-188 changes run in the POS module and respect boundaries.
- Untracked upload JPGs stay excluded from the feature commit.