Design an Extensible Financial Account with Charges and Tax
Model an account ledger whose deposits, credits, charges, tax rules, and summaries can evolve without rewriting the posting core.
For this exercise, assume one financial account records immutable deposits and credit adjustments in integer minor currency units. Posting an entry may produce zero or more itemized charges, and taxable charges may produce itemized tax lines.
The entry, charges, and tax lines share one stable request identity and either appear together or not at all. An exact retry returns the original result, while reusing the identity with different economic terms is rejected.
A requested-period summary reports total deposits, credits, charges, tax, and resulting balance from the immutable history. New entry kinds, charge rules, or tax rules must be addable without rewriting the stable posting workflow.
Negative amounts, unsupported currencies, missing rule versions, and overflow are explicit failures. Design the objects, responsibilities, interfaces, and interactions. Payment collection, exchange rates, persistence technology, and distributed settlement are outside scope.