paymentMessage = MESSAGE_NOTIMPLEMENTED;
throw new NotImplementedException("");
}
public void authorizeAndCapturePayment(InvoiceHeader invoiceHeader, HttpServletRequest request) throws AuthorizationException, PaymentException, Exception {
GatewayConnector connector = new GatewayConnector();
int mode = GatewayRequest.REQUEST_METHOD_CVN;
if (isProduction()) {
connector.setGatewayUrlCVN(SERVICE_URL_PRODUCTION);
}
else {
connector.setGatewayUrlCVN(SERVICE_URL_SANDBOX);
}
OrderHeader orderHeader = invoiceHeader.getOrderHeader();
OrderAddress billingAddress = orderHeader.getBillingAddress();
if (billingAddress.getCustUseAddress().equals(Constants.CUST_ADDRESS_USE_CUST)) {
billingAddress = orderHeader.getCustAddress();
}
OrderAddress shippingAddress = orderHeader.getBillingAddress();
if (shippingAddress.getCustUseAddress().equals(Constants.CUST_ADDRESS_USE_BILL)) {
shippingAddress = billingAddress;
}
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());
paymentMessage = response.getTrxnError();
throw new AuthorizationException(response.getTrxnError());