You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "airajena (via GitHub)" <gi...@apache.org> on 2026/02/04 11:47:02 UTC
[PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
airajena opened a new pull request, #5441:
URL: https://github.com/apache/fineract/pull/5441
## Description
This PR adds principal and interest moratorium support to the Progressive repayment strategy. Principal grace produces interest-only installments for the configured number of periods and re-amortizes the remaining schedule. Interest grace defers interest (it is not waived), with deferred interest recognized in subsequent periods. It also fixes the progressive loan configuration mapping so interest grace is correctly passed through.
## Changes
- Apply principal moratorium by setting grace-period EMIs to interest-only and re-amortizing remaining periods
- Treat interest-moratorium periods as zero-rate periods for EMI calculation while deferring interest
- Fix configuration mapping for graceOnInterestPayment
- Add unit coverage for principal/interest moratorium examples
- Add integration tests for progressive moratorium schedules
## Testing
- ./gradlew :fineract-progressive-loan:spotlessApply :fineract-progressive-loan:spotbugsMain :fineract-progressive-loan:spotbugsTest :fineract-progressive-loan:checkstyleMain :fineract-progressive-loan:checkstyleTest
- ./gradlew :integration-tests:spotlessApply :integration-tests:spotbugsMain :integration-tests:spotbugsTest :integration-tests:checkstyleMain :integration-tests:checkstyleTest
## Checklist
- [x] Write the commit message as per our guidelines
- [x] Acknowledge that PRs must be green (passing build)
- [x] Create/update unit or integration tests
- [x] Follow coding conventions
- [x] Add required Swagger annotation and update API docs (N/A - no API changes)
- [x] This PR is not a code dump
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy merged PR #5441:
URL: https://github.com/apache/fineract/pull/5441
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on PR #5441:
URL: https://github.com/apache/fineract/pull/5441#issuecomment-3885213818
> @airajena Kindly review the failed checks!
Added the fixes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on PR #5441:
URL: https://github.com/apache/fineract/pull/5441#issuecomment-3995246197
@adamsaghy here the check is failing because there are two unused private methods from ProgressiveEMICalculator. Should I remove them? Liquibase error will go as soon as i rebase to latest develop branch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #5441:
URL: https://github.com/apache/fineract/pull/5441#issuecomment-3914398723
@bharathc27 I would like to hear your opinion on this PR. I think grace periods / moratorium is something that we know from Day 1 and the repayment schedule should be calculated and reflect its side effects, no? EMI calculation should consider and calculate an EMI which remains the same across the periods anyway, no?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on PR #5441:
URL: https://github.com/apache/fineract/pull/5441#issuecomment-4056040191
> @airajena Yes. We need a green build!
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "airajena (via GitHub)" <gi...@apache.org>.
airajena commented on PR #5441:
URL: https://github.com/apache/fineract/pull/5441#issuecomment-3941476418
> I think grace periods / moratorium is something that we know from Day 1 and the repayment schedule should be calculated and reflect its side effects, no? EMI calculation should consider and calculate an EMI which remains the same across the periods anyway, no?
Thanks, Adam — agreed with your direction.
I reviewed the current implementation and studied some banking terms too and you’re right: it currently relies on period-index checks and post-processing, rather than modeling moratorium from schedule generation time. It also doesn’t properly reuse the existing interest-pause mechanism as intended.
So I am thinking to these things
Model moratorium/grace from Day 1 in the schedule calculation flow, use the existing interest-pause logic/mechanics for interest moratorium instead of custom period-number checks, remove the current ad-hoc grace checks and EMI-skip shortcut, keep EMI behavior consistent with the configured schedule and expected examples. I think i am moving in the right direction now. Also surely @bharathc27 opinion will be helpful
I’ll update the tests accordingly and push a cleaned-up PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #5441:
URL: https://github.com/apache/fineract/pull/5441#issuecomment-4054122714
```
(see https://errorprone.info/bugpattern/NonApiType)
/home/runner/work/fineract/fineract/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java:1779: error: [UnusedMethod] Method 'calculateFnResult' is never used.
private BigDecimal calculateFnResult(final List<RepaymentPeriod> periods, final MathContext mc) {
^
(see https://errorprone.info/bugpattern/UnusedMethod)
Did you mean to remove this line?
/home/runner/work/fineract/fineract/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java:1771: error: [UnusedMethod] Method 'calculateRateFactorPlus1N' is never used.
private BigDecimal calculateRateFactorPlus1N(final List<RepaymentPeriod> periods, MathContext mc) {
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5441:
URL: https://github.com/apache/fineract/pull/5441#discussion_r2816748765
##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriod.java:
##########
@@ -273,6 +276,24 @@ public Money getDueInterest() {
return dueInterestCalculation.get();
}
+ private boolean isInterestPaymentGracePeriod() {
+ Integer interestGrace = loanProductRelatedDetail.getGraceOnInterestPayment();
+ if (interestGrace == null || interestGrace <= 0) {
+ return false;
+ }
+ return getPeriodNumber() <= interestGrace;
+ }
+
+ private int getPeriodNumber() {
Review Comment:
Interesting approach, but i think we should do it differently.
Based on the configuration let's use modifier flags which will instruct the calculator whether interest can be calculated or not.
The interest pause logic which is already in place can be rather used here to achieve the same! :)
I think the right approach anyway would be to consider the grace principal and grace interest from the moment it was generated and the EMI should consider and reflect them from Day 1.
@bharathc27 what do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #5441:
URL: https://github.com/apache/fineract/pull/5441#issuecomment-3883648762
@airajena Kindly review the failed checks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5441:
URL: https://github.com/apache/fineract/pull/5441#discussion_r2816713639
##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/mapper/LoanConfigurationDetailsMapper.java:
##########
@@ -48,7 +48,7 @@ public static ILoanConfigurationDetails map(Loan loan) {
return new LoanConfigurationDetails(currencyData, loanProductRelatedDetail.getNominalInterestRatePerPeriod(),
loanProductRelatedDetail.getAnnualNominalInterestRate(), loanProductRelatedDetail.getGraceOnInterestCharged(),
- loanProductRelatedDetail.getGraceOnPrincipalPayment(), loanProductRelatedDetail.getGraceOnPrincipalPayment(),
+ loanProductRelatedDetail.getGraceOnInterestPayment(), loanProductRelatedDetail.getGraceOnPrincipalPayment(),
Review Comment:
nice catch!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5441:
URL: https://github.com/apache/fineract/pull/5441#discussion_r2945248972
##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java:
##########
@@ -658,11 +658,13 @@ private ProgressiveLoanInterestScheduleModel recalculateScheduleModelTillDate(
private void calculateEMIValueAndRateFactorsForFlatInterestMethod(final LocalDate calculateFromRepaymentPeriodDueDate,
final ProgressiveLoanInterestScheduleModel scheduleModel, final EmiChangeOperation operation) {
final List<RepaymentPeriod> relatedRepaymentPeriods = scheduleModel.getRelatedRepaymentPeriods(calculateFromRepaymentPeriodDueDate);
+ applyInterestMoratoriumIfRequired(scheduleModel);
Review Comment:
Why to apply moratorium at different places?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] FINERACT-2357: Support principal & interest moratorium for progressive loans [fineract]
Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #5441:
URL: https://github.com/apache/fineract/pull/5441#issuecomment-4022159834
@airajena Yes. We need a green build!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org