AuthorizeNetAimPaymentGatewayImpl extends AbstractAuthorizeNetPaymentGatewayImpl implements PaymentGatewayInternalForm { @Override public Payment authorizeCapture(final Payment paymentIn, final boolean forceProcessing) { final Payment payment = (Payment) SerializationUtils.clone(paymentIn); payment.setTransactionOperation(AUTH_CAPTURE); final net.authorize.Merchant merchant = createMerchant(); final net.authorize.aim.Transaction transaction = merchant.createAIMTransaction( net.authorize.TransactionType.AUTH_CAPTURE, payment.getPaymentAmount() ); transaction.setCustomer(createAnetCustomer(payment)); transaction.setOrder(createAnetOrder(payment)); transaction.setCreditCard(createAnetCreditCard(payment)); transaction.setShippingAddress(createShippingAddress(payment)); return runTransaction(merchant, transaction, payment); }  @Override PaymentGatewayFeature getPaymentGatewayFeatures(); @Override Payment authorize(final Payment paymentIn, final boolean forceProcessing); @Override Payment reverseAuthorization(final Payment paymentIn, final boolean forceProcessing); @Override Payment voidCapture(final Payment paymentIn, final boolean forceProcessing); @Override Payment authorizeCapture(final Payment paymentIn, final boolean forceProcessing); @Override Payment capture(final Payment paymentIn, final boolean forceProcessing); @Override Payment refund(final Payment paymentIn, final boolean forceProcessing);  }
@Test public void testAuthCapture() { assumeTrue(isTestAllowed()); String orderNum = UUID.randomUUID().toString(); CustomerOrder customerOrder = createCustomerOrder(orderNum); assertEquals(Payment.PAYMENT_STATUS_OK, paymentProcessor.authorizeCapture( customerOrder, false, false, createCardParameters())); assertEquals(2, customerOrderPaymentService.findPayments( orderNum, null, Payment.PAYMENT_STATUS_OK, PaymentGateway.AUTH_CAPTURE).size()); }