-
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-2065: Fix schedule handling with higher fixed length value t… #3836
FINERACT-2065: Fix schedule handling with higher fixed length value t… #3836
Conversation
234e7df
to
3771afd
Compare
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.
LGTM
3771afd
to
10aa0af
Compare
// Fixed Length validation | ||
final int lastPeriodIdx = periods.size() - 1; | ||
LoanScheduleModelRepaymentPeriod lastPeriod = (LoanScheduleModelRepaymentPeriod) periods.get(lastPeriodIdx); | ||
if (lastPeriod.getDueDate().compareTo(loanEndDate) != 0) { |
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.
With reschedule, i dont think it will work... :/
Based on the periodNumber of scheduleParams, you can decide in the "nextRepaymentDate()" method of DefaultScheduledDateGenerator, whether it is the last installment or not and you can set the proper repayment date. After that if the installment was rescheduled, that date would be overriden, but i guess that is fine.
What do you think?
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.
Done! Updated to validate the last installment
10aa0af
to
85e3ced
Compare
@@ -172,4 +172,8 @@ public void resetVariations() { | |||
this.dueDateIterator = this.dueDateVariation.listIterator(); | |||
} | |||
|
|||
public boolean hasAnyVariation() { |
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.
Could you please leave a couple sentence what this is?
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.
The purpose of this is to know when the Loan account has any variation and If this is true that means the Loan has been rescheduled.
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.
Is there any reschedule type where the length of the loan does not change?
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.
There is one option for rescheduling related to use other IR value for the rest of the period. Even I'm thinking for this scenarios to have Fixed Length with Reschedule to use a new kind of reschedule variation to support this, what do you thing?
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.
I am still not sure we need this.
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.
Done! removed!
@@ -1871,4 +1871,16 @@ public LocalDate getRepaymentStartDate() { | |||
: getSubmittedOnDate(); | |||
} | |||
|
|||
public boolean isLastInstallment(final Integer installmentNumber) { | |||
Integer numberOfRepayments = getNumberOfRepayments(); | |||
if (isDownPaymentEnabled()) { |
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.
My gut feeling this is wrong...but i am not fully sure.
Can you please explain a little bit what was the idea 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.
Using the installment number for the last installment is different when you are using Down Payment (It creates a new installment) so we need to consider that when we need to identify the last installment
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.
There could be multiple disbursement and multiple down payment, so adding +1 is not right...
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.
Also while the the installment number is increased when a down payment period added, the period number is not. So you might wanna use that to decide on whether it is the last or not...
90cbe3f
to
d2acf72
Compare
@@ -55,6 +55,13 @@ public static LoanScheduleModelRepaymentPeriod repayment(final int periodNumber, | |||
interestDue, feeChargesDue, penaltyChargesDue, totalDue, recalculatedInterestComponent); | |||
} | |||
|
|||
public static LoanScheduleModelRepaymentPeriod copyWithNewDueDate(final LoanScheduleModelRepaymentPeriod period, |
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 used anywhere...
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.
Done! method removed
assertTrue(loanDetails.getStatus().getActive()); | ||
}); | ||
} | ||
|
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.
Please add test cases where the following happens:
- Reschedule the very last installment to a new due date
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.
Done! TC uc135 created
validateRepaymentPeriod(loanDetails, 1, LocalDate.of(2024, 1, 31), 250.0, 0.0, 250.0, 0.0, 0.0); | ||
validateRepaymentPeriod(loanDetails, 2, LocalDate.of(2024, 3, 15), 250.0, 0.0, 250.0, 0.0, 0.0); | ||
validateRepaymentPeriod(loanDetails, 3, LocalDate.of(2024, 4, 14), 250.0, 0.0, 250.0, 0.0, 0.0); | ||
validateRepaymentPeriod(loanDetails, 4, LocalDate.of(2024, 4, 30), 250.0, 0.0, 250.0, 0.0, 0.0); |
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.
I dont think this is right. The very last installment due date should have been rescheduled as well.
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.
Please review my comments!
29e9482
to
8c11d37
Compare
8c11d37
to
94efd2d
Compare
...java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java
Show resolved
Hide resolved
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.
LGTM
…han Loan term
Description
Following with the Loan Product Fixed Length configuration we need to consider the schedule generation with this new setting.
FINERACT-2065
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.