POS

POS - Introduction & Executive Overview

Strategic architectural overview of the Point of Sale (POS) domain, exploring offline-first edge checkouts, cash till float controls, barcode scanning buffers, and shift reconciliation.

Point of Sale (POS) & Retail Checkout Domain Design

In retail storefronts, customer satisfaction and operational viability depend on sub-second checkout speeds and zero hardware downtime. When a customer stands before a store cashier with a basket of goods, network latency, central database lockouts, or cloud disconnections cannot be permitted to halt transactions. Retail cash registers must scan optical barcodes instantaneously, process complex promotional discounts, accept split multi-tender payments, print receipts, and balance physical cash drawers with absolute reliability.

The Point of Sale (POS) domain operates as the sovereign authority governing frontline retail sales and register station operations. It manages physical Register Station aggregates, Cashier Work Shifts, optical scanner keyboard buffers, local offline cart state machines, split tender payments (Cash, Credit Card, Gift Card, Loyalty Points), and blind cash till reconciliations.

By establishing an independent, offline-resilient Bounded Context, edge retail checkout registers operate autonomously without direct synchronous dependencies on central enterprise databases, warehouse fulfillment queues, procurement vendor contracts, or general ledger postings.


1. Business Drivers & The Frontline Retail Vulnerability

When retail store operations are architected as fragile web clients directly querying a central enterprise database, register lanes inevitably face catastrophic store-wide outages:

flowchart TD
    subgraph Antipattern["Without POS Domain: Fragile Central Coupling"]
        CloudOutageHalt["Cloud Outage Freeze<br/>Internet hiccups or latency freezing cash registers, creating massive customer queues"]
        CashTheftDrift["Unmeasured Till Discrepancies<br/>Cashiers handling cash without blind counting, hiding register shrinkage and theft"]
        ConcurrentCartLocks["Central Lock Contention<br/>POS checkouts competing with online web shoppers for database row locks"]
        CorruptedTenders["Unbalanced Multi-Tender<br/>Network timeouts dropping split card transactions while cash has already been taken"]
    end

    subgraph Solution["With POS Domain: Autonomous Offline-First Architecture"]
        EdgeAutonomy["Offline-First Edge Resilience<br/>Registers complete checkouts locally using cached catalog snapshots and barcode lookups"]
        BlindCountEnforcement["Blind Shift Reconciliation<br/>Cashiers enter physical counts without knowing system totals, enforcing honesty"]
        LocalStateMachines["Isolated Cart State Machines<br/>High-velocity sub-second scanning isolated from central enterprise database contention"]
        AtomicTenderEquation["The Zero-Tender-Balance Law<br/>Receipts commit only when Total Tender Tendered equals Total Payable exactly"]
    end

    Antipattern -.->|Solved By Domain-Driven Design| Solution

The Cost of Retail Frontend Fragility

  • Network-Induced Store Shutdowns: If a retail POS station relies on synchronous network HTTP calls to a central database for every barcode scan or price calculation, an internet outage shuts down the entire store, causing lost revenue and walkouts.
  • Cash Drawer Shrinkage: Without disciplined cash till float governance (logging starting cash, paid-in/paid-out pet cash, and blind closing counts), till shortages cannot be attributed to specific cashier shifts.
  • Scanner Latency & Keyboard Buffer Drops: Rapid barcode scanning at grocery or apparel checkout lanes produces high-frequency keyboard events. Without dedicated scanning buffers and local catalog caching, scans are dropped, irritating customers.
  • Split Payment Desynchronization: Accepting partial cash and partial credit card payment without atomic tender balance validation leads to underpaid tickets and unbalanced accounting ledgers.

Domain-Driven Design resolves frontline retail challenges through local edge autonomy, the Zero-Tender-Balance Law, and deterministic shift lifecycle state machines.


2. Core Strategic Pillars of the POS Domain

The POS bounded context is anchored by seven foundational architectural pillars:

flowchart TD
    POS["POS Domain Core"]

    P1["1. Offline-First Autonomy<br/>Registers complete sales regardless of cloud connectivity"]
    P2["2. The Zero-Tender-Balance Law<br/>Sum of payment tenders must exactly match ticket total"]
    P3["3. Shift & Till Float Governance<br/>Opening floats, cash drops, and blind end-of-shift counts"]
    P4["4. Optical Scanner Buffer Engine<br/>Sub-second barcode lookups and scale weight integrations"]
    P5["5. Atomic Multi-Tender Splitting<br/>Cash, card, vouchers, and loyalty points in one transaction"]
    P6["6. Asynchronous Event Synchronization<br/>Store sales and till events batched and reconciled upstream"]
    P7["7. Void & Return Compensating Audits<br/>Supervisor authorization gates and return credit notes"]

    POS --> P1
    POS --> P2
    POS --> P3
    POS --> P4
    POS --> P5
    POS --> P6
    POS --> P7

1. Offline-First Register Autonomy

Registers maintain a local, high-speed read cache of the store’s product catalog, optical GTIN barcodes, and tax rules. If the store’s WAN connection drops, the register continues scanning items, calculating totals, accepting cash, and issuing receipts without interruption.

2. The Zero-Tender-Balance Law

A checkout ticket cannot transition to Completed until total tendered payments satisfy the exact balance identity: $\sum \text{Tenders} - \text{Change Given} = \text{Gross Ticket Total}$. Tickets with unpaid fractions are held open.

3. Shift & Till Float Lifecycle

Register operations are framed within cashier Shifts. A shift begins with a verified cash float, logs cash drops (moving excess banknotes to the store safe), and concludes with a Blind Cash Count before generating the terminal Z-Report.

4. Optical Scanner & Scale Integration

The register cart engine captures rapid keyboard wedge scanner events, barcode lookup aliases, and certified tare-weight scale inputs without triggering slow network round-trips.

5. Multi-Tender Splitting Engine

Transactions allow customers to split payments across multiple tenders (e.g., $$50$ cash, $$25$ gift voucher, and the remainder on a credit card). Each tender executes its own state machine and settlement receipt.

6. Asynchronous Store Synchronization

When connectivity is available, registers publish transactional domain events (POSSaleCompleted, TillShiftReconciled, CashDropRecorded). Downstream enterprise contexts consume these events to update warehouse inventory and post financial journals.

7. Supervised Voids & Compensating Returns

Removing an item after scanner registration or voiding an active ticket requires supervisor authorization. Returns are tied to the original receipt barcode or processed as compensating store credits, logging an immutable audit record.


3. High-Level Inter-Domain Choreography

The POS context acts as an edge transactional engine that synchronizes sales and cash movements with enterprise domains:

flowchart TD
    POS["Point of Sale (POS)<br/>Offline Register Stations & Tills"]

    PIM["PIM / Catalog<br/>Barcodes & Prices"]
    Sales["Sales / OMS<br/>Omnichannel Order Ingestion"]
    Inventory["Inventory / WMS<br/>Store Backroom Replenishment"]
    FMS["Accounting / FMS<br/>Cash Clearing & Over/Short"]

    PIM -->|"VariantBarcodeAssigned, PriceListPublished"| POS
    POS -->|"POSSaleCompleted"| Sales
    POS -->|"POSStockDepleted"| Inventory
    POS -->|"TillSettled, CashDropRecorded"| FMS
    Inventory -->|"StoreTransferDispatched"| POS
Integrating ContextHandled InteractionDownstream Operational Materialization
PIM / CatalogConsumes VariantBarcodeAssignedIngests new optical barcodes and product aliases into the local edge register lookup cache.
Sales / OMSEmits POSSaleCompletedIngests store sales into the central enterprise order repository for unified customer purchase histories.
Inventory / WMSEmits POSStockDepletedDecrements store backroom and shelf inventory; triggers automated store replenishment transfer orders.
Accounting (FMS)Emits TillSettledDebits Cash in Transit and credits Cash Sales; books cashier over/short discrepancies to expense accounts.
Accounting (FMS)Emits CashDropRecordedRecords bank deposits or internal vault transfers from the register till to the store safe.

4. Architectural Domain Blueprint Directory

Explore the tactical models, invariants, and workflows across the POS domain chapters:

  1. Bounded Context & System Boundaries: Frontline retail scope, edge boundaries, out-of-scope concerns, and Anti-Corruption Layer (ACL) translation interfaces.
  2. Ubiquitous Language & Domain Glossary: Canonical retail terminology, register states, tender types, and cash drawer vocabulary.
  3. Structural Topology & Domain Model: Store and register station topologies, cashier shift aggregates, cart line models, and payment tender entities.
  4. Domain Invariants & Business Rules (“The Law”): The Zero-Tender-Balance Law, offline idempotency keys, till float limits, and line item void authorization rules.
  5. Operational Workflows & State Machines: Cashier shift opening, barcode scanning loops, split payment tenders, cash drops, and shift closing (Z-Report) workflows.
  6. Domain Events & Integration Contracts: Authoritative catalog of emitted POS domain events, offline synchronization batches, and downstream payload schemas.
  7. Audit Trail, Governance & Compensation: Cash discrepancy reconciliation, till shortage forensic auditing, price override tracking, and refund compensation strategies.

Our Premium Sponsors

Obelaw is proudly open-source. Continued development, bug fixes, and community support are made possible by the generosity of our sponsors.

Sponsor Obelaw