.verbose(true);
gateway = new Gateway(settings);
try {
GatewayRequest pRequest = new GatewayRequest(TransactionType.PREAUTH)
.cardData(
new CcData()
.setCcNum("4012888812348882")
.setExpDate("12/12")
.setCvv("123")
)
.amount("0.3")
.setParameter("invoice_number", "123456")
.setParameter("client_reference_number", "Java SDK Test");
GatewayResponse pResponse = gateway.run(pRequest);
LOG.log(Level.INFO, pResponse.toString());
// If capturing in under 15 seconds, use Sale. Otherwise, the result may be "Invalid transaction ID"
LOG.log(Level.INFO, "Pausing for 15.0 seconds...");
Thread.sleep(15000);
if(pResponse.isApproved()) {
GatewayRequest sRequest = new GatewayRequest(TransactionType.SETTLE)
.setParameter("transaction_id", pResponse.getResponseValue("transaction_id"))
.amount("0.03");
GatewayResponse sResponse = gateway.run(sRequest);
LOG.log(Level.INFO, sResponse.toString());