POS

POS - Structural Topology & Register Modeling

Retail topology hierarchy, payment split structure, and offline-first edge architecture for the POS domain.

Structural Topology & Register Modeling

The structure of the POS domain is built around three integrated models: the retail store topology, the payment and receipt structure, and the offline-first edge architecture. Together they define how terminals, sessions, drawers, transactions, and tenders are organized and reconciled.


1. Retail Topology: Store → Register → Drawer → Shift → Transactions

The retail topology models the physical and operational hierarchy of a point-of-sale environment.

Store / Branch
└── Register / Terminal Station
    ├── Active Drawer
    │   ├── Shift Session
    │   │   ├── Opening Float
    │   │   ├── Transactions (Sales, Refunds, Voids)
    │   │   ├── Cash Drops
    │   │   ├── Petty Expenses
    │   │   └── Closing Count
    │   └── Cash Movements
    └── Hardware Peripherals
        ├── Barcode Scanner
        ├── Receipt Printer
        ├── Payment Terminal
        ├── Customer Display
        └── Cash Drawer Lock

Topology Levels

LevelDescriptionKey Attributes
Store / BranchThe physical retail location where registers operate.Store code, address, timezone, business hours, tax jurisdiction.
Register / TerminalThe physical POS device assigned to a station.Terminal ID, hardware profile, status (online/offline), store assignment.
Terminal StationThe logical configuration of a register for a specific counter or department.Station code, default drawer, allowed tender types, receipt template.
Active DrawerThe cash container currently assigned to a session.Drawer ID, opening float, current expected balance.
Shift SessionThe cashier’s work cycle on a drawer.Session ID, cashier, open time, close time, state.
TransactionA single sale, refund, or cancellation event.Receipt number, sequence, timestamp, line items, tenders.

One Terminal, One Active Session Rule

A terminal may have only one active shift session at a time. A new session cannot be opened until the previous session is properly closed and reconciled, except under supervised exception protocols.


2. Receipt & Payment Structure

A POS receipt is the central document of a checkout transaction. It captures line items, modifiers, discounts, taxes, and one or more tender payments.

Master POS Receipt
├── Store / Terminal / Session References
├── Line Item Snapshots
│   ├── Product Code / Barcode
│   ├── Description
│   ├── Quantity
│   ├── Unit Price
│   ├── Modifiers
│   ├── Discounts
│   └── Tax Category
├── Tax Breakdown
│   ├── Tax Category A: 5.00
│   └── Tax Category B: 8.00
├── Total Amount
└── Tender Payments
    ├── Cash: 50.00
    ├── Card: 30.00
    └── Store Credit: 10.00
        └── Change Due: 5.00 (Cash)

Receipt Components

ComponentPurpose
Receipt NumberUnique identifier for the transaction, typically store-terminal-sequence formatted.
Sequence NumberMonotonic terminal-level counter used for ordering and replay.
Line Item SnapshotsFrozen product description, price, tax, and quantity at time of sale.
Tax BreakdownSummary of taxes collected by category or jurisdiction.
Tender PaymentsDetailed record of each payment method and amount.
Change DueAmount returned to customer, always non-negative.
TimestampLocal and UTC timestamps of transaction completion.
Cashier / OperatorIdentity of the session operator who executed the transaction.

Multi-Tender Rules

RuleInvariant
Total CoverageSum of tender amounts must equal or exceed the receipt total before completion.
Change LimitationChange is issued only against cash or cash-equivalent tenders (e.g., not against card overpayment).
Store Credit RestrictionsStore credit may not be refunded as cash unless local regulation requires.
Gift Card Partial UseGift card tender cannot exceed the available stored value; remainder must use other tenders.
Foreign CurrencyIf supported, foreign cash tender is converted at the store’s current exchange rate.

Split Tender Example

Tender TypeAmount
Cash50.00
Credit Card30.00
Store Credit10.00
Total Tendered90.00
Receipt Total85.00
Change Due (Cash)5.00

3. Drawer Cash Movement Model

The drawer is a cash container whose expected balance is computed from all cash movements during the shift.

$$ \text{Expected Cash} = \text{Opening Float} + \text{Cash Sales} - \text{Cash Refunds} - \text{Cash Drops} - \text{Petty Expenses} $$

Drawer Movement Types

Movement TypeDirectionDescription
Opening FloatInInitial cash placed in drawer at shift start.
Cash SaleInCash received from customer sales.
Cash RefundOutCash returned to customer for returns.
Cash Drop / SkimOutCash removed to safe mid-shift.
Petty Expense / Paid OutOutCash disbursed for operational expenses.
Closing Count—Physical cash counted at shift end.

Discrepancy Calculation

$$ \text{Discrepancy} = \text{Actual Closing Cash} - \text{Expected Cash} $$

Discrepancy ValueClassification
PositiveOverage
ZeroBalanced
NegativeShortage

4. Edge & Offline Architecture Model

POS terminals operate as edge nodes with local state and eventual consistency with central systems.

┌─────────────────────────────────────┐
│  POS Terminal (Edge Node)           │
│  ├── Local Product Cache            │
│  ├── Local Price / Tax Cache        │
│  ├── Local Stock Indicator          │
│  ├── Local Transaction Queue        │
│  ├── Monotonic Sequence Counter     │
│  └── Local Drawer State             │
└──────────────┬──────────────────────┘
               │ Sync when online
               ▼
┌─────────────────────────────────────┐
│  Central Obelaw System                 │
│  ├── PIM / Catalog                  │
│  ├── Inventory / WMS                │
│  ├── Sales / OMS                    │
│  ├── Accounting / FMS               │
│  └── CRM / Loyalty                  │
└─────────────────────────────────────┘

Offline-First Principles

PrincipleDescription
Local Cache AuthorityWhile offline, the terminal uses locally cached product, price, and tax data.
Local QueueTransactions are stored locally with monotonic sequence numbers until synchronization.
No Central BlockingCheckout speed is not dependent on central system availability.
Eventual ConsistencyOn reconnection, queued events are replayed to central systems in sequence order.
Conflict DetectionCentral systems detect sequence gaps or duplicates and reject invalid replays.

Monotonic Sequence Rules

RuleInvariant
Per-Terminal UniquenessEvery transaction receives the next ascending integer from the terminal’s sequence counter.
No Gaps AllowedA missing sequence number indicates a lost or un-replayed transaction.
No Duplicate SequencesThe same sequence number cannot be accepted twice from the same terminal.
Immutable After AssignmentSequence numbers are assigned at transaction time and never changed.

Sequence Validation Formula

For a terminal with last accepted sequence $S_{last}$ and a new transaction with sequence $S_{new}$:

$$ \text{Accept if } S_{new} = S_{last} + 1 $$

Gaps require investigation; duplicates are rejected as replays.


5. Local State Synchronization Topics

The terminal synchronizes the following data categories with central systems:

Data CategoryDirectionPurpose
Product MasterDownlinkCache product names, barcodes, tax categories.
Price ListsDownlinkCache current selling prices and discount rules.
Tax RulesDownlinkCache tax rates and jurisdictional rules.
Stock AvailabilityDownlinkDisplay available-to-sell indicators.
Customer AliasesDownlinkSupport loyalty lookup and store credit queries.
TransactionsUplinkReplay completed sales, refunds, and cash movements.
Session ClosuresUplinkSend aggregated settlement data to FMS.
ConfigurationDownlinkUpdate terminal profiles, tender types, and receipt templates.

This topology ensures that POS terminals can deliver fast, reliable checkout service while maintaining accurate, auditable, and eventually consistent integration with the central ERP ecosystem.

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