@Override
public SavingsAccountTransaction deposit(final SavingsAccountTransactionDTO transactionDTO) {
if (isAccountMatured()) {
final String defaultUserMessage = "Transaction is not allowed. Account is matured.";
final ApiParameterError error = ApiParameterError.parameterError(
"error.msg.recurring.deposit.account.transaction.account.is.matured", defaultUserMessage, "transactionDate",
transactionDTO.getTransactionDate().toString(transactionDTO.getFormatter()));
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
dataValidationErrors.add(error);
throw new PlatformApiDataValidationException(dataValidationErrors);
}
if (!isBeforeMaturityDate(transactionDTO.getTransactionDate())) {
final String defaultUserMessage = "Transaction is not allowed. Transaction date is on or after account maturity date.";
final ApiParameterError error = ApiParameterError.parameterError(
"error.msg.recurring.deposit.account.transaction.date.is.after.account.maturity.date", defaultUserMessage,
"transactionDate", transactionDTO.getTransactionDate().toString(transactionDTO.getFormatter()));
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
dataValidationErrors.add(error);
throw new PlatformApiDataValidationException(dataValidationErrors);
}
if (isBeforeDepositStartDate(transactionDTO.getTransactionDate())) {
final String defaultUserMessage = "Transaction is not allowed. Transaction date is on or after account activation and deposit start date.";
final ApiParameterError error = ApiParameterError.parameterError(
"error.msg.recurring.deposit.account.transaction.date.is.before.account.activation.or.deposit.date",
defaultUserMessage, "transactionDate", transactionDTO.getTransactionDate().toString(transactionDTO.getFormatter()));
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
dataValidationErrors.add(error);