public boolean confirmPreAuth(PaymentAuthorizationDTO auth, PaymentDTOEx payment)
      throws PluggableTaskException {

    LOG.debug("Confirming pre-authorization for " + getProcessorName() + " gateway");

    if (!getProcessorName().equals(auth.getProcessor())) {
      /*  let the processor be called and fail, so the caller can do something
      about it: probably re-call this payment task as a new "process()" run */
      LOG.warn(
          "The processor of the pre-auth is not "
              + getProcessorName()
              + ", is "
              + auth.getProcessor());
    }

    CreditCardDTO card = payment.getCreditCard();
    if (card == null) {
      throw new PluggableTaskException(
          "Credit card is required capturing" + " payment: " + payment.getId());
    }

    if (!isApplicable(payment)) {
      LOG.error("This payment can not be captured" + payment);
      return true;
    }

    return doProcess(payment, SvcType.SETTLE, auth).shouldCallOtherProcessors();
  }
  public PaymentAuthorizationDTO create(String processor, String code1) {

    PaymentAuthorizationDTO auto = new PaymentAuthorizationDTO();
    auto.setProcessor(processor);
    auto.setCode1(code1);
    auto.setCreateDate(Calendar.getInstance().getTime());

    return save(auto);
  }
Esempio n. 3
0
 private PaymentAuthorizationDTO createAuthorizationDTO(
     boolean isAuthorized, String transactionId) {
   PaymentAuthorizationDTO auth = new PaymentAuthorizationDTO();
   auth.setProcessor(getFakeProcessorName());
   auth.setCode1(getFakeCode1());
   auth.setTransactionId(transactionId);
   auth.setResponseMessage(
       isAuthorized ? "The transaction has been approved" : "Transaction failed");
   return auth;
 }
Esempio n. 4
0
  public boolean confirmPreAuth(PaymentAuthorizationDTO auth, PaymentDTOEx paymentInfo)
      throws PluggableTaskException {
    LOG.debug("confirmPreAuth" + auth + " payment " + paymentInfo);
    if (!getFakeProcessorName().equals(auth.getProcessor())) {
      LOG.warn(
          "name of processor does not match " + getFakeProcessorName() + " " + auth.getProcessor());
    }

    if (!isPreAuthTransactionId(auth.getTransactionId())) {
      LOG.warn(
          "AuthorizationDTOEx with transaction id: "
              + auth.getTransactionId()
              + " is used as preauth data");
    }

    Result result = doFakeAuthorization(paymentInfo, null);

    LOG.debug("returning " + result);
    return result.shouldCallOtherProcessors();
  }