Merge pull request #1511 from nazeer1100126/DisablingReschedule

MIFOSX-2258
This commit is contained in:
Adi Narayana Raju
2015-09-21 19:43:59 +05:30
3 changed files with 18 additions and 3 deletions
@@ -1477,10 +1477,14 @@ public class Loan extends AbstractPersistable<Long> {
} }
} }
private boolean isInterestRecalculationEnabledForProduct() { public boolean isInterestRecalculationEnabledForProduct() {
return this.loanProduct.isInterestRecalculationEnabled(); return this.loanProduct.isInterestRecalculationEnabled();
} }
public boolean isMultiDisburmentLoan() {
return this.loanProduct.isMultiDisburseLoan() ;
}
/** /**
* Update interest recalculation settings if product configuration changes * Update interest recalculation settings if product configuration changes
*/ */
@@ -31,6 +31,8 @@ public class RescheduleLoansApiConstants {
public static final String rescheduleReasonCommentParamName = "rescheduleReasonComment"; public static final String rescheduleReasonCommentParamName = "rescheduleReasonComment";
public static final String submittedOnDateParamName = "submittedOnDate"; public static final String submittedOnDateParamName = "submittedOnDate";
public static final String adjustedDueDateParamName = "adjustedDueDate"; public static final String adjustedDueDateParamName = "adjustedDueDate";
public static final String resheduleForMultiDisbursementNotSupportedErrorCode = "loan.reschedule.multidisbursement.error.code";
public static final String resheduleWithInterestRecalculationNotSupportedErrorCode = "loan.reschedule.interestrecalculation.error.code";
public static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, public static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName,
graceOnPrincipalParamName, graceOnInterestParamName, extraTermsParamName, rescheduleFromDateParamName, graceOnPrincipalParamName, graceOnInterestParamName, extraTermsParamName, rescheduleFromDateParamName,
@@ -161,6 +161,15 @@ public class LoanRescheduleRequestDataValidator {
"The loan can only be rescheduled once."); "The loan can only be rescheduled once.");
} }
} }
if(loan.isMultiDisburmentLoan()) {
dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(RescheduleLoansApiConstants.resheduleForMultiDisbursementNotSupportedErrorCode,
"Loan rescheduling is not supported for multidisbursement loans");
}
if(loan.isInterestRecalculationEnabledForProduct()) {
dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(RescheduleLoansApiConstants.resheduleWithInterestRecalculationNotSupportedErrorCode,
"Loan rescheduling is not supported for the loan product with interest recalculation enabled");
}
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
} }