Exemplo n.º 1
0
  public GatewayResponse addProduct(AccountBean bean) throws Exception {
    Account account = bean.getAccount();
    User user = bean.getOwner();
    CreditCard newCard = bean.getCreditCard();
    GatewayResponse g = new GatewayResponse();
    try {
      accountService.addProductToAccount(account, bean.getSelectedPlans(), user, newCard);
      g.setSuccess(true);
    } catch (Exception e) {
      logger.warn(ErrorUtil.getErrorDetail(e));
      g.setSuccess(false);
      g.setResponseText(e.getMessage() + "\n" + g.getResponseText());
    }

    logger.warn("Account updated: " + g.isSuccess());

    return g;
  }
Exemplo n.º 2
0
  /**
   * Creates a new account and starts billing by calling AccountService.createNewAccount()
   *
   * @param bean
   * @return
   * @throws Exception
   */
  public GatewayResponse createAndCharge(AccountBean bean) throws Exception {
    Account account = bean.getAccount();
    User user = bean.getOwner();

    // GatewayReponse is showing up here because the AccountService did not use to perform
    // all steps.  the charge used to happen here.  Need to clean this up.
    GatewayResponse g = new GatewayResponse();
    try {
      accountService.createNewAccount(account, bean.getSelectedPlans(), user, bean.getCreditCard());

      g.setSuccess(true);
    } catch (Exception e) {
      logger.warn(ErrorUtil.getErrorDetail(e));
      g.setSuccess(false);
      g.setResponseText(e.getMessage() + "\n" + g.getResponseText());
    }

    logger.warn("Account created: " + g.isSuccess());

    return g;
  }