Finance — Architecture & data
Main flow
Boundaries
| Boundary | Rule |
|---|---|
| Billing calculation core | May return in-memory invoice/credit-note projections but must not persist or schedule. |
| Persistence boundary | The only place that may add invoices, credit notes, finance logs, schedulers, and save changes. |
| Preview Billing Diff | Read-only; no invoice, scheduler, finance log, or projection writes. |
| Payment domain | Collects money and records provider transactions, while Finance owns document lifecycle. |
| Accounting sync | Provider sync is a side effect; AIMY finance records remain internal source of truth. |
Common data
| Group | Examples |
|---|---|
| Billing | Billing, payment option, split rule, currency setting. |
| Invoice | Invoice, InvoiceLine, scheduler, lock/processing state. |
| Credit note | CreditNote, lines, allocation and original invoice links. |
| Projection | Finance transaction search keys, booking number sync, refresh state. |
| Settings | Finance/accounting settings, invoice templates, Xero provider config. |