savings ac getting activated before client activation date fixed
This commit is contained in:
committed by
Keith Woodlock
parent
4dbd0cf7fd
commit
01d0772261
+9
@@ -58,6 +58,7 @@ import org.mifosplatform.portfolio.loanproduct.domain.PeriodFrequencyType;
|
||||
import org.mifosplatform.portfolio.paymentdetail.domain.PaymentDetail;
|
||||
import org.mifosplatform.portfolio.savings.api.SavingsApiConstants;
|
||||
import org.mifosplatform.portfolio.savings.exception.InsufficientAccountBalanceException;
|
||||
import org.mifosplatform.portfolio.savings.exception.InvalidSavingsAccountStateTransitionException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.jpa.domain.AbstractPersistable;
|
||||
@@ -300,6 +301,14 @@ public class SavingsAccount extends AbstractPersistable<Long> {
|
||||
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
|
||||
if(this.client.getActivationLocalDate().isAfter(activationDate))
|
||||
{
|
||||
final String errorMessage = "The date on which a savings account is activate cannot be before its client activated date: "
|
||||
+ this.client.getActivationLocalDate().toString();
|
||||
throw new InvalidSavingsAccountStateTransitionException("activate", "cannot.be.before.client.activation.date", errorMessage, activationDate,
|
||||
this.client.getActivationLocalDate());
|
||||
}
|
||||
|
||||
this.activationDate = activationDate.toDate();
|
||||
this.status = SavingsAccountStatusType.ACTIVE.getValue();
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package org.mifosplatform.portfolio.savings.exception;
|
||||
|
||||
import org.mifosplatform.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
|
||||
public class InvalidSavingsAccountStateTransitionException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
public InvalidSavingsAccountStateTransitionException(final String action, String postFix, String defaultUserMessage, Object... defaultUserMessageArgs) {
|
||||
super("error.msg.saving." + action + "." + postFix, defaultUserMessage, defaultUserMessageArgs);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user