# MVP-TASK-025 — Current-day commercial gross total

**Status:** In progress

**Parent:** MVP-SALES-001-S01

## Objective and required behavior

Calculate and display persistent gross SEK total for successful commercial orders in the configured
local calendar day, counting each finalized sale exactly once.

## Scope, areas, and non-goals

Expected application query/repository/API/top KDS ticker and tests. Define/test timezone day
boundaries explicitly. No external accounting, reports, refunds, or analytics dashboard.

## Evidence and acceptance

Use `MVP-SALES-001-S01` in boundary-focused integration and tablet E2E. Accept when durable
confirmed orders drive total without session-local counters or duplication, traceability/contracts
are current, and inherited DoD passes. Handoff records timezone configuration and money aggregation.

## Implementation evidence

- `postgres-order-repository.integration.test.ts` places finalized facts at the configured local
  midnight, immediately before it, at the following midnight, and within the day, proving the
  half-open boundary, commercial-only selection, exact snapshot sum, and repeat-read stability.
- `kds.spec.ts` records the authenticated total before a successful commercial checkout and proves
  both the API and persistent tablet ticker increase by exactly that order's finalized gross.
- `order-http.test.ts`, `order-api.test.ts`, and `KdsPage.test.tsx` cover the authenticated
  contract, browser boundary, and persistent top-region rendering.
- `order-service.test.ts` proves the use case returns the repository's figure unchanged and prices,
  charges, and writes nothing, which is what keeps the aggregate a single durable read.
- `order-http.test.ts` also proves an anonymous caller is answered `401` for the sales read and that
  the read never runs on their behalf, so the day's commercial figures are not exposed.
- `kds.spec.ts` waits for the signed-in screen before reading the sales API. The previous ordering
  raced the sign-in navigation commit, so the session cookie did not exist yet and the read was
  answered `401` deterministically in the isolated Docker stack on both browser projects.
