You need to sign in to do that
Don't have an account?
JAVA Translation
I have some JAVA code that I need to translate into something SFDC will compile.
I am a bit of a noob to all of this, so any guidance would be greatly appreciated.
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.StringTokenizer" %>
<%@ page import="com.qvalent.ccapi.CardsAPI" %>
<jsp:useBean id="cardsAPI" class="com.qvalent.ccapi.CardsAPI" scope="application"/>
<%
if ( !cardsAPI.isInitialised() )
{
final HashMap initParams = new HashMap();
initParams.put( "url", "https://ccapi.client.support.qvalent.com/post/CreditCardAPIReceiver" );
initParams.put( "certificateFile", "CERT_FILE" );
initParams.put( "logDirectory", "LOG_DIR" );
cardsAPI.initialise( initParams );
}
//----------------------------------------------------------------------------
// SET CONNECTION DEFAULTS
//----------------------------------------------------------------------------
String orderECI = "SSL";
String orderType = "capture";
String cardNumber = request.getParameter( "cardNumber" );
String cardVerificationNumber = request.getParameter( "cardVerificationNumber" );
String cardExpiryYear = request.getParameter( "cardExpiryYear" );
String cardExpiryMonth = request.getParameter( "cardExpiryMonth" );
String cardCurrency = "AUD";
int orderAmountCents =
(int)(Double.parseDouble( request.getParameter( "orderAmount" ) ) * 100 );
String customerUsername = "USER";
String customerPassword = "PASS";
String customerMerchant = "TEST";
String orderNumber = Long.toString( System.currentTimeMillis() );
//----------------------------------------------------------------------------
// INITIALISE REQUEST PARAMETERS
//----------------------------------------------------------------------------
HashMap requestParams = new HashMap();
requestParams.put( "customer.username", customerUsername );
requestParams.put( "customer.password", customerPassword );
requestParams.put( "customer.merchant", customerMerchant );
requestParams.put( "order.type", orderType );
requestParams.put( "card.PAN", cardNumber );
requestParams.put( "card.CVN", cardVerificationNumber );
requestParams.put( "card.expiryYear", cardExpiryYear );
requestParams.put( "card.expiryMonth", cardExpiryMonth );
requestParams.put( "order.amount", Long.toString( orderAmountCents ) );
requestParams.put( "customer.orderNumber", orderNumber );
requestParams.put( "card.currency", cardCurrency );
requestParams.put( "order.ECI", orderECI );
Map responseParameters = cardsAPI.processCreditCard( requestParams );
// Get the required parameters from the response
String summaryCode = (String)responseParameters.get( "response.summaryCode" );
String responseCode = (String)responseParameters.get( "response.responseCode" );
String description = (String)responseParameters.get( "response.text" );
String receiptNo = (String)responseParameters.get( "response.referenceNo" );
String settlementDate = (String)responseParameters.get( "response.settlementDate" );
String creditGroup = (String)responseParameters.get( "response.creditGroup" );
String cardSchemeName = (String)responseParameters.get( "response.cardSchemeName" );
%>