Build loan ledgers that stay consistent through payment reversals, backdated entries, and out-of-order events — guaranteed by the engine, not by careful coding.
Java 21 (53 invariants) · Haskell GHC 9.6 (64 invariants) · Quarkus / Spring compatible · JavaMoney precision
The same rollback‑replay‑sync algorithm is independently implemented in pure Haskell (GHC 9.6.4) and verified with 64 passing invariants. Identical test outcomes in two type‑systems prove the logic is correct by construction — not by accident of runtime.
// the_problem
// capabilities
Backdated activities automatically trigger ledger rollback to the effective date, deterministic re-application of all subsequent activities, and delta-based synchronisation back into the primary ledger.
Every reversal emits a signed compensation entry that mathematically negates the original impact, then rolls back and replays all downstream activities so running balances stay consistent.
Every LedgerEntry carries both the component deltas (Δprincipal, Δinterest, Δfee, Δexcess) and the running balance — always consistent, always auditable.
Built on Moneta with a 256-bit HALF_EVEN MathContext. No IEEE-754 floating point drift — every cent is accounted for across millions of entries.
Composite idempotency keys on every entry prevent double-application on retry storms or duplicate event delivery — critical for event-sourced architectures.
Ship with ComputationalSpread (interest-first waterfall) and StaticAllocation. Implement TransactionSpreadStrategy for any custom allocation rule.
// how_it_works
Transaction, SOD accrual, or reversal submitted via API
Engine checks if back-dated, reversal, or chronological
Fork, recompute, and reconcile deltas back into primary ledger
// Pseudocode — the actual engine branching logic
for each activity in pendingActivities:
if activity.isBackdated(ledger):
retroLedger = ledger.rollbackTo(activity.effectiveAt)
retroLedger.apply(activity)
replaySubsequent(retroLedger, activitiesAfter)
ledger.syncWith(retroLedger) // delta reconciliation
else if activity.isReversal():
ledger.addCompensation(negate(originalImpact))
retroLedger = ledger.rollbackBefore(originalActivity)
replaySubsequent(retroLedger, activitiesAfter)
ledger.syncWith(retroLedger) // delta reconciliation
else:
activity.applyTo(ledger) // chronological — fast path
// integration
<!-- Add to your pom.xml -->
<dependency>
<groupId>io.github.v1bh0r</groupId>
<artifactId>precise-ledger-pro</artifactId>
<version>1.0.0</version>
</dependency>
// Apply activities — engine handles backdated & reversals
var ledger = ledgerService.getLedger(loanId);
var clock = ledgerService.getCurrentLedgerClock(ledger);
ledgerService.applyLedgerActivity(
ledger, activity, clock, temporalContext
);
// That's it. Balances are correct.
var balance = ledger.getCurrentBalance();
// → Balance[principal=USD 991,000.00, interest=...]
-- precise-ledger.cabal
build-depends: precise-ledger ^>= 1.0
-- Apply activities — same engine, pure functional
let activities = [disbursal, payment, reversal]
(ledger, _) = applyLedgerActivities
lookup ctx activities
emptyLedger defaultClock
-- Balances are correct. No IO, no side effects.
let bal = currentBalance ledger
-- → Balance { principal = 991000.00, interest = 0 }
// pricing
One price, deploy anywhere. Every plan includes a perpetual usage license, the 53-test acceptance suite, and your first year of updates & support.
+ $499 / year for support renewal
+ $1,999 / year for support renewal
// faq
precise-ledger) and is included in the Business plan source bundle. It serves as both a formal cross-language verification of the algorithm and a production-ready option for Haskell-native teams.
Ledger, LedgerService, activity types) is framework-agnostic. It works with any JPA/Hibernate environment including Spring Boot, Micronaut, or plain Java SE.
See the rollback-replay-sync engine handle reversals and backdated payments in real time, then talk to us about licensing.