galovics opened a new pull request, #6605:
URL: https://github.com/apache/fineract/pull/6605

   ## Description
   
   [FINERACT-2910](https://issues.apache.org/jira/browse/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
   
   - [x] Write the commit message as per [our 
guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
   - [ ] 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.
   - [x] Create/update [unit or integration 
tests](https://fineract.apache.org/docs/current/#_testing) for verifying the 
changes made.
   - [ ] Follow our [coding 
conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions).
   - [x] 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)
   - [x] [This PR must not be a "code 
dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit).
   - [ ] 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](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to