String redirectString = null;
try {
IdealConnector connector = new IdealConnector("payment");
Transaction transaction = new Transaction();
transaction.setIssuerID(issuerId);
transaction.setAmount(amount);
transaction.setPurchaseID(orderId);
transaction.setDescription(orderDescription);
String returnURL = merchantReturnURL + "?orderId=" + orderId;
Random random = new Random();
String EntranceCode = Long.toString(Math.abs(random.nextLong()), 36);
transaction.setEntranceCode(EntranceCode);
transaction.setMerchantReturnURL(returnURL);
Transaction trx = connector.requestTransaction(transaction);
redirectString = trx.getIssuerAuthenticationURL();
request.getSession().setAttribute("purchaseID", orderId);
request.getSession().setAttribute("payAmount", orderTotal.toPlainString());
} catch (IdealException ex) {
Debug.logError(ex.getMessage(), module);
request.setAttribute("_ERROR_MESSAGE_", ex.getConsumerMessage());