adamsaghy commented on code in PR #5219:
URL: https://github.com/apache/fineract/pull/5219#discussion_r2661208829
##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java:
##########
@@ -131,15 +131,100 @@ public void addDisbursement(final
ProgressiveLoanInterestScheduleModel scheduleM
}
private void addDisbursement(final ProgressiveLoanInterestScheduleModel
scheduleModel, final EmiChangeOperation operation) {
- scheduleModel.repaymentPeriods().stream().filter(rp ->
!operation.getSubmittedOnDate().isAfter(rp.getFromDate()))
- .forEach(rp ->
rp.setTotalDisbursedAmount(rp.getTotalDisbursedAmount().add(operation.getAmount())));
+ scheduleModel.repaymentPeriods().stream().filter(rp ->
!operation.getSubmittedOnDate().isAfter(rp.getFromDate())).forEach(rp -> {
+
rp.setTotalDisbursedAmount(rp.getTotalDisbursedAmount().add(operation.getAmount()));
+ });
- scheduleModel
-
.changeOutstandingBalanceAndUpdateInterestPeriods(operation.getSubmittedOnDate(),
operation.getAmount(),
- scheduleModel.zero(), scheduleModel.zero())
- .ifPresent((repaymentPeriod) ->
calculateEMIValueAndRateFactors(
- getEffectiveRepaymentDueDate(scheduleModel,
repaymentPeriod, operation.getSubmittedOnDate()), scheduleModel,
- operation));
+ if (scheduleModel.allowFullTermForTranche() &&
scheduleModel.originalNumberOfRepayments() > 0) {
+ addFullTermTrancheDisbursement(scheduleModel, operation);
+ } else {
+ scheduleModel
+
.changeOutstandingBalanceAndUpdateInterestPeriods(operation.getSubmittedOnDate(),
operation.getAmount(),
+ scheduleModel.zero(), scheduleModel.zero())
+ .ifPresent((repaymentPeriod) ->
calculateEMIValueAndRateFactors(
+ getEffectiveRepaymentDueDate(scheduleModel,
repaymentPeriod, operation.getSubmittedOnDate()), scheduleModel,
+ operation));
+ }
+ }
+
+ private void addFullTermTrancheDisbursement(final
ProgressiveLoanInterestScheduleModel scheduleModel,
Review Comment:
I dont think we need this. When we are disbursing, we are simply checking
the "on the fly" period should use how many periods. If the
`allowFullTermForTranche` is true, we should just simply provide to the
on-the-fly" model the number of installments from the loan product related
details.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]