Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FINERACT-2148: Stop recalculating interest if the loan is charged-off #4234

Conversation

alberto-art3ch
Copy link
Contributor

Description

When we are reprocessing the transactions of the loan, anything that happened before the Charge-off transaction can and should recalculate interest, but after the Charge-off transaction, neither of the transactions should trigger interest recalculation anymore!

FINERACT-2148

Checklist

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

  • Write the commit message as per https://github.com/apache/fineract/#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.

  • Create/update unit or integration tests for verifying the changes made.

  • Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/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

  • Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)

FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.

@@ -54,7 +54,7 @@ public void regenerateRepaymentSchedule(final Loan loan, final ScheduleGenerator
}

public void recalculateScheduleFromLastTransaction(final Loan loan, final ScheduleGeneratorDTO generatorDTO) {
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled() && !loan.isChargedOff()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

When you call loan.isChargedOff(), it simply checks whether the loan has been charged off. As a result, you might skip the recalculation for installments that have dates earlier than the charge-off transaction. As far as I understand, you need to stop recalculating interest only AFTER the date of the charge-off transaction. Perhaps my PR could help you: #4236

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solved!

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.

Kindly check Maria's review!

@alberto-art3ch alberto-art3ch force-pushed the enhancement/stop_interest_recalculation_loan_chargeoff branch from f33edee to b01a57e Compare January 7, 2025 03:02
@@ -2699,8 +2699,8 @@ public void processPostDisbursementTransactions() {
}

public LoanScheduleDTO getRecalculatedSchedule(final ScheduleGeneratorDTO generatorDTO) {
if (!this.repaymentScheduleDetail().isEnableDownPayment()
&& (!this.repaymentScheduleDetail().isInterestRecalculationEnabled() || isNpa || isChargedOff())) {
if (!this.repaymentScheduleDetail().isEnableDownPayment() && (!this.repaymentScheduleDetail().isInterestRecalculationEnabled()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not correct out of box. isChargedOff() was sufficient here...

Copy link
Contributor

Choose a reason for hiding this comment

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

recalculate from is null many situations, but still we dont wanna recalculate schedule...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

@@ -84,7 +84,7 @@ public ChangedTransactionDetail recalculateScheduleFromLastTransaction(final Loa
public void regenerateRepaymentScheduleWithInterestRecalculation(final Loan loan, final ScheduleGeneratorDTO generatorDTO) {
final LocalDate lastTransactionDate = loan.getLastUserTransactionDate();
final LoanScheduleDTO loanSchedule = loan.getRecalculatedSchedule(generatorDTO);
if (loanSchedule == null) {
if (loanSchedule == null || loan.isChargedOff()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not needed... it is redundant... loan.getRecalculatedSchedule(generatorDTO) will return null if loan is charged off

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

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.

Kindly see my review!

@alberto-art3ch alberto-art3ch force-pushed the enhancement/stop_interest_recalculation_loan_chargeoff branch from b01a57e to 634f644 Compare January 8, 2025 05:44
@adamsaghy adamsaghy merged commit 4f1184f into apache:develop Jan 8, 2025
10 checks passed
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