254:In tranche loans, if repayment date is same as tranche disbursement date then allow to change the emi amount

This commit is contained in:
sachinkulkarni12
2016-04-26 10:54:32 +05:30
parent fe6e1e88fe
commit 6c84834459
6 changed files with 31 additions and 6 deletions
@@ -77,4 +77,6 @@ public interface ConfigurationDomainService {
Long retreivePeroidInNumberOfDaysForSkipMeetingDate(); Long retreivePeroidInNumberOfDaysForSkipMeetingDate();
boolean isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled();
} }
@@ -255,6 +255,13 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
final GlobalConfigurationProperty property = this.globalConfigurationRepository.findOneByNameWithNotFoundDetection(propertyName); final GlobalConfigurationProperty property = this.globalConfigurationRepository.findOneByNameWithNotFoundDetection(propertyName);
return property.isEnabled(); return property.isEnabled();
} }
@Override
public boolean isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled() {
final String propertyName = "change-emi-if-repaymentdate-same-as-disbursementdate";
final GlobalConfigurationProperty property = this.globalConfigurationRepository.findOneByNameWithNotFoundDetection(propertyName);
return property.isEnabled();
}
} }
@@ -42,15 +42,16 @@ public class ScheduleGeneratorDTO {
final Boolean isInterestChargedFromDateAsDisbursementDateEnabled; final Boolean isInterestChargedFromDateAsDisbursementDateEnabled;
final Integer numberOfdays; final Integer numberOfdays;
final boolean isSkipRepaymentOnFirstDayofMonth; final boolean isSkipRepaymentOnFirstDayofMonth;
final Boolean isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled;
public ScheduleGeneratorDTO(final LoanScheduleGeneratorFactory loanScheduleFactory, final ApplicationCurrency applicationCurrency, public ScheduleGeneratorDTO(final LoanScheduleGeneratorFactory loanScheduleFactory, final ApplicationCurrency applicationCurrency,
final LocalDate calculatedRepaymentsStartingFromDate, final HolidayDetailDTO holidayDetailDTO, final LocalDate calculatedRepaymentsStartingFromDate, final HolidayDetailDTO holidayDetailDTO,
final CalendarInstance calendarInstanceForInterestRecalculation, final CalendarInstance compoundingCalendarInstance, final CalendarInstance calendarInstanceForInterestRecalculation, final CalendarInstance compoundingCalendarInstance,
final LocalDate recalculateFrom, final Long overdurPenaltyWaitPeriod, final FloatingRateDTO floatingRateDTO, final LocalDate recalculateFrom, final Long overdurPenaltyWaitPeriod, final FloatingRateDTO floatingRateDTO,
final Calendar calendar, final CalendarHistoryDataWrapper calendarHistoryDataWrapper, final Calendar calendar, final CalendarHistoryDataWrapper calendarHistoryDataWrapper,
final Boolean isInterestChargedFromDateAsDisbursementDateEnabled, final Integer numberOfdays, final boolean isSkipRepaymentOnFirstDayofMonth) { final Boolean isInterestChargedFromDateAsDisbursementDateEnabled, final Integer numberOfdays, final boolean isSkipRepaymentOnFirstDayofMonth,
final Boolean isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled) {
this.loanScheduleFactory = loanScheduleFactory; this.loanScheduleFactory = loanScheduleFactory;
this.applicationCurrency = applicationCurrency; this.applicationCurrency = applicationCurrency;
@@ -64,9 +65,9 @@ public class ScheduleGeneratorDTO {
this.calendar = calendar; this.calendar = calendar;
this.calendarHistoryDataWrapper = calendarHistoryDataWrapper; this.calendarHistoryDataWrapper = calendarHistoryDataWrapper;
this.isInterestChargedFromDateAsDisbursementDateEnabled = isInterestChargedFromDateAsDisbursementDateEnabled; this.isInterestChargedFromDateAsDisbursementDateEnabled = isInterestChargedFromDateAsDisbursementDateEnabled;
this.numberOfdays = numberOfdays; this.numberOfdays = numberOfdays;
this.isSkipRepaymentOnFirstDayofMonth = isSkipRepaymentOnFirstDayofMonth; this.isSkipRepaymentOnFirstDayofMonth = isSkipRepaymentOnFirstDayofMonth;
this.isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled = isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled;
} }
public LoanScheduleGeneratorFactory getLoanScheduleFactory() { public LoanScheduleGeneratorFactory getLoanScheduleFactory() {
@@ -136,5 +137,9 @@ public class ScheduleGeneratorDTO {
public boolean isSkipRepaymentOnFirstDayofMonth() { public boolean isSkipRepaymentOnFirstDayofMonth() {
return isSkipRepaymentOnFirstDayofMonth; return isSkipRepaymentOnFirstDayofMonth;
} }
public Boolean isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled() {
return this.isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled;
}
} }
@@ -2348,8 +2348,13 @@ public class Loan extends AbstractPersistable<Long> {
if (this.loanProduct.isMultiDisburseLoan()) { if (this.loanProduct.isMultiDisburseLoan()) {
final Date dateValue = null; final Date dateValue = null;
final boolean isSpecificToInstallment = false; final boolean isSpecificToInstallment = false;
final Boolean isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled = scheduleGeneratorDTO.isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled();
Date effectiveDateFrom = actualDisbursementDate.toDate();
if(!isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled && actualDisbursementDate.equals(nextPossibleRepaymentDate)){
effectiveDateFrom = nextPossibleRepaymentDate.plusDays(1).toDate();
}
LoanTermVariations loanVariationTerms = new LoanTermVariations(LoanTermVariationType.EMI_AMOUNT.getValue(), LoanTermVariations loanVariationTerms = new LoanTermVariations(LoanTermVariationType.EMI_AMOUNT.getValue(),
actualDisbursementDate.toDate(), emiAmount, dateValue, isSpecificToInstallment, this, LoanStatus.ACTIVE.getValue()); effectiveDateFrom, emiAmount, dateValue, isSpecificToInstallment, this, LoanStatus.ACTIVE.getValue());
this.loanTermVariations.add(loanVariationTerms); this.loanTermVariations.add(loanVariationTerms);
} else { } else {
this.fixedEmiAmount = emiAmount; this.fixedEmiAmount = emiAmount;
@@ -5069,7 +5074,7 @@ public class Loan extends AbstractPersistable<Long> {
this.loanProduct.getInstallmentAmountInMultiplesOf(), recalculationFrequencyType, restCalendarInstance, compoundingMethod, this.loanProduct.getInstallmentAmountInMultiplesOf(), recalculationFrequencyType, restCalendarInstance, compoundingMethod,
compoundingCalendarInstance, compoundingFrequencyType, this.loanProduct.preCloseInterestCalculationStrategy(), compoundingCalendarInstance, compoundingFrequencyType, this.loanProduct.preCloseInterestCalculationStrategy(),
rescheduleStrategyMethod, calendar, getApprovedPrincipal(), annualNominalInterestRate, loanTermVariations, calendarHistoryDataWrapper, rescheduleStrategyMethod, calendar, getApprovedPrincipal(), annualNominalInterestRate, loanTermVariations, calendarHistoryDataWrapper,
scheduleGeneratorDTO.getNumberOfdays(), scheduleGeneratorDTO.isSkipRepaymentOnFirstDayofMonth()); scheduleGeneratorDTO.getNumberOfdays(), scheduleGeneratorDTO.isSkipRepaymentOnFirstDayofMonth());
return loanApplicationTerms; return loanApplicationTerms;
} }
@@ -5226,6 +5231,7 @@ public class Loan extends AbstractPersistable<Long> {
* TODO * TODO
* @param floatingRateDTO * @param floatingRateDTO
* TODO * TODO
* @param isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled
* @param loanCalendarInstance * @param loanCalendarInstance
* Used for accessing the loan's calendar object * Used for accessing the loan's calendar object
* @return application terms of the Loan object * @return application terms of the Loan object
@@ -136,11 +136,12 @@ public class LoanUtilService {
isSkipRepaymentOnFirstMonth = isLoanRepaymentsSyncWithMeeting(loan.group(), calendar); isSkipRepaymentOnFirstMonth = isLoanRepaymentsSyncWithMeeting(loan.group(), calendar);
if(isSkipRepaymentOnFirstMonth) { numberOfDays = configurationDomainService.retreivePeroidInNumberOfDaysForSkipMeetingDate().intValue(); } if(isSkipRepaymentOnFirstMonth) { numberOfDays = configurationDomainService.retreivePeroidInNumberOfDaysForSkipMeetingDate().intValue(); }
} }
final Boolean isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled = this.configurationDomainService.isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled();
ScheduleGeneratorDTO scheduleGeneratorDTO = new ScheduleGeneratorDTO(loanScheduleFactory, applicationCurrency, ScheduleGeneratorDTO scheduleGeneratorDTO = new ScheduleGeneratorDTO(loanScheduleFactory, applicationCurrency,
calculatedRepaymentsStartingFromDate, holidayDetails, restCalendarInstance, compoundingCalendarInstance, recalculateFrom, calculatedRepaymentsStartingFromDate, holidayDetails, restCalendarInstance, compoundingCalendarInstance, recalculateFrom,
overdurPenaltyWaitPeriod, floatingRateDTO, calendar, calendarHistoryDataWrapper, isInterestChargedFromDateAsDisbursementDateEnabled, overdurPenaltyWaitPeriod, floatingRateDTO, calendar, calendarHistoryDataWrapper, isInterestChargedFromDateAsDisbursementDateEnabled,
numberOfDays, isSkipRepaymentOnFirstMonth); numberOfDays, isSkipRepaymentOnFirstMonth, isChangeEmiIfRepaymentDateSameAsDisbursementDateEnabled);
return scheduleGeneratorDTO; return scheduleGeneratorDTO;
} }
@@ -0,0 +1,4 @@
ALTER TABLE `c_configuration`
CHANGE COLUMN `name` `name` VARCHAR(100) NULL DEFAULT NULL AFTER `id`;
INSERT INTO `c_configuration` (`name`, `value`, `date_value`, `enabled`, `is_trap_door`, `description`) VALUES ( 'change-emi-if-repaymentdate-same-as-disbursementdate', 0, NULL, 1, 0, 'In tranche loans, if repayment date is same as tranche disbursement date then allow to change the emi amount');