Accounting - Domain Events & Integration Contracts
Domain events emitted by the FMS and operational events consumed through the anti-corruption layer.
Domain Events & Integration Contracts
The Accounting & FMS domain communicates with the rest of the Obelaw ecosystem through a strict event-driven contract. It emits financial events for downstream consumers and consumes operational events to construct automated ledger postings.
1. Events Emitted by Accounting
| Domain Event | Emitted When | Consumers |
|---|---|---|
| JournalEntryPosted | A journal voucher is successfully posted to the GL. | Reporting, Audit Log, Notification Bus. |
| FiscalPeriodClosed | An accounting period is closed and locked. | Reporting, Tax Engine, Consolidation Services. |
| AccountBalanceThresholdBreached | An account balance crosses a defined control limit. | Treasury, Risk Management, Alerts. |
| JournalEntryReversed | A posted entry is reversed by a reversal voucher. | Audit Log, Reporting, Operational Subscribers. |
Event Payload Characteristics
Emitted events contain only ledger-relevant facts:
- Voucher reference and posting timestamp.
- Total debit and credit amounts per currency.
- Source alias and morph type for traceability.
- Actor identity who performed the action.
They do not expose internal operational details from originating contexts.
2. Events Consumed by Accounting
Accounting listens to operational events and translates them into balanced journal entries through background dispatchers:
| Operational Event | Source Context | Accounting Action |
|---|---|---|
| InvoiceCreated | Sales / Billing | Record revenue and receivables. |
| CashOnDeliveryCollected | POS / Delivery | Record cash increase and revenue realization. |
| RawMaterialsConsumed | Inventory / Manufacturing | Record work-in-process or cost of goods sold. |
| PaymentReceived | Receivables | Reduce receivables and increase cash/bank. |
| BillApproved | Purchasing | Record expense and accounts payable. |
Translation Through the ACL
The ACL ensures that Accounting only receives the minimal financial payload required to construct the journal entry, without exposing operational internals:
- Event Validation: Verify that the source event carries all required financial attributes (amount, currency, date, counterpart identifier).
- Account Mapping: Resolve the event type and business nature into the appropriate COA posting accounts using deterministic mapping rules.
- Cost Center Tagging: Attach analytical dimensions when provided by the source context.
- Journal Construction: Build a balanced journal voucher and route it through the standard posting workflow.
- Failure Handling: If a consumed event cannot be translated into a valid journal entry, it is quarantined for manual review rather than posted with errors.
3. Integration Contracts
Outbound Contract
Downstream contexts subscribing to Accounting events can rely on the following guarantees:
JournalEntryPostedis emitted only after the entry is durably committed to the ledger.FiscalPeriodClosedis emitted only after the period lock is fully enforced.- All monetary values are expressed in both transaction currency and functional currency.
Inbound Contract
Operational contexts publishing events to Accounting must provide:
- A unique document reference.
- A transaction timestamp.
- Amount and currency.
- A morph alias pointing back to the originating document.
- Optional analytical tags (cost center, project, department).