Merge pull request #913 from pramodn02/MIFOSX-1187
MIFOSX-1187 - added null checks before compare with min and max values
This commit is contained in:
+1
-1
@@ -377,7 +377,7 @@ public class DepositProductDataValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Integer minDepositTermType = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(minDepositTermTypeIdParamName, element);
|
final Integer minDepositTermType = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(minDepositTermTypeIdParamName, element);
|
||||||
baseDataValidator.reset().parameter(minDepositTermTypeIdParamName).value(minDepositTermType)
|
baseDataValidator.reset().parameter(minDepositTermTypeIdParamName).value(minDepositTermType).ignoreIfNull()
|
||||||
.isOneOfTheseValues(SavingsPeriodFrequencyType.integerValues());
|
.isOneOfTheseValues(SavingsPeriodFrequencyType.integerValues());
|
||||||
|
|
||||||
if (fromApiJsonHelper.parameterExists(maxDepositTermTypeIdParamName, element)) {
|
if (fromApiJsonHelper.parameterExists(maxDepositTermTypeIdParamName, element)) {
|
||||||
|
|||||||
+6
-6
@@ -417,25 +417,25 @@ public class DepositProductAssembler {
|
|||||||
|
|
||||||
if (command.parameterExists(minDepositTermParamName)) {
|
if (command.parameterExists(minDepositTermParamName)) {
|
||||||
minDepositTerm = command.integerValueOfParameterNamed(minDepositTermParamName);
|
minDepositTerm = command.integerValueOfParameterNamed(minDepositTermParamName);
|
||||||
} else {
|
} else if(prodDepositTermDetail != null){
|
||||||
minDepositTerm = prodDepositTermDetail.minDepositTerm();
|
minDepositTerm = prodDepositTermDetail.minDepositTerm();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.parameterExists(maxDepositTermParamName)) {
|
if (command.parameterExists(maxDepositTermParamName)) {
|
||||||
maxDepositTerm = command.integerValueOfParameterNamed(maxDepositTermParamName);
|
maxDepositTerm = command.integerValueOfParameterNamed(maxDepositTermParamName);
|
||||||
} else {
|
} else if(prodDepositTermDetail != null){
|
||||||
maxDepositTerm = prodDepositTermDetail.maxDepositTerm();
|
maxDepositTerm = prodDepositTermDetail.maxDepositTerm();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.parameterExists(minDepositTermTypeIdParamName)) {
|
if (command.parameterExists(minDepositTermTypeIdParamName)) {
|
||||||
minDepositTermTypeId = command.integerValueOfParameterNamed(minDepositTermTypeIdParamName);
|
minDepositTermTypeId = command.integerValueOfParameterNamed(minDepositTermTypeIdParamName);
|
||||||
} else {
|
} else if(prodDepositTermDetail != null){
|
||||||
minDepositTermTypeId = prodDepositTermDetail.minDepositTermType();
|
minDepositTermTypeId = prodDepositTermDetail.minDepositTermType();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.parameterExists(maxDepositTermTypeIdParamName)) {
|
if (command.parameterExists(maxDepositTermTypeIdParamName)) {
|
||||||
maxDepositTermTypeId = command.integerValueOfParameterNamed(maxDepositTermTypeIdParamName);
|
maxDepositTermTypeId = command.integerValueOfParameterNamed(maxDepositTermTypeIdParamName);
|
||||||
} else {
|
} else if(prodDepositTermDetail != null){
|
||||||
maxDepositTermTypeId = prodDepositTermDetail.maxDepositTermType();
|
maxDepositTermTypeId = prodDepositTermDetail.maxDepositTermType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,13 +447,13 @@ public class DepositProductAssembler {
|
|||||||
|
|
||||||
if (command.parameterExists(inMultiplesOfDepositTermParamName)) {
|
if (command.parameterExists(inMultiplesOfDepositTermParamName)) {
|
||||||
inMultiplesOfDepositTerm = command.integerValueOfParameterNamed(inMultiplesOfDepositTermParamName);
|
inMultiplesOfDepositTerm = command.integerValueOfParameterNamed(inMultiplesOfDepositTermParamName);
|
||||||
} else {
|
} else if(prodDepositTermDetail != null){
|
||||||
inMultiplesOfDepositTerm = prodDepositTermDetail.inMultiplesOfDepositTerm();
|
inMultiplesOfDepositTerm = prodDepositTermDetail.inMultiplesOfDepositTerm();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.parameterExists(preClosurePenalApplicableParamName)) {
|
if (command.parameterExists(preClosurePenalApplicableParamName)) {
|
||||||
inMultiplesOfDepositTermTypeId = command.integerValueOfParameterNamed(inMultiplesOfDepositTermTypeIdParamName);
|
inMultiplesOfDepositTermTypeId = command.integerValueOfParameterNamed(inMultiplesOfDepositTermTypeIdParamName);
|
||||||
} else {
|
} else if(prodDepositTermDetail != null){
|
||||||
inMultiplesOfDepositTermTypeId = prodDepositTermDetail.inMultiplesOfDepositTermType();
|
inMultiplesOfDepositTermTypeId = prodDepositTermDetail.inMultiplesOfDepositTermType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -175,13 +175,13 @@ public class DepositTermDetail {
|
|||||||
private boolean isEqualOrGreaterThanMin(LocalDate depositStartDate, LocalDate depositEndDate) {
|
private boolean isEqualOrGreaterThanMin(LocalDate depositStartDate, LocalDate depositEndDate) {
|
||||||
final SavingsPeriodFrequencyType periodFrequencyType = SavingsPeriodFrequencyType.fromInt(this.minDepositTermType());
|
final SavingsPeriodFrequencyType periodFrequencyType = SavingsPeriodFrequencyType.fromInt(this.minDepositTermType());
|
||||||
final Integer depositPeriod = depositPeriod(depositStartDate, depositEndDate, periodFrequencyType);
|
final Integer depositPeriod = depositPeriod(depositStartDate, depositEndDate, periodFrequencyType);
|
||||||
return depositPeriod.compareTo(minDepositTerm()) >= 0;
|
return minDepositTerm() == null || depositPeriod.compareTo(minDepositTerm()) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEqualOrLessThanMax(LocalDate depositStartDate, LocalDate depositEndDate) {
|
private boolean isEqualOrLessThanMax(LocalDate depositStartDate, LocalDate depositEndDate) {
|
||||||
final SavingsPeriodFrequencyType periodFrequencyType = SavingsPeriodFrequencyType.fromInt(this.maxDepositTermType());
|
final SavingsPeriodFrequencyType periodFrequencyType = SavingsPeriodFrequencyType.fromInt(this.maxDepositTermType());
|
||||||
final Integer depositPeriod = depositPeriod(depositStartDate, depositEndDate, periodFrequencyType);
|
final Integer depositPeriod = depositPeriod(depositStartDate, depositEndDate, periodFrequencyType);
|
||||||
return depositPeriod.compareTo(maxDepositTerm()) <= 0;
|
return maxDepositTerm() == null || depositPeriod.compareTo(maxDepositTerm()) <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer depositPeriod(final LocalDate periodStartDate, final LocalDate periodEndDate,
|
public Integer depositPeriod(final LocalDate periodStartDate, final LocalDate periodEndDate,
|
||||||
|
|||||||
Reference in New Issue
Block a user