Finance — technical documentation index
Technical-layer documentation for the Ethica Capital finance module. Each page describes one feature in engineering depth: models (fields, types, indexes), services, endpoints, validation rules, file paths, design rationale, alternatives considered, edge cases, and test coverage.
Audience: engineers, future agents implementing or modifying the finance module.
Documentation rule. Every task in the finance module implementation plan ships with three docs: technical (here), architecture, and business. Do not duplicate content — cross-link.
Phase 0 — Foundation fixes (complete)
| Doc | Covers |
|---|---|
| SourceModule enum | Extension of SourceModule across API + ERP types |
| AAOIFI COA seed | AAOIFI baseline COA seed + per-fund control auto-provisioning |
| Reversal API | Reversal journal entry service, controller, and UI |
| Hash chain verifier | Server-side hash recompute, nightly cron, run log |
Phase 1 — Critical infrastructure
| Doc | Covers |
|---|---|
| Subledgers | Client, fund, custodian, broker subledgers (Block 1.A) |
| Reconciliation | Daily subledger-vs-GL reconciliation engine + UI (Block 1.A) |
| Posting engine | Discriminated-union posting requests, validation engine, atomic transaction wrap (Block 1.B) |
| Shariah rules | Asset screening + transaction-gate Shariah rules engine + frontend (Block 1.B) |
| NAV engine | Security master, price + FX sources, 12-step NAV calculator with snapshots (Block 1.C) |
| NAV-fund flows | Subscription / redemption / equity-trade / sukuk-trade handlers + lifecycles (Block 1.D — parallel product) |
Phase 1 is complete; subsequent docs will land with Phase 2 (purification, zakat, FX revaluation, month-end close) and Phase 3 (regulatory reports).
Conventions
- File paths reference
ethica-api/andethica-erp/relative to the operations workspace root. - When a doc references a line number, it reflects the state at write time; if you find the line has drifted, update both the doc and the citation.
- Money math: always
NUMERIC(20,4)in the DB +decimal.jsin code. Nevernumberfor money.