Epic 008 — Full Surfboard ECR integration

Status

In progress (foundation tasks 007-011 complete; ready to start 012).

Purpose

Extend Foodtruck Order so it becomes a proper POS application using Surfboard's Electronic Cash Register (ECR) integration. Foodtruck Order remains the POS application and user interface. Surfboard provides card payments, payment terminal integration, ECR/fiscal cash-register operations, control-unit/fiscal infrastructure, and fiscal reporting. Foodtruck Order integrates directly with Surfboard's APIs. This epic explicitly does not use or plan around Surfboard CheckoutX.

Scope and boundaries

In scope:

Out of scope / non-goals:

Confirmed Surfboard capabilities

Source: Surfboard official documentation and the Surfboard documentation MCP server (https://www.surfboardpayments.com/.well-known/mcp), verified 2026-04-11. See docs/decisions/004-surfboard-integration-discovery.md for the earlier discovery record.

Uncertain capabilities (require investigation/spikes)

  1. Confirm terminal-native Swish flow using Surfboard docs and, if needed, a staging terminal.
  2. Prefer automated path: Swish button -> order with paymentMethod SWISH -> terminal handles Swish -> Foodtruck Order observes completion via status polling/webhook -> ECR sale completed automatically.
  3. If terminal cannot display QR or auto-confirm, fall back to Foodtruck Order displaying a dynamic Swish QR code with exact amount and operator confirmation.
  4. Use manual confirmation only if no automatic verification is possible.

Core requirement: all commercial payments connect to the ECR

Every completed commercial sale must be handled correctly through the Surfboard ECR flow, not merely stored in Foodtruck Order history. The implementation must define and preserve the mapping between Foodtruck Order order, Surfboard order/payment, ECR/fiscal sale, payment method, payment status, and refunds/voids. Idempotency and reconciliation must prevent duplicate fiscal sales under retries, timeouts, delayed responses, and connectivity loss.

Non-commercial checkout

Non-commercial checkout remains entirely outside Surfboard. It must not initiate any payment, create any Surfboard payment or ECR sale, require an open ECR shift, or communicate with the Surfboard API. It completes the operational order and sends it to the queue/history according to existing semantics.

KDS checkout UX

The KDS keeps separate, directly accessible buttons for Card, Swish, Cash, and Non-commercial. No dropdowns, radio selection, multi-step selection, or unnecessary confirmation dialogs. Each button starts its flow directly.

Epic scenarios

ECR-S01 - Commercial card sale is registered in the ECR

ECR-S02 - Commercial cash sale is registered in the ECR

ECR-S03 - Commercial Swish sale is registered in the ECR

ECR-S04 - Non-commercial checkout bypasses Surfboard/ECR

ECR-S05 - Checkout requires an open ECR shift

ECR-S06 - Shift lifecycle

ECR-S07 - End of day / Z-report

ECR-S08 - Cash management

ECR-S09 - Receipt handling

ECR-S10 - Idempotency and duplicate prevention

ECR-S11 - Swish fallback manual confirmation

ECR-S12 - Report retrieval

Environment and configuration

See tasks/README.md and the individual tasks/ECR-TASK-*.md files.

Traceability

Evidence will be recorded per scenario in this epic evidence matrix once implementation tasks are completed. Each task file contains its own acceptance criteria and Mocking Bird requirements.

Scenario Evidence (planned) Status
ECR-S01 Surfboard checkout/fiscal adapter, application, API, Mocking Bird Planned
ECR-S02 Surfboard fiscal adapter, application, API, Mocking Bird Planned
ECR-S03 Surfboard fiscal adapter, application, API, Mocking Bird Planned
ECR-S04 Application/API negative tests Planned
ECR-S05 Adapter/application/API tests, Mocking Bird Planned
ECR-S06 Adapter/application/API tests, Mocking Bird Planned
ECR-S07 Adapter/application/API tests, Mocking Bird Planned
ECR-S08 Adapter/application/API tests, Mocking Bird Planned
ECR-S09 Adapter/application/API/component tests Planned
ECR-S10 Adapter/application tests, Mocking Bird retry scenarios Planned
ECR-S11 Application/API/component tests, Mocking Bird Planned
ECR-S12 Adapter/application tests, Mocking Bird Planned