-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
FINERACT-2148: Stop recalculating interest if the loan is charged-off #4234
Conversation
@@ -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()) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved!
There was a problem hiding this 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!
f33edee
to
b01a57e
Compare
@@ -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() |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
There was a problem hiding this 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!
b01a57e
to
634f644
Compare
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.