@Test public void testAuthPlusCapture() { assumeTrue(isTestAllowed()); String orderNum = UUID.randomUUID().toString(); CustomerOrder customerOrder = createCustomerOrder(orderNum); Assert.assertEquals(Payment.PAYMENT_STATUS_OK, paymentProcessor.authorize( customerOrder, false, false, createCardParameters())); assertEquals(2, customerOrderPaymentService.findPayments( orderNum, null, Payment.PAYMENT_STATUS_OK, PaymentGateway.AUTH).size()); Iterator<CustomerOrderDelivery> iter = customerOrder.getDelivery().iterator(); Assert.assertEquals(Payment.PAYMENT_STATUS_OK, paymentProcessor.shipmentComplete(customerOrder, iter.next().getDeliveryNum(), false)); assertEquals(1, customerOrderPaymentService.findPayments( orderNum, null, Payment.PAYMENT_STATUS_OK, PaymentGateway.CAPTURE).size()); Assert.assertEquals(Payment.PAYMENT_STATUS_OK, paymentProcessor.shipmentComplete(customerOrder, iter.next().getDeliveryNum(), false)); assertEquals(2, customerOrderPaymentService.findPayments( orderNum, null, Payment.PAYMENT_STATUS_OK, PaymentGateway.CAPTURE).size()); }
@Override public Payment authorize(final Payment payment, final boolean forceProcessing) { LOG.debug("Authorize: {}", payment); final HashMap<String, String> request = new HashMap<>(); request.put("ccAuthService_run", "true"); request.put("merchantReferenceCode", StringUtils.isBlank(payment.getTransactionReferenceId()) ? UUID.randomUUID().toString() : payment.getTransactionReferenceId() ); request.put("billTo_email", payment.getBillingEmail()); addAddress(request, "billTo_", payment.getBillingAddress()); addAddress(request, "shipTo_", payment.getShippingAddress()); if (CARD_LABEL_CODE_MAP.get(payment.getCardType()) != null) { request.put("card_cardType", CARD_LABEL_CODE_MAP.get(payment.getCardType())); } request.put("card_accountNumber", payment.getCardNumber()); request.put("card_expirationYear", payment.getCardExpireYear()); request.put("card_expirationMonth", payment.getCardExpireMonth()); if (payment.getCardCvv2Code() != null) { request.put("card_cvNumber", payment.getCardCvv2Code()); } populateItems(payment, request); return runTransaction(request, payment, AUTH); }
CyberSourcePaymentGatewayImpl extends AbstractCyberSourcePaymentGatewayImpl implements PaymentGatewayInternalForm { @Override public Payment authorize(final Payment payment, final boolean forceProcessing) { LOG.debug("Authorize: {}", payment); final HashMap<String, String> request = new HashMap<>(); request.put("ccAuthService_run", "true"); request.put("merchantReferenceCode", StringUtils.isBlank(payment.getTransactionReferenceId()) ? UUID.randomUUID().toString() : payment.getTransactionReferenceId() ); request.put("billTo_email", payment.getBillingEmail()); addAddress(request, "billTo_", payment.getBillingAddress()); addAddress(request, "shipTo_", payment.getShippingAddress()); if (CARD_LABEL_CODE_MAP.get(payment.getCardType()) != null) { request.put("card_cardType", CARD_LABEL_CODE_MAP.get(payment.getCardType())); } request.put("card_accountNumber", payment.getCardNumber()); request.put("card_expirationYear", payment.getCardExpireYear()); request.put("card_expirationMonth", payment.getCardExpireMonth()); if (payment.getCardCvv2Code() != null) { request.put("card_cvNumber", payment.getCardCvv2Code()); } populateItems(payment, request); return runTransaction(request, payment, AUTH); } }
CyberSourcePaymentGatewayImpl extends AbstractCyberSourcePaymentGatewayImpl implements PaymentGatewayInternalForm { @Override public Payment authorize(final Payment payment, final boolean forceProcessing) { LOG.debug("Authorize: {}", payment); final HashMap<String, String> request = new HashMap<>(); request.put("ccAuthService_run", "true"); request.put("merchantReferenceCode", StringUtils.isBlank(payment.getTransactionReferenceId()) ? UUID.randomUUID().toString() : payment.getTransactionReferenceId() ); request.put("billTo_email", payment.getBillingEmail()); addAddress(request, "billTo_", payment.getBillingAddress()); addAddress(request, "shipTo_", payment.getShippingAddress()); if (CARD_LABEL_CODE_MAP.get(payment.getCardType()) != null) { request.put("card_cardType", CARD_LABEL_CODE_MAP.get(payment.getCardType())); } request.put("card_accountNumber", payment.getCardNumber()); request.put("card_expirationYear", payment.getCardExpireYear()); request.put("card_expirationMonth", payment.getCardExpireMonth()); if (payment.getCardCvv2Code() != null) { request.put("card_cvNumber", payment.getCardCvv2Code()); } populateItems(payment, request); return runTransaction(request, payment, AUTH); }  }
CyberSourcePaymentGatewayImpl extends AbstractCyberSourcePaymentGatewayImpl implements PaymentGatewayInternalForm { @Override public Payment authorize(final Payment payment, final boolean forceProcessing) { LOG.debug("Authorize: {}", payment); final HashMap<String, String> request = new HashMap<>(); request.put("ccAuthService_run", "true"); request.put("merchantReferenceCode", StringUtils.isBlank(payment.getTransactionReferenceId()) ? UUID.randomUUID().toString() : payment.getTransactionReferenceId() ); request.put("billTo_email", payment.getBillingEmail()); addAddress(request, "billTo_", payment.getBillingAddress()); addAddress(request, "shipTo_", payment.getShippingAddress()); if (CARD_LABEL_CODE_MAP.get(payment.getCardType()) != null) { request.put("card_cardType", CARD_LABEL_CODE_MAP.get(payment.getCardType())); } request.put("card_accountNumber", payment.getCardNumber()); request.put("card_expirationYear", payment.getCardExpireYear()); request.put("card_expirationMonth", payment.getCardExpireMonth()); if (payment.getCardCvv2Code() != null) { request.put("card_cvNumber", payment.getCardCvv2Code()); } populateItems(payment, request); return runTransaction(request, payment, AUTH); }  @Override synchronized PaymentGatewayFeature getPaymentGatewayFeatures(); @Override Payment authorize(final Payment payment, final boolean forceProcessing); @Override Payment reverseAuthorization(final Payment payment, final boolean forceProcessing); @Override Payment capture(final Payment payment, final boolean forceProcessing); @Override Payment authorizeCapture(final Payment payment, final boolean forceProcessing); @Override Payment voidCapture(final Payment payment, final boolean forceProcessing); @Override Payment refund(final Payment payment, final boolean forceProcessing); }
CyberSourcePaymentGatewayImpl extends AbstractCyberSourcePaymentGatewayImpl implements PaymentGatewayInternalForm { @Override public Payment authorize(final Payment payment, final boolean forceProcessing) { LOG.debug("Authorize: {}", payment); final HashMap<String, String> request = new HashMap<>(); request.put("ccAuthService_run", "true"); request.put("merchantReferenceCode", StringUtils.isBlank(payment.getTransactionReferenceId()) ? UUID.randomUUID().toString() : payment.getTransactionReferenceId() ); request.put("billTo_email", payment.getBillingEmail()); addAddress(request, "billTo_", payment.getBillingAddress()); addAddress(request, "shipTo_", payment.getShippingAddress()); if (CARD_LABEL_CODE_MAP.get(payment.getCardType()) != null) { request.put("card_cardType", CARD_LABEL_CODE_MAP.get(payment.getCardType())); } request.put("card_accountNumber", payment.getCardNumber()); request.put("card_expirationYear", payment.getCardExpireYear()); request.put("card_expirationMonth", payment.getCardExpireMonth()); if (payment.getCardCvv2Code() != null) { request.put("card_cvNumber", payment.getCardCvv2Code()); } populateItems(payment, request); return runTransaction(request, payment, AUTH); }  @Override synchronized PaymentGatewayFeature getPaymentGatewayFeatures(); @Override Payment authorize(final Payment payment, final boolean forceProcessing); @Override Payment reverseAuthorization(final Payment payment, final boolean forceProcessing); @Override Payment capture(final Payment payment, final boolean forceProcessing); @Override Payment authorizeCapture(final Payment payment, final boolean forceProcessing); @Override Payment voidCapture(final Payment payment, final boolean forceProcessing); @Override Payment refund(final Payment payment, final boolean forceProcessing);  }