POS - Operational Workflows & State Machines
Cashier shift lifecycle, high-speed checkout flow, and state transition tables for POS sessions and receipts.
Operational Workflows & State Machines
The POS domain executes retail operations through clearly defined workflows and state transitions. Cashier shifts and individual receipts each follow controlled lifecycles that enforce business invariants and preserve cash accountability.
1. Cashier Shift Lifecycle
The following diagram illustrates the complete operational cycle of a cashier shift, from clock-in through reconciliation and close.
flowchart TD
A[Cashier Clock-in] --> B[Select Terminal]
B --> C[Count Opening Float]
C --> D{Float Matches Expected?}
D -->|Yes| E[Open Session]
D -->|No| F[Record Variance with Supervisor]
F --> E
E --> G[High-Velocity Sales / Returns]
G --> H[Mid-Shift Cash Drop]
H --> I[More Transactions]
I --> J[Count Closing Cash]
J --> K{Reconcile Expected vs. Actual}
K -->|Balanced| L[Close Session]
K -->|Overage / Shortage| M[Record Discrepancy]
M --> L
L --> N[End-of-Day Settlement]
Shift Stage Descriptions
| Stage | Description | Key Domain Event |
|---|---|---|
| Clock-in | Cashier authenticates at the terminal or store system. | CashierAuthenticated |
| Opening Float Count | Cashier counts and declares cash in drawer at shift start. | OpeningFloatDeclared |
| Session Opened | Terminal session activated; drawer unlocked for transactions. | PosSessionOpened |
| Transaction Activity | Sales, refunds, voids, drops, and petty expenses occur. | PosSaleCompleted, PosSaleRefunded, PosCashDropRecorded |
| Cash Drop | Excess cash removed to safe during shift. | PosCashDropRecorded |
| Closing Count | Cashier counts cash at shift end. | ClosingCashDeclared |
| Reconciliation | Expected vs. actual cash compared; discrepancy recorded. | PosSessionClosed |
| Settlement | Aggregated totals sent to FMS for deposit and ledger posting. | PosSessionClosed |
Opening Float Exception
If the physical opening float does not match the expected float from the prior session:
| Scenario | Action |
|---|---|
| Shortage from prior close | Record variance with supervisor approval; prior session discrepancy adjusted via compensating journal. |
| Overage from prior close | Record variance; excess may be deposited or counted as current session float. |
| Unexplained difference | Session may still open with documented variance; investigation initiated. |
2. High-Speed Checkout Flow
The following diagram illustrates the typical checkout transaction from scan to receipt.
flowchart TD
A[Item Barcode Scan] --> B[Retrieve Product Snapshot]
B --> C[Add Line Item]
C --> D{Discount / Modifier?}
D -->|Yes| E[Apply Discount / Modifier]
D -->|No| F[Subtotal Calculation]
E --> F
F --> G[Tax Calculation]
G --> H[Display Total]
H --> I[Select Tender Type]
I --> J{Split Tender?}
J -->|Yes| K[Capture Multiple Tenders]
J -->|No| L[Capture Single Tender]
K --> M[Validate Total Coverage]
L --> M
M --> N[Calculate Change]
N --> O{Payment Authorized?}
O -->|Yes| P[Print Receipt / Open Drawer]
O -->|No| Q[Prompt for Alternative Tender]
Q --> I
P --> R[Emit Completion Event]
Checkout Stage Descriptions
| Stage | Description | Business Rule |
|---|---|---|
| Barcode Scan | Product identified by barcode or manual lookup. | Product must exist in local cache; price snapshot loaded. |
| Line Item Added | Quantity and unit price added to receipt. | Quantity must be positive. |
| Discount / Modifier | Price adjustment or option applied to line. | Discount authorization may be required. |
| Tax Calculation | Taxes computed by product category and jurisdiction. | Tax rules active at sale time applied. |
| Tender Selection | Customer chooses payment method(s). | Tender type must be allowed at terminal. |
| Total Coverage | System validates that tenders cover total. | Transaction cannot complete if underpaid. |
| Change Calculation | Cash change computed if applicable. | Change must be non-negative. |
| Payment Authorization | Card/wallet payments authorized by acquirer. | Offline mode may queue authorization. |
| Receipt Issuance | Receipt printed or emailed. | Receipt snapshot frozen. |
Void and Cancel Handling
| Action | Timing | Effect |
|---|---|---|
| Void Line Item | Before payment | Removes line from receipt; no inventory or financial impact yet. |
| Cancel Receipt | Before payment | Abandons entire transaction; no receipt issued. |
| Refund / Return | After payment | Creates separate return receipt; reverses sale and restores inventory. |
3. POS Session State Transition Table
| Current State | Trigger / Event | Next State | Business Validation Rule |
|---|---|---|---|
| Locked | Cashier authenticates and selects terminal. | Pre-Session | Identity verified; terminal available. |
| Pre-Session | Opening float counted and declared. | Float Declared | Float amount is non-negative and recorded. |
| Float Declared | Supervisor approves variance (if any). | Open | Drawer assigned; session activated. |
| Open | First transaction initiated. | Active | Session is ready for sales. |
| Active | Transaction completed. | Active | Transaction added to session ledger. |
| Active | Cash drop performed. | Active | Drop reason and amount recorded. |
| Active | Petty expense recorded. | Active | Expense reason and amount recorded. |
| Active | Closing count initiated. | Closing | No new transactions allowed. |
| Closing | Closing cash count entered. | Reconciling | Expected vs. actual cash compared. |
| Reconciling | Discrepancy accepted or zero. | Closed | Session sealed; totals finalized. |
| Active | Supervisor initiates forced close. | Forced Closed | Forced close reason recorded; discrepancy accepted. |
| Any active state | Terminal or application crash. | Recovery Pending | Session restored from local state; transactions replayed. |
| Recovery Pending | Local state validated. | Previous active state | Session continues or closes under supervision. |
4. POS Receipt State Transition Table
| Current State | Trigger / Event | Next State | Business Validation Rule |
|---|---|---|---|
| Draft | Items scanned or added. | In Progress | Line items present; total calculated. |
| In Progress | Line item voided. | In Progress | Void recorded; total recalculated. |
| In Progress | Entire receipt cancelled. | Cancelled | No payment processed; cancellation audited. |
| In Progress | Tender selected and validated. | Awaiting Payment | Total coverage confirmed. |
| Awaiting Payment | Payment authorized or cash accepted. | Paid | Non-negative change calculated. |
| Awaiting Payment | Payment declined. | In Progress | Alternative tender required. |
| Paid | Receipt printed or emailed. | Completed | Receipt snapshot frozen; completion event emitted. |
| Completed | Customer requests return. | Return Initiated | Original receipt referenced; return eligibility verified. |
| Return Initiated | Items accepted and refund tendered. | Refunded | Separate return receipt created; inventory restored. |
| Completed | Manager voids receipt after close. | Voided by Return | Return receipt created; original remains visible. |
5. Offline Transaction Workflow
When a terminal loses connectivity, it continues operating using local state and queues transactions for replay.
flowchart TD
A[Network Disconnection Detected] --> B[Switch to Offline Mode]
B --> C[Use Local Product / Price Cache]
C --> D[Assign Monotonic Sequence]
D --> E[Store Transaction Locally]
E --> F[Issue Local Receipt]
F --> G{Network Restored?}
G -->|No| H[Continue Offline Operation]
H --> D
G -->|Yes| I[Replay Queued Transactions]
I --> J{Sequence Valid?}
J -->|Yes| K[Central Acceptance]
J -->|Gap / Duplicate| L[Conflict Resolution]
L --> M[Manual Review or Auto-Reconciliation]
M --> K
K --> N[Sync Completed]
Offline Operational Rules
| Rule | Invariant |
|---|---|
| Cache Freshness | Local cache is refreshed when online; stale cache must be flagged after a configured age. |
| Sequence Continuity | Offline transactions continue the same monotonic sequence as online transactions. |
| Local Receipt Issuance | Customers receive a local receipt; central receipt number may be assigned on sync. |
| Stock Indicator | Local stock indicators may be decremented optimistically; central WMS reconciles on sync. |
| High-Risk Tenders | Some tender types (e.g., gift cards, store credit) may be blocked offline if balance cannot be verified. |
6. Cash Drop Workflow
Cash drops reduce drawer exposure by moving excess cash to a safe during the shift.
flowchart TD
A[Drawer Cash Exceeds Threshold] --> B[Cashier Initiates Drop]
B --> C[Supervisor Authorization]
C --> D[Count Drop Amount]
D --> E[Place Cash in Safe]
E --> F[Record Drop Slip]
F --> G[Update Drawer Expected Balance]
G --> H[Emit PosCashDropRecorded]
Cash Drop Rules
| Rule | Invariant |
|---|---|
| Threshold Policy | Drops may be triggered automatically when drawer cash exceeds a configured threshold. |
| Dual Control | Drops typically require cashier and supervisor verification. |
| Immediate Log | Drop amount and timestamp are recorded immediately, before cash leaves the drawer. |
| Safe Receipt | Physical safe receipt or slip number is captured for audit. |
7. End-of-Day Settlement Workflow
After all sessions in a store are closed, totals are aggregated for financial settlement.
| Settlement Element | Source |
|---|---|
| Gross Sales | Sum of all completed sale receipts across sessions. |
| Refunds | Sum of all return/refund receipts. |
| Net Sales | Gross Sales minus Refunds. |
| Cash Collected | Cash tenders minus cash refunds and change. |
| Card Collected | Card/digital wallet tenders minus refunds. |
| Other Tenders | Gift cards, store credit, checks, etc. |
| Tax Collected | Sum of tax lines by category. |
| Cash Discrepancies | Sum of overages and shortages across sessions. |
| Depositable Cash | Cash collected minus drops and petty expenses, adjusted for discrepancies. |
Settlement Reconciliation
$$ \text{Depositable Cash} = \text{Opening Floats} + \text{Cash Sales} - \text{Cash Refunds} - \text{Cash Drops} - \text{Petty Expenses} \pm \text{Net Discrepancy} $$
The settlement payload is emitted to FMS via the PosSessionClosed event for ledger posting and bank deposit reconciliation.
8. Exception Handling
| Exception | Handling Rule |
|---|---|
| Cashier unable to reconcile drawer | Supervisor reviews discrepancy; session may be forced closed with documented reason. |
| Terminal crash during active session | Session state recovered from local cache; transactions replayed; session continues or closes under supervision. |
| Product not found in local cache | Cashier may use fallback lookup or escalate; transaction may be queued offline if central lookup fails. |
| Payment terminal offline | Cash tender encouraged; card transactions may be queued for offline authorization where acquirer supports it. |
| Customer disputes change | Audit trail of tender and change calculation reviewed; receipt is authoritative. |
| Duplicate receipt printed | Reprint audited; no financial duplicate created. |
These workflows and state machines ensure that every retail transaction is executed, recorded, and reconciled through a consistent, auditable, and invariant-preserving process.