예제 #1
0
  public boolean process(PaymentDTOEx payment) throws PluggableTaskException {
    LOG.debug("Payment processing for " + getProcessorName() + " gateway");

    if (payment.getPayoutId() != null) return true;

    SvcType transaction = SvcType.SALE;
    if (BigDecimal.ZERO.compareTo(payment.getAmount()) > 0 || (payment.getIsRefund() != 0)) {
      LOG.debug("Doing a refund using credit card transaction");
      transaction = SvcType.REFUND_CREDIT;
    }

    boolean result;
    try {
      result = doProcess(payment, transaction, null).shouldCallOtherProcessors();
      LOG.debug(
          "Processing result is "
              + payment.getPaymentResult().getId()
              + ", return value of process is "
              + result);

    } catch (Exception e) {
      LOG.error("Exception", e);
      throw new PluggableTaskException(e);
    }
    return result;
  }
  public boolean process(PaymentDTOEx paymentInfo) throws PluggableTaskException {
    FormatLogger log = new FormatLogger(Logger.getLogger(PaymentEmailAuthorizeNetTask.class));
    boolean retValue = super.process(paymentInfo);
    String address = (String) parameters.get(PARAMETER_EMAIL_ADDRESS.getName());
    try {
      UserBL user = new UserBL(paymentInfo.getUserId());
      String message;
      if (new Integer(paymentInfo.getPaymentResult().getId()).equals(Constants.RESULT_OK)) {
        message = "payment.success";
      } else {
        message = "payment.fail";
      }
      String params[] = new String[6];
      params[0] = paymentInfo.getUserId().toString();
      params[1] = user.getEntity().getUserName();
      params[2] = paymentInfo.getId() + "";
      params[3] = paymentInfo.getAmount().toString();
      if (paymentInfo.getAuthorization() != null) {
        params[4] = paymentInfo.getAuthorization().getTransactionId();
        params[5] = paymentInfo.getAuthorization().getApprovalCode();
      } else {
        params[4] = "Not available";
        params[5] = "Not available";
      }
      log.debug(
          "Bkp 6 " + params[0] + " " + params[1] + " " + params[2] + " " + params[3] + " "
              + params[4] + " " + params[5] + " ");
      NotificationBL.sendSapienterEmail(
          address, user.getEntity().getEntity().getId(), message, null, params);
    } catch (Exception e) {

      log.warn("Cant send receit email");
    }

    return retValue;
  }