Skip to content

FINERACT-2566: Refresh loan summary after account-transfer disbursement charge collection#5710

Open
rhopman wants to merge 2 commits intoapache:developfrom
symbaglobal:FINERACT-2566
Open

FINERACT-2566: Refresh loan summary after account-transfer disbursement charge collection#5710
rhopman wants to merge 2 commits intoapache:developfrom
symbaglobal:FINERACT-2566

Conversation

@rhopman
Copy link
Copy Markdown
Contributor

@rhopman rhopman commented Mar 29, 2026

Bug

When a loan is disbursed and one or more loan charges have their payment mode set to Account Transfer (ACCOUNT_TRANSFER), the system collects each charge by calling transferFunds() on the linked savings account. This creates a REPAYMENT_AT_DISBURSEMENT loan transaction and marks the charge as paid.

However, transferFunds() does not recompute the LoanSummary derived fields. As a result, fields such as feeChargesPaid, feeChargesOutstanding, and totalOutstanding remain stale, reflecting the values computed during the saveAndFlush that preceded the charge loop.

This causes the loan balance to appear higher than what the client actually owes after disbursement.

Fix

After the disBuLoanCharges transfer loop, when the map is non-empty, call:

if (!disBuLoanCharges.isEmpty()) {
    loanBalanceService.updateLoanSummaryDerivedFields(loan);
    saveAndFlushLoanWithDataIntegrityViolationChecks(loan);
}

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
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.

Copy link
Copy Markdown
Contributor

@IOhacker IOhacker left a comment

Choose a reason for hiding this comment

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

LGTM

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