String url = SERVICE_URL_SANDBOX;
if (isProduction()) {
url = SERVICE_URL_PRODUCTION;
}
Result result = null;
try {
result = callWebService(url, order);
}
catch (Exception e) {
logger.error(e);;
throw new PaymentException(e.getMessage());
}
String approved = result.getApproved();
if (!approved.equals(RESULT_APPROVED)) {
paymentMessage = result.getErrMsg();
throw new AuthorizationException(approved + " - " + result.getErrMsg());
}
String transactionId = result.getReturnCode();
String ids[] = transactionId.split(":");
authCode = ids[1];
paymentReference1 = transactionId;
paymentReference2 = result.getTransRefNumber();
paymentReference3 = result.getOrderID();
paymentType = result.getPaymentType();
}