You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "ruchiD (via GitHub)" <gi...@apache.org> on 2023/09/20 06:55:49 UTC
[GitHub] [fineract] ruchiD commented on a diff in pull request #3461: FINERACT-1958: Rework down-payment calculation
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: commits-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org