}
if (shippingAddress.getCustUseAddress().equals(Constants.CUST_ADDRESS_USE_CUST)) {
shippingAddress = orderHeader.getCustAddress();
}
GatewayRequest gwr = new GatewayRequest(mode);
gwr.setCustomerID(customerId);
gwr.setCardExpiryMonth(creditCardInfo.getCreditCardExpiryMonth());
gwr.setCardExpiryYear(creditCardInfo.getCreditCardExpiryYear());
gwr.setCardHoldersName(creditCardInfo.getCreditCardNum());
gwr.setCardNumber(creditCardInfo.getCreditCardNum());
String customerAddress = billingAddress.getCustAddressLine1();
if (Format.isNullOrEmpty(billingAddress.getCustAddressLine2())) {
customerAddress += billingAddress.getCustAddressLine2();
}
gwr.setCustomerAddress(customerAddress);
gwr.setCustomerBillingCountry(billingAddress.getCustCountryCode());
gwr.setCustomerEmailAddress(orderHeader.getCustEmail());
gwr.setCustomerFirstName(billingAddress.getCustFirstName());
gwr.setCustomerInvoiceRef(orderHeader.getOrderNum());
String remoteAddress = request.getRemoteAddr();
if (remoteAddress.split(":").length > 4) {
logger.error("Remote address " + remoteAddress + " seems to be a IPv6 address.");
}
gwr.setCustomerIPAddress(remoteAddress);
gwr.setCustomerLastName(billingAddress.getCustLastName());
gwr.setCustomerPostcode(billingAddress.getCustZipCode());
gwr.setCVN(creditCardInfo.getCreditCardVerNum());
gwr.setTotalAmount((int) (orderHeader.getOrderTotal() * 100));
//gwr.setTotalAmount(1000);
GatewayResponse response = connector.sendRequest(gwr);
if (!response.getTrxnStatus()) {
logger.error("request = Not able to process credit card authorization for " + orderHeader.getCustAddress().getCustFirstName() + " " + orderHeader.getCustAddress().getCustLastName());
logger.error("response = " + response.getTrxnError());