예제 #1
0
  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();
  }
예제 #2
0
  @Override // implements abstract method
  public NVPList buildRequest(PaymentDTOEx payment, SvcType transaction)
      throws PluggableTaskException {
    NVPList request = new NVPList();

    request.add(PARAMETER_MERCHANT_ID, getMerchantId());
    request.add(PARAMETER_STORE_ID, getStoreId());
    request.add(PARAMETER_TERMINAL_ID, getTerminalId());
    request.add(PARAMETER_SELLER_ID, getSellerId());
    request.add(PARAMETER_PASSWORD, getPassword());

    ContactBL contact = new ContactBL();
    contact.set(payment.getUserId());

    request.add(WorldPayParams.General.STREET_ADDRESS, contact.getEntity().getAddress1());
    request.add(WorldPayParams.General.CITY, contact.getEntity().getCity());
    request.add(WorldPayParams.General.STATE, contact.getEntity().getStateProvince());
    request.add(WorldPayParams.General.ZIP, contact.getEntity().getPostalCode());

    request.add(WorldPayParams.General.FIRST_NAME, contact.getEntity().getFirstName());
    request.add(WorldPayParams.General.LAST_NAME, contact.getEntity().getLastName());
    request.add(WorldPayParams.General.COUNTRY, contact.getEntity().getCountryCode());

    request.add(WorldPayParams.General.AMOUNT, formatDollarAmount(payment.getAmount()));
    request.add(WorldPayParams.General.SVC_TYPE, transaction.getCode());

    CreditCardDTO card = payment.getCreditCard();
    request.add(WorldPayParams.CreditCard.CARD_NUMBER, card.getNumber());
    request.add(
        WorldPayParams.CreditCard.EXPIRATION_DATE,
        EXPIRATION_DATE_FORMAT.format(card.getCcExpiry()));

    if (card.getSecurityCode() != null) {
      request.add(
          WorldPayParams.CreditCard.CVV2,
          String.valueOf(payment.getCreditCard().getSecurityCode()));
    }

    return request;
  }
예제 #3
0
  private Result doFakeAuthorization(PaymentDTOEx payment, String transactionId)
      throws PluggableTaskException {
    CreditCardDTO creditCard = payment.getCreditCard();
    if (creditCard == null || !myFilter.accept(creditCard)) {
      // give real processors a chance
      return new Result(null, true);
    }

    Integer resultId = getProcessResultId(creditCard);
    payment.setPaymentResult(new PaymentResultDAS().find(resultId));
    PaymentAuthorizationDTO authInfo = createAuthorizationDTO(resultId, transactionId);
    storeProcessedAuthorization(payment, authInfo);

    boolean wasProcessed =
        (Constants.RESULT_FAIL.equals(resultId) || Constants.RESULT_OK.equals(resultId));
    boolean shouldCallOthers = !wasProcessed && !myShouldBlockOtherProcessors;
    return new Result(authInfo, shouldCallOthers);
  }