Engineering and product reference
Centralized Ledger Engine Simulator Manual
Explains what the simulator demonstrates, which behavior is based on current code evidence, and which behavior is proposed for the rebuild.
Contents
- Opening balance and ledger health
- Guided walkthrough and rule labels
- Wallet model
- Action reference
- Posting controls
- Business and branch scope
- Documents versus ledger truth
- Reconciliation
- Toasts and micro-interactions
- Known simplifications
- Behaviour correction log
- Open design questions
- Acceptance tests
Guided Walkthrough And Rule Labels
Start Guided Walkthrough teaches the documented behavior step by step without automatically resetting current state. Reviewers can click the highlighted control in Financial Actions, or use Next: Run This Action to perform the same action and continue.
Run Full Simulation resets and executes the complete scenario immediately. It is useful for inspecting the final data shape, but it is not a guided explanation.
Each walkthrough step offers Business, Accounting, and Engineering perspectives and compares expected outcomes with live simulator state.
| Rule label | Meaning |
|---|---|
| Verified Current Behavior | Supported by evidence in the current schema or /simple code. It is not automatically an endorsement of the current architecture. |
| Proposed Rebuild Rule | Recommended behavior demonstrated by the simulator, pending architecture, product, and accounting approval. |
| Open Design Decision | An unresolved policy or domain choice. Any simulator default is illustrative, not approved architecture. |
Use Reset and Restart for a deterministic walkthrough. Use Exit Walkthrough to keep the resulting state and inspect it manually.
Opening Balance And Ledger Health
The simulator starts with a GH₵200,000 Built wallet balance. It creates a real opening ledger transaction rather than inserting a display-only number:
Dr Built E-Payment Wallet GH₵200,000 Cr Opening Balance Equity GH₵200,000
Immediately after reset there is one transaction and two entries. The equal totals demonstrate that the opening position is balanced.
Opening Balance Equity is a simplified demonstration counterpart. The real rebuild needs an approved migration policy defining retained earnings, owner capital, prior-period balances, or a controlled migration clearing account.
Wallet Model
Current code evidence shows an operational wallet balance, wallet credit/debit transactions, balance-before/balance-after snapshots, available-balance calculations, and links from wallet transactions to ledger rows.
The proposed design keeps two related views:
- Operational wallet: current balance, available balance, pending transfers, channels, and provider references.
- Accounting wallet control account: immutable general-ledger entries representing wallet receipts and payments.
Wallet receipt: Dr Built E-Payment Wallet Cr Counterpart Account Wallet payment: Dr Expense / Payable / Other Counterpart Cr Built E-Payment Wallet
The operational wallet should reconcile to the ledger control account. Timing differences should be explained through pending or settlement-clearing accounts.
Action Reference
| Action | Ledger effect | Wallet effect |
|---|---|---|
| Create Quote | None | None |
| Convert Quote to Invoice | Dr Receivable; Cr Revenue and Tax | None |
| Receive E-Payment | Dr Built Wallet; Cr Receivable | Increase |
| Record Supplier Bill | Dr Expense; Cr Payable | None |
| Pay Supplier Bill | Dr Payable; Cr Built Wallet | Decrease |
| Post POS Sale | Dr Built Wallet; Cr Revenue/Tax; Dr COGS; Cr Inventory | Increase |
| Post Manual Journal | Balanced user-supplied journal | Only if wallet is selected |
| Bank Fee From Import | Dr Bank Charges; Cr External Bank | None |
| Send Wallet Payment | Dr Expense; Cr Built Wallet | Decrease |
| Reconcile Bank Line | No new posting | None |
| Amend Invoice | Reverse settlement if paid, reverse invoice, post replacement | Restored then affected by replacement payment |
| Reverse Selected | Equal and opposite transaction | Automatically changes when wallet entries are reversed |
Posting Engine Controls
- Require business and branch scope.
- Validate accounts and posting permissions.
- Require equal debit and credit totals.
- Reject insufficient wallet payments.
- Reject duplicate idempotency keys.
- Persist the transaction and all entries atomically.
- Correct posted history through reversal rather than deletion.
A production implementation should use integer minor units or fixed-precision decimals for money.
Business And Branch Scope
business_id: BUS-SME-001 branch_id: BR-ACCRA
The simulator carries this scope on financial events, transactions, and entries. Entry-level branch dimensions support shared costs and cross-branch allocations, but the team must confirm whether that flexibility is required.
Operational Documents Versus Ledger Truth
Quotes, invoices, bills, sales, payments, journals, imports, and wallet payments explain business intent. The ledger records the accounting effect. Mutable document balances may be cached, but they must be reproducible from ledger and settlement records.
Reconciliation
Reconciliation creates a separate match object and does not modify ledger values. This permits partial, split, one-to-many, and reversible matches with actor and timestamp history.
Toasts And Micro-Interactions
Toasts report successful postings, blocked actions, reversals, reconciliation, duplicate events, and insufficient funds. The persistent What Changed strip names the latest transition and lists exact account deltas. New transactions and documents enter with short motion cues, affected account rows are highlighted, and wallet movement displays a positive or negative delta. Reduced-motion preferences are respected.
Open the Posting Engine Schema Explorer for proposed tables, fields, constraints, legacy mappings, and migration controls.
Known Simplifications
The current simulator simplifies FX, taxes, fees, partial payments, holds, settlement delays, refunds, chargebacks, credit notes, prepayments, payroll, withholding, approvals, period locks, permissions, cross-branch allocation, and inventory valuation. Each needs explicit posting recipes and tests before implementation.
Behaviour Correction Log
| Date | Area | Current behavior | Required decision | Status |
|---|---|---|---|---|
| 2026-06-08 | Opening wallet | Dr wallet / Cr opening equity for GH₵200,000 | Confirm migration counterpart policy | Open |
| 2026-06-08 | Invoice issue | Does not increase wallet | None; this is the intended accounting behavior | Confirmed |
| 2026-06-08 | POS tender | Assumes Built wallet | Add tender selection in a future iteration | Open |
Open Design Questions
- What legally and operationally does the Built wallet represent?
- At which provider state does an e-payment become accounting cash?
- Are processing fees gross-posted or netted from settlement?
- Can one transaction allocate across branches?
- How are pending balances and settlement timing differences represented?
- What reversal rules apply to transfers, failures, refunds, and chargebacks?
- Which edits are allowed before posting and which require reversal?
Recommended Acceptance Tests
- Quotes create no ledger entries.
- Invoice issue balances without changing wallet cash.
- E-payment increases wallet exactly once.
- Duplicate provider events are idempotently rejected.
- Wallet payments decrease the wallet and reject insufficient funds atomically.
- POS postings correctly handle revenue, tax, COGS, inventory, and tender account.
- Reversals restore wallet balance without deleting history.
- Paid-invoice amendments reverse settlement before replacement.
- Reconciliation does not alter ledger amounts.
- Reports can be rebuilt from ledger entries.
The Markdown version contains additional implementation notes and should remain the primary editable source.