FINERACT-1981: Progressive Loan schedule handling - Installment charges#4800
Conversation
|
@mariiaKraievska Please run |
52c8414 to
81b573a
Compare
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
Show resolved
Hide resolved
| if (installment.isDownPayment()) { | ||
| continue; | ||
| } | ||
| boolean installmentChargeApplicable = !installment.isRecalculatedInterestComponent(); |
There was a problem hiding this comment.
Any reason to remove this flag?
There was a problem hiding this comment.
I have reverted this change, since we agreed to disallow installment fee charges that are calculated as a percentage of principal or interest when interest recalculation is enabled.
| if (loanCharge.isFeeCharge() && loanCharge.isDueAtDisbursement()) { | ||
| return zero; | ||
| } | ||
| if (loanCharge.isInstalmentFee() && isInstallmentChargeApplicable) { |
There was a problem hiding this comment.
Any reason to remove this flag?
There was a problem hiding this comment.
I have reverted this change, since we agreed to disallow installment fee charges that are calculated as a percentage of principal or interest when interest recalculation is enabled.
| if (!predicate.test(loanCharge)) { | ||
| return zero; | ||
| } | ||
| if (loanCharge.isInstalmentFee() && isInstallmentChargeApplicable) { |
There was a problem hiding this comment.
Any reason to remove this flag?
There was a problem hiding this comment.
I have reverted this change, since we agreed to disallow installment fee charges that are calculated as a percentage of principal or interest when interest recalculation is enabled.
| for (LoanCharge loanCharge : charges) { | ||
| String errorcode = null; | ||
| switch (loanCharge.getChargeCalculation()) { | ||
| case PERCENT_OF_AMOUNT: |
There was a problem hiding this comment.
Any reason to remove these?
There was a problem hiding this comment.
I have reverted this change, since we agreed to disallow installment fee charges that are calculated as a percentage of principal or interest when interest recalculation is enabled.
adamsaghy
left a comment
There was a problem hiding this comment.
Please review my questions
|
@mariiaKraievska please rebase |
c2123dd to
eb81c8d
Compare
| for (LoanInstallmentCharge oldCharge : loanCharge.getLoanInstallmentCharge()) { | ||
| oldCharge.getInstallment().getInstallmentCharges().remove(oldCharge); | ||
| } | ||
| loanCharge.getLoanInstallmentCharge().clear(); |
There was a problem hiding this comment.
Why do we need to drop all charges? That would recreate charges every time... Was the previous version which only updated the existing once wrong?
There was a problem hiding this comment.
Thank you for your question!
After reverting to the previous logic, I encountered a database integrity error during testing (specifically on charge-off with accelerate maturity date behaviour), caused by a foreign key constraint violation between m_loan_installment_charge and m_loan_repayment_schedule.
It seems that the old approach does not always properly remove or update all related installment charges before the repayment schedule is changed, which leads to this issue.
That’s why the logic to clear and recreate all charges was introduced — to ensure data consistency and avoid such integrity problems.
There was a problem hiding this comment.
Well, it is suboptimal, as we are recreating charges which are unchanged :/ I wonder whether we should have some logic which can compare them properly...
There was a problem hiding this comment.
Please check updated version of this method 🙏
eb81c8d to
d6b4e43
Compare
|
@mariiaKraievska Please rebase this PR. |
6ba1912 to
6af18e7
Compare
Done |
6af18e7 to
a8b56f3
Compare
Description
Describe the changes made and why they were made.
Ignore if these details are present on the associated Apache Fineract JIRA ticket.
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.