Update: Cater for loans with no schedule at disburse time
This commit is contained in:
committed by
Arnold Gálovics
parent
66621dcc81
commit
c1a3b98edd
+2
-11
@@ -2481,17 +2481,8 @@ public class Loan extends AbstractPersistableCustom {
|
||||
|
||||
private void regenerateRepaymentScheduleWithInterestRecalculationIfNeeded(boolean interestRecalculationEnabledParam,
|
||||
boolean disbursementMissedParam, ScheduleGeneratorDTO scheduleGeneratorDTO, AppUser currentUser) {
|
||||
/*
|
||||
* There may be no schedule built pre-disbursal e.g. multi-disbursal products that disallow expected
|
||||
* disbursements
|
||||
*/
|
||||
LocalDate firstInstallmentDueDate = null;
|
||||
LoanRepaymentScheduleInstallment firstInstallment = fetchRepaymentScheduleInstallment(1);
|
||||
if (firstInstallment == null) {
|
||||
firstInstallmentDueDate = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
} else {
|
||||
firstInstallmentDueDate = firstInstallment.getDueDate();
|
||||
}
|
||||
|
||||
LocalDate firstInstallmentDueDate = fetchRepaymentScheduleInstallment(1).getDueDate();
|
||||
if (interestRecalculationEnabledParam
|
||||
&& (firstInstallmentDueDate.isBefore(LocalDate.now(DateUtils.getDateTimeZoneOfTenant())) || disbursementMissedParam)) {
|
||||
regenerateRepaymentScheduleWithInterestRecalculation(scheduleGeneratorDTO, currentUser);
|
||||
|
||||
+6
@@ -513,6 +513,12 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
loan.addLoanTransaction(disbursementTransaction);
|
||||
}
|
||||
|
||||
if (loan.getRepaymentScheduleInstallments().size() == 0) {
|
||||
/*
|
||||
* If no schedule, generate one (applicable to non-tranche multi-disbursal loans)
|
||||
*/
|
||||
recalculateSchedule = true;
|
||||
}
|
||||
regenerateScheduleOnDisbursement(command, loan, recalculateSchedule, scheduleGeneratorDTO, nextPossibleRepaymentDate,
|
||||
rescheduledRepaymentDate);
|
||||
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
|
||||
|
||||
Reference in New Issue
Block a user