Credit — technical documentation index

Technical-layer documentation for the Ethica Capital Credit module — AAOIFI-compliant financing across three products: Murabaha (cost-plus sale), Ijarah (lease-to-own), and Diminishing Musharakah (declining co-ownership). Each page describes one area in engineering depth: models (fields, types, enums), endpoints, validation, the repayment math, design rationale, and edge cases.

Audience: engineers and future agents implementing or modifying the credit module.

Documentation rule. Like the finance module, each credit task ships with three docs: technical (here), architecture, and business. Do not duplicate content — cross-link.

Pages

DocCovers
Data modelThe six tables — facilities, assets, ownership ledger, schedule lines, payments, posting account-map
APIEndpoints under /credit — facility CRUD + lifecycle, payments, config, reports, and credit:* permissions
EngineThe declining-balance (DM/Ijarah) and fixed-profit (Murabaha) schedulers, with the worked golden example and the anti-riba pace-invariance guarantee

Conventions

  • File paths reference ethica-api/ and ethica-erp/ relative to the operations workspace root.
  • Money math: always NUMERIC(20,4) in the DB + decimal.js in code. Never number for money.
  • The credit module posts through the existing finance PostingEngine with sourceModule = credit; all lines are tagged halal and accounts resolve from the CFO account-map (never hardcoded, fail-closed if unmapped).