Skip to content

FINERACT-2910: Fix stale installment interest after add-charge and undo-waive when external events are disabled - #6606

Open
galovics wants to merge 1 commit into
apache:developfrom
galovics:FINERACT-2910
Open

galovics wants to merge 1 commit into
apache:developfrom
galovics:FINERACT-2910

Conversation

@galovics

@galovics galovics commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Description

FINERACT-2910: with external events disabled, the stored interest/principal split of a progressive (advanced payment allocation) loan installment is stale after add-charge or undo-waive-charge, while it is correct with events enabled.

Root cause: when the loan event is serialized in BusinessEventNotifierServiceImpl.beforeCommit, LoanBusinessEventSerializer -> ProgressiveLoanSummaryDataProvider -> InterestScheduleModelRepositoryWrapperImpl.getSavedModel recalculates the interest schedule model and writes it onto the managed installments, which are flushed on commit. The add-charge path skips reprocessing when the charge is due after the last transaction, and undo-waive never reprocesses, so those two commands only got fresh installments as a side effect of event serialization.

Fix: after the add-charge reprocess-skipped branch and after undo-waive, call the existing ReprocessLoanTransactionsService.updateModel, guarded to progressive, interest-bearing loans with interest recalculation that are not matured (the same conditions under which serialization recalculates). Persisted state no longer depends on event posting.

Not changed: making event serialization / getSavedModel side-effect free (it also affects accruals, prepayment and the investor interest calculation, and would change persisted values for events-enabled deployments). That should be a separate change.

Tests: new LoanChargeInterestRecalculationTest, run with the LoanBalanceChangedBusinessEvent type enabled and disabled. Verified failing without the fix (0.39 instead of 0.42) and passing with it, with FINERACT_EXTERNAL_EVENTS_ENABLED both false and true. The e2e scenarios from the ticket (C4311, UC15) and the full LoanReAmortization-Part1 and LoanDelayedScheduleCaptures-Part1 features pass with events off and on.

Checklist

  • Write the commit message as per our guidelines
  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
  • Create/update unit or integration tests for verifying the changes made.
  • Follow our coding conventions.
  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes (no API changes)
  • This PR must not be a "code dump".
  • If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.
  • I followed the AI Policy.

@adamsaghy adamsaghy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…do-waive when external events are disabled

Assisted-By: claude-code-claude-sonnet-5-5
Assisted-By: claude-code-claude-opus-5-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants