Example #1
0
  // goes to summary page
  public String subscribe() {

    try {

      preparePage();
      validateCustomer();

      SessionUtil.setCustomer(customer, getServletRequest());

      prepareZones();

      if (this.getPaymentMethod() == null
          || this.getPaymentMethod().getPaymentModuleName() == null) {
        super.addActionError("error.nopaymentmethod");
        return INPUT;
      }

      super.getServletRequest().setAttribute("SELECTEDPAYMENT", this.getPaymentMethod());

      MerchantStore store = SessionUtil.getMerchantStore(getServletRequest());

      // check if payment method is credit card type
      if (com.salesmanager.core.util.PaymentUtil.isPaymentModuleCreditCardType(
          this.getPaymentMethod().getPaymentModuleName())) {
        super.validateCreditCard(this.getPaymentMethod(), store.getMerchantId());
      } else {
        super.setCreditCard(null); // reset credit card information
      }

      if (getFieldErrors().size() > 0) {
        return INPUT;
      }

      SessionUtil.setPaymentMethod(this.getPaymentMethod(), getServletRequest());

    } catch (Exception e) {
      log.error(e);
      super.addActionError(getText("error.process.notransaction"));
      return "GLOBALERROR";
    }

    return SUCCESS;
  }