-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaIntergration.java
More file actions
104 lines (80 loc) · 3.56 KB
/
JavaIntergration.java
File metadata and controls
104 lines (80 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
import com.bhartipay.commons.crypto.ChecksumUtils;
public class JavaIntergration {
public static void main(String[] args) throws NoSuchAlgorithmException {
Map<String, String> map = new HashMap<String, String>();
map.put("AMOUNT", "1.00");
map.put("CURRENCY_CODE", "356");
map.put("CUST_EMAIL", "rohit.singh@bhartipay.com");
map.put("CUST_NAME", "BHARTIPAY DEMO");
map.put("CUST_PHONE", "8860705801");
map.put("CUST_STREET_ADDRESS1", "Gurgaon");
map.put("CUST_ZIP", "122016");
map.put("MERCHANTNAME", "BHARTIPAY Demo");
map.put("ORDER_ID", "BHARTI00001");
map.put("PAY_ID", "1804100638381010");
map.put("PRODUCT_DESC", "BHARTIPAY Demo Transaction");
map.put("RETURN_URL", "http://uat.bhartipay.com/crm/jsp/response.jsp");
map.put("TXNTYPE", "SALE");
// Secret Key eec2fd91c96b4ebb
String hash = ChecksumUtils.generateCheckSum(map, "eec2fd91c96b4ebb");
StringBuilder httpRequest = new StringBuilder();
httpRequest.append("<HTML>");
httpRequest.append("<BODY OnLoad=\"OnLoadEvent();\" >");
httpRequest.append("<form name=\"form1\" action=\"");
httpRequest.append("http://uat.bhartipay.com/crm/jsp/paymentrequest");
httpRequest.append("\" method=\"post\">");
httpRequest.append("<input type=\"hidden\" name=\"PAY_ID\" value=\"");
httpRequest.append("1804100638381010");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"MERCHANTNAME\" value=\"");
httpRequest.append("BHARTIPAY Demo");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"ORDER_ID\" value=\"");
httpRequest.append("BHARTI00001");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"AMOUNT\" value=\"");
httpRequest.append("100");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"TXNTYPE\" value=\"");
httpRequest.append("SALE");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"CUST_NAME\" value=\"");
httpRequest.append("BPAY");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"CUST_STREET_ADDRESS1\" value=\"");
httpRequest.append("Gurgoan");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"CUST_ZIP\" value=\"");
httpRequest.append("122016");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"CUST_PHONE\" value=\"");
httpRequest.append("8860705801");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"CUST_EMAIL\" value=\"");
httpRequest.append("rohit.singh@bhartipay.com");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"PRODUCT_DESC\" value=\"");
httpRequest.append("Bhartipay Pay Product");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"CURRENCY_CODE\" value=\"");
httpRequest.append("356");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"RETURN_URL\" value=\"");
httpRequest.append("http://domain.com/response.jsp");
httpRequest.append("\">");
httpRequest.append("<input type=\"hidden\" name=\"HASH\" value=\"");
httpRequest.append(hash);
httpRequest.append("\">");
httpRequest.append("</form>");
httpRequest.append("<script language=\"JavaScript\">");
httpRequest.append("function OnLoadEvent()");
httpRequest.append("{document.form1.submit();}");
httpRequest.append("</script>");
httpRequest.append("</BODY>");
httpRequest.append("</HTML>");
httpRequest.toString();
}
}