Pages

Hot News

Monday 25 May 2015

EBS Payment integration with Liferay Portal

Hi Guys,

Today, I am going to represent and explain you how to integrate payment system in Liferay Portal

Please find the attached document and refer it. Then follow below instructions for EBS payment integration with Liferay Portal.

Step 1,

public class FLEBSIntegrationConstants {
public static final String ACTION_PAYMENT = "ebsPaymentResponse";
public static final String PAGE_PAYMENT = "/html/flebsintegration/pay.jsp";
public static final String PAGE_SUCCESS = "/html/flebsintegration/success.jsp";
public static final String PAGE_RESPONSE = "/html/flebsintegration/response.jsp";
public static final String RESPONSE = "response.jsp";
}

Step 2,

Create view.jsp in your portlet

This is the <b>Flebs Integration</b> portlet in View mode.
<portlet:renderURL var="ebsPaymentURL">
<portlet:param name="jspPage" value="<%=FLEBSIntegrationConstants.PAGE_PAYMENT %>" />
</portlet:renderURL>

<br />
<a href="${ebsPaymentURL}">Click Here for Payment &raquo;</a>

Step 3,
In controller class, Action Method of Pay.jsp
/*
* i. Credentials to test the payment
Card Number – 4111111111111111
Expiry – 07/16
CVV – 123
Bank – EBS

   ii.  Payment Request URL:
Test – https://testing.secure.ebs.in/pg/ma/sale/pay
Production – https://secure.ebs.in/pg/ma/sale/pay

or

Test – https://testing.secure.ebs.in/pg/ma/sale/vpc
Production – https://secure.ebs.in/pg/ma/sale/vpc

   iii. Merchant Login URL
Test – https://testing.secure.ebs.in
Production – https://secure.ebs.in

* API Request URL
* Test – https://testing.secure.ebs.in/api/1_0
* Production – https://secure.ebs.in/api/1_0
*/

public void ebsPaymentResponse(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException, PortletException {
String DR = (String)actionRequest.getParameter("DR");
System.out.println("---------DR-----------" +DR);

/////
String key = "ebskey"; //Your Secret Key
StringBuffer data1 = new StringBuffer().append(DR);
for (int i=0; i < data1.length(); i++){
if(data1.charAt(i)== ' ')
data1.setCharAt(i,'+');
}
Base64 base64 = new Base64();
byte[] data = base64.decode(data1.toString());
RC4 rc4 = new RC4(key);
byte[] result = rc4.rc4(data);


ByteArrayInputStream byteIn = new ByteArrayInputStream (result, 0, result.length);
DataInputStream dataIn = new DataInputStream (byteIn);
String recvString1 = "";
String recvString = "";
recvString1 = dataIn.readLine();
int i =0;
while(recvString1 != null ){
i++;
if(i > 705) break;
recvString += recvString1 + "\n";
recvString1 = dataIn.readLine();
}
recvString  = recvString.replace( "=&","=--&" ) ;
System.out.println("--------RECVSTR---------" +recvString);
////
StringTokenizer st = new StringTokenizer(recvString, "=&");
String field ,val;
while(st.hasMoreTokens()) {
field = st.nextToken();

val = st.nextToken();

System.out.print(field+" :--->");
System.out.println(val);

}

PortalUtil.copyRequestParameters(actionRequest, actionResponse);
actionResponse.setRenderParameter("mvcPath", FLEBSIntegrationConstants.RESPONSE);

}

Step 4, response.jsp

hello, <%=request.getParameter("DR")%>



That's All !!
Let me know if u have any suggestions/queries, I would like to hear from your side.


Download Source Code
EBS Payment Guide





No comments:

Post a Comment