Skip to content

Comments

FINERACT-2421: Manual interest refund on closed loan generates exception#5363

Merged
adamsaghy merged 2 commits intoapache:developfrom
openMF:FINERACT-2421/manual-interest-refund-on-closed-loan-results-in-databaseexception
Jan 23, 2026
Merged

FINERACT-2421: Manual interest refund on closed loan generates exception#5363
adamsaghy merged 2 commits intoapache:developfrom
openMF:FINERACT-2421/manual-interest-refund-on-closed-loan-results-in-databaseexception

Conversation

@alberto-art3ch
Copy link
Contributor

Description

We have run into a bug with creating manual interest refunds for Loan accounts. Upon creating a manual interest refund for a loan in 600 (CLOSED_OBLIGATIONS_MET) status, we are receiving a 403 DatabaseException because the Accrual Activity transaction was being created with transaction date in null

FINERACT-2421

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • 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.

Your assigned reviewer(s) will follow our guidelines for code reviews.

loanAccrualsProcessingService.reprocessExistingAccruals(loan, true);
loanAccrualsProcessingService.processIncomePostingAndAccruals(loan, true);
}
loanLifecycleStateMachine.determineAndTransition(loan, interestRefundTxn.getTransactionDate());
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems odd for fixing the issue. Can you please elaborate why this helps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The DatabaseException was because in the AccrualActivity process, the closureDate was set in null because the loanBalanceService.isOverPaid(loan) return true but the Loan instance was not set as Overpaid status

LocalDate closureDate = loanBalanceService.isOverPaid(loan) ? loan.getOverpaidOnDate() : loan.getClosedOnDate();

So, If we set the Loan transition we are ensuring the Loan has the right status and this case the OverpaidOnDate value need to set the closureDate

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

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

LGTM

@ruzeynalov ruzeynalov force-pushed the FINERACT-2421/manual-interest-refund-on-closed-loan-results-in-databaseexception branch from 832ff4c to 4ffcf3f Compare January 22, 2026 21:37
@adamsaghy adamsaghy merged commit f7a90d8 into apache:develop Jan 23, 2026
36 checks passed
@adamsaghy adamsaghy deleted the FINERACT-2421/manual-interest-refund-on-closed-loan-results-in-databaseexception branch January 23, 2026 13:00
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.

4 participants