MIFOSX-2371 fixed days in year issue

This commit is contained in:
andrew-dzak
2015-12-04 21:32:31 +01:00
parent c50a45b2c8
commit 5384067737
@@ -786,10 +786,17 @@ public final class LoanApplicationTerms {
private long calculatePeriodsInOneYear(final PaymentPeriodsInOneYearCalculator calculator) {
long periodsInOneYear = calculator.calculate(this.repaymentPeriodFrequencyType).longValue();
//check if daysInYears is set if so change periodsInOneYear to days set in db
long periodsInOneYear;
boolean daysInYearToUse = (this.repaymentPeriodFrequencyType.getCode().equalsIgnoreCase("periodFrequencyType.days") && !this.daysInYearType.getCode().equalsIgnoreCase("DaysInYearType.actual"));
if(daysInYearToUse){
periodsInOneYear = this.daysInYearType.getValue().longValue();
}else{
periodsInOneYear = calculator.calculate(this.repaymentPeriodFrequencyType).longValue();
}
switch (this.interestCalculationPeriodMethod) {
case DAILY:
periodsInOneYear = calculator.calculate(PeriodFrequencyType.DAYS).longValue();
periodsInOneYear = (!this.daysInYearType.getCode().equalsIgnoreCase("DaysInYearType.actual")) ? this.daysInYearType.getValue().longValue() : calculator.calculate(PeriodFrequencyType.DAYS).longValue();
break;
case INVALID:
break;