Repository navigation
feat(m1): ledger domain in pure Java - #2
Merged
Merged
Conversation
Double-entry ledger domain in contexts/ledger/ledger-domain, with no framework dependencies. - LedgerTransaction aggregate: at least two entries, single currency, sum of debits = sum of credits; PENDING -> POSTED | ARCHIVED only; domain events pulled via pullEvents(); accountIds() sorted for deterministic lock ordering. - Amount (> 0, built on Money, ADR-17), Direction, ExternalId, Entry. - LedgerAccount with Balances (four non-negative buckets + lockVersion), posted/pending/available for both normal balances. - BalanceCondition (GT/GTE/EQ/LTE/LT on POSTED/PENDING/AVAILABLE), evaluated on the post-transaction balance. - PostingService: apply, settle, release. Balances are projected first and written only if every check passes, so a rejection changes nothing. - Repository ports plus in-memory implementations in testFixtures. - Shared kernel: AccountId is now Comparable. Tests: - LedgerInvariantProperties (jqwik): random transaction streams keep debits = credits, no negative bucket, rejections are side-effect free, and balances match a recomputation from entries. - SendCashScenarioTest: deposit, P2P with fees, pending cash-out, rejected overdraft, settlement. - Unit tests for Amount, Balances, LedgerTransaction, BalanceCondition, PostingService. - ArchUnit domainIsPure no longer allows an empty rule. Docs: ADR-17, docs/milestones/M1.md, README milestone table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Double-entry ledger domain in contexts/ledger/ledger-domain, with no framework dependencies.
Tests:
Docs: ADR-17, docs/milestones/M1.md, README milestone table.