POS

POS - Audit Trail, Offline Sync & Reconciliation Strategies

Cash drawer discrepancy handling, offline replay policies, immutable audit trails, and compensating strategies for the POS domain.

Audit Trail, Offline Sync & Reconciliation Strategies

The POS domain maintains a comprehensive, immutable audit trail for every shift, transaction, and cash movement. Corrections are achieved through compensating documents rather than record mutation, and offline operations are reconciled through strict replay policies.


1. POS Audit Trail

Every mutation within the POS context is recorded with immutable context. The audit trail supports cash accountability, fraud prevention, regulatory compliance, and operational investigation.

Audit Attributes

AttributePurpose
Actor IdentityIdentifies the cashier, supervisor, system job, or integration process that initiated the action.
TimestampRecords the precise moment of the action in local store time and UTC.
Terminal / RegisterIdentifies the physical terminal where the action occurred.
Session ReferenceLinks the action to a specific cashier shift session.
Origin ContextIdentifies whether the action came from barcode scan, manual entry, supervisor override, or sync replay.
Before / After SnapshotCaptures the state of the session, drawer, or receipt before and after the change.
Reason CodeCaptures the business justification for overrides, voids, discrepancies, and forced actions.

Audit Invariants

  • Audit log entries are append-only. They can never be edited or deleted.
  • Closed sessions retain a complete lineage of opening float, all cash movements, transactions, closing count, and discrepancy.
  • Voided line items, cancelled receipts, and refund transactions are permanently linked to their original context.
  • Supervisor overrides require dual authentication and are recorded with mandatory reason codes.
  • Offline replay events include terminal sequence numbers and conflict resolution notes.

2. Cash Drawer Discrepancy Handling

Drawer discrepancies occur when physical cash does not match the expected balance. Discrepancies are recorded, not overwritten, and resolved through compensating financial documents.

Discrepancy Types

TypeDefinitionTypical Causes
OverageActual cash exceeds expected cash.Incorrect change, unrecorded cash found, customer overpayment.
ShortageActual cash is less than expected cash.Incorrect change, theft, unrecorded paid-out, miscount.
BalancedActual cash equals expected cash.Correct operations and accurate counting.

Discrepancy Recording

At session close, the system computes:

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

Discrepancy ValueClassificationAction
PositiveOverageRecorded as overage; may be deposited or retained per policy.
ZeroBalancedSession closes with no variance.
NegativeShortageRecorded as shortage; may require cashier acknowledgment or payroll deduction per policy.

Discrepancy Resolution Policy

ScenarioResolution
Minor variance within toleranceTolerance applied; no further action.
Variance outside toleranceSupervisor investigation; reason code required.
Pattern of shortagesCashier retraining, disciplinary review, or operational audit.
Suspected theftSecurity review; evidence preserved in audit trail.
System calculation errorCompensating adjustment in FMS; original session remains sealed.

Compensating Variance Journal

Discrepancies are not corrected by editing the session. Instead, FMS posts a compensating journal voucher:

DiscrepancyFMS DebitFMS Credit
OverageCash / Bank AccountOverage Income Account
ShortageShortage Expense AccountCash / Bank Account

This preserves the original session record while reflecting the financial reality in the General Ledger.


3. Offline Sync & Replay Policies

POS terminals must operate reliably during network disconnection. Offline transactions are replayed to central systems when connectivity returns, under strict consistency rules.

Offline Replay Principles

PrincipleDescription
Eventual ConsistencyAll valid offline transactions eventually reach central systems in order.
Monotonic OrderingTransactions replay in strict terminal sequence order.
IdempotencyDuplicate replays do not cause double processing.
Conflict DetectionCentral systems detect and flag conflicts requiring human resolution.
No Silent LossMissing or rejected transactions are explicitly reported, not ignored.

Replay Sequence Validation

For each terminal, the central system maintains the last accepted sequence $S_{last}$. A new transaction with sequence $S_{new}$ is processed as follows:

ConditionAction
$S_{new} = S_{last} + 1$Accept and update $S_{last}$.
$S_{new} \leq S_{last}$ with identical payloadIdempotently acknowledge.
$S_{new} \leq S_{last}$ with different payloadReject as conflict; flag for investigation.
$S_{new} > S_{last} + 1$Reject; require backfill of missing sequences.

Conflict Resolution

When replay conflicts occur, the system applies the following priority:

  1. Customer-Facing Truth: The receipt issued to the customer at the terminal is authoritative for price and tender.
  2. Inventory Truth: WMS reconciles stock based on accepted transactions; conflicts may require manual stock adjustment.
  3. Financial Truth: FMS posts based on accepted session totals; discrepancies are handled as variances.
  4. Manual Override: Authorized supervisors may resolve conflicts with documented reason codes.

Typical Offline Conflict Scenarios

ScenarioCauseResolution
Gift card spent elsewhere while offlineCustomer used same gift card at another channel.Transaction honored if possible; shortfall recovered via alternative tender or store credit.
Store credit exhausted during offline periodCustomer redeemed remaining store credit online.Refund limited to available balance; remainder handled as return credit or cash per policy.
Price changed during offline periodCentral price update occurred while terminal was offline.Original snapshot price honored; price variance logged for margin analysis.
Promotion expired during offline periodDiscount rule no longer valid.Original promotion honored if locally active; promotional variance logged.
Product discontinued during offline periodProduct removed from catalog while terminal offline.Sale honored if local cache was valid; WMS handles final inventory disposition.

4. Compensating Strategies

The POS domain does not allow retroactive editing of closed sessions or completed receipts. Corrections follow formal compensating strategies.

Why Record Destruction Is Forbidden

Deleting POS records would break:

  • The immutable audit trail required for cash and tax accountability.
  • The sequential integrity of terminal transaction numbering.
  • The ability to reproduce historical Z-reports and bank deposits exactly.
  • The trust relationship between cashiers, supervisors, and finance.

Correction Strategies

Correction ScenarioCompensating Document / ActionDescription
Incorrect change givenCash Variance Journal + operational note.Discrepancy recorded at close; FMS posts variance.
Wrong item rung upReturn/Refund Receipt + new sale receipt.Original sale remains; correction processed as separate transactions.
Wrong tender recordedTender Correction Record + FMS adjustment.Original receipt remains; compensating entry posted.
Post-close price disputeRefund/Adjustment Receipt in new session.Original session remains sealed.
Missing cash drop recordDrop Correction Record with supervisor approval.Drop recorded retroactively with audit trail; session variance adjusted in FMS.
Offline transaction rejected on replayReplay Exception Record + manual resolution.Conflict documented; compensating sale or refund issued.

5. End-of-Day Reconciliation

At the end of the business day, all closed sessions are aggregated into a store-level settlement.

Settlement Elements

ElementSourcePurpose
Total SalesSum of all PosSaleCompleted events.Revenue reporting.
Total RefundsSum of all PosSaleRefunded events.Contra-revenue reporting.
Net SalesTotal Sales minus Total Refunds.Net revenue.
Tender SummarySum by tender type across sessions.Deposit and reconciliation.
Tax CollectedSum of tax lines by category.Tax remittance.
Cash DropsSum of PosCashDropRecorded events.Safe deposit verification.
Petty ExpensesSum of PosPettyExpenseRecorded events.Expense verification.
DiscrepanciesSum of overages and shortages.Variance reporting.
Depositable CashComputed net cash for bank deposit.Bank reconciliation.

Reconciliation Workflow

flowchart TD
    A[All Sessions Closed] --> B[Aggregate Session Totals]
    B --> C[Compare Tender Totals to Acquirer Settlements]
    C --> D{Match?}
    D -->|Yes| E[Prepare Deposit]
    D -->|No| F[Investigate Variance]
    F --> G[Document Reason Code]
    G --> E
    E --> H[Post to FMS]
    H --> I[Settlement Complete]

6. Regulatory & Compliance Alignment

The POS audit and reconciliation model supports common retail regulatory requirements:

RequirementSupported Capability
Sales Tax ReportingItemized tax breakdown by jurisdiction and category.
Cash Handling ControlsDual-control drops, supervisor overrides, and discrepancy tracking.
Receipt IntegrityImmutable receipt snapshots with sequence numbers.
Fiscal Period ClosingSealed session and daily settlement totals.
Fraud DetectionAudit trail of voids, refunds, overrides, and discrepancies.
Payment Card SecurityTender data limited to last-four digits and authorization tokens; no full PAN retained.

7. Summary

The POS domain in Obelaw is a rigorous, event-driven, edge-resilient bounded context that enforces retail correctness through immutable sessions, sealed receipts, non-negative tender validation, monotonic offline sequences, and formal discrepancy handling. It remains isolated from central operational and financial contexts via an Anti-Corruption Layer and emits only the retail facts necessary for inventory deduction, financial settlement, customer loyalty accrual, and enterprise reporting.

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