String url = SERVICE_URL_SANDBOX;
if (isProduction()) {
url = SERVICE_URL_PRODUCTION;
}
TxnResult result = null;
try {
result = callWebService(url, order);
}
catch (Exception e) {
logger.error(e);;
throw new PaymentException(e.getMessage());
}
String approved = result.getResponseText();
if (!approved.equals(RESULT_APPROVED)) {
paymentMessage = result.getReCo() + ": " + approved;
throw new AuthorizationException(paymentMessage);
}
if (result.getTransaction() != null) authCode = result.getTransaction()[0].getAuthCode();
paymentReference1 = result.getDpsTxnRef();
paymentReference2 = result.getTxnRef();
paymentType = PAYMENT_TYPE;
return;
}