ruchiD commented on code in PR #3461:
URL: https://github.com/apache/fineract/pull/3461#discussion_r1331072969
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java:
##########
@@ -137,18 +137,27 @@ private LoanScheduleModel generate(final MathContext mc,
final LoanApplicationTe
loanApplicationTerms.getLoanCalendar(),
loanApplicationTerms.getHolidayDetailDTO(), loanApplicationTerms);
if (!scheduleParams.isPartialUpdate()) {
- Long notDownPaymentPeriodNumber = periods.stream().filter(period
-> !period.isDownPaymentPeriod()).count();
+ BigDecimal downPaymentAmount = BigDecimal.ZERO;
+ if (loanApplicationTerms.isDownPaymentEnabled()) {
+ downPaymentAmount =
MathUtil.percentageOf(scheduleParams.getOutstandingBalance().getAmount(),
+
loanApplicationTerms.getDisbursedAmountPercentageForDownPayment(), 19);
+ }
+ Money calculatedAmortizableAmount =
loanApplicationTerms.getPrincipal().minus(downPaymentAmount);
+ scheduleParams.setOutstandingBalance(calculatedAmortizableAmount);
// Set Fixed Principal Amount
- updateAmortization(mc, loanApplicationTerms,
notDownPaymentPeriodNumber.intValue(), scheduleParams.getOutstandingBalance());
+ updateAmortization(mc, loanApplicationTerms,
scheduleParams.getPeriodNumber(), calculatedAmortizableAmount);
if (loanApplicationTerms.isMultiDisburseLoan()) {
/* fetches the first tranche amount and also updates other
tranche details to map */
- BigDecimal disburseAmt =
getDisbursementAmount(loanApplicationTerms,
scheduleParams.getPeriodStartDate(), periods,
- chargesDueAtTimeOfDisbursement,
scheduleParams.getDisburseDetailMap(),
scheduleParams.applyInterestRecalculation(),
- scheduleParams);
- scheduleParams.setPrincipalToBeScheduled(Money.of(currency,
disburseAmt));
-
loanApplicationTerms.setPrincipal(loanApplicationTerms.getPrincipal().zero().plus(disburseAmt));
-
scheduleParams.setOutstandingBalanceAsPerRest(Money.of(currency, disburseAmt));
+ BigDecimal disburseAmt =
getDisbursementAmount(loanApplicationTerms, scheduleParams.getPeriodStartDate(),
+ scheduleParams.getDisburseDetailMap(),
scheduleParams.applyInterestRecalculation());
+ BigDecimal downPaymentAmt = MathUtil.percentageOf(disburseAmt,
Review Comment:
Check for downpayment enable is needed here.
--
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]