@Override
 protected void validateForm(final ActionContext context) {
   if (shouldValidateTransactionPassword(context, resolveTransfer(context))) {
     final ScheduledPaymentForm form = context.getForm();
     if (StringUtils.isEmpty(form.getTransactionPassword())) {
       throw new ValidationException(
           "_transactionPassword", "login.transactionPassword", new RequiredError());
     }
   }
 }
 private Transfer resolveTransfer(final ActionContext context) {
   final ScheduledPaymentForm form = context.getForm();
   final Long transferId = form.getTransferId();
   if (transferId <= 0L) {
     throw new ValidationException();
   }
   return paymentService.load(
       transferId,
       RelationshipHelper.nested(Payment.Relationships.FROM, MemberAccount.Relationships.MEMBER),
       RelationshipHelper.nested(Payment.Relationships.TO, MemberAccount.Relationships.MEMBER),
       RelationshipHelper.nested(
           Transfer.Relationships.SCHEDULED_PAYMENT, ScheduledPayment.Relationships.TRANSFERS));
 }
  @Override
  protected ActionForward handleSubmit(final ActionContext context) throws Exception {
    Transfer transfer = resolveTransfer(context);

    // Validate the transaction password if needed
    if (shouldValidateTransactionPassword(context, transfer)) {
      final ScheduledPaymentForm form = context.getForm();
      context.checkTransactionPassword(form.getTransactionPassword());
    }

    // Perform the actual payment
    try {
      transfer = scheduledPaymentService.processTransfer(transfer);
    } catch (final CreditsException e) {
      return context.sendError(actionHelper.resolveErrorKey(e), actionHelper.resolveParameters(e));
    } catch (final UnexpectedEntityException e) {
      return context.sendError("payment.error.invalidTransferType");
    }
    return ActionHelper.redirectWithParam(
        context.getRequest(),
        context.getSuccessForward(),
        "paymentId",
        transfer.getScheduledPayment().getId());
  }