| 2264 |
chandransh |
1 |
package in.shop2020.serving.controllers;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.config.ConfigException;
|
|
|
4 |
import in.shop2020.thrift.clients.config.ConfigClient;
|
|
|
5 |
|
|
|
6 |
import org.apache.log4j.Logger;
|
|
|
7 |
|
|
|
8 |
@SuppressWarnings("serial")
|
|
|
9 |
public class EbsPayProcessingController extends BaseController{
|
|
|
10 |
|
|
|
11 |
private static Logger log = Logger.getLogger(Class.class);
|
|
|
12 |
|
|
|
13 |
private static String processingUrl;
|
|
|
14 |
|
|
|
15 |
static{
|
|
|
16 |
try {
|
|
|
17 |
processingUrl = ConfigClient.getClient().get("ebs_processing_url");
|
|
|
18 |
} catch (ConfigException e) {
|
|
|
19 |
log.error("Unable to get processing URL from config server.");
|
|
|
20 |
}
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
private String redirectUrl;
|
|
|
24 |
|
|
|
25 |
public String index(){
|
|
|
26 |
log.info("Received GET data string: " + request.getParameter("DR"));
|
|
|
27 |
setRedirectUrl();
|
|
|
28 |
return "index";
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
public String create(){
|
|
|
32 |
log.info("Received POST data string: " + request.getParameter("DR"));
|
|
|
33 |
setRedirectUrl();
|
|
|
34 |
return "index";
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
public String getRedirectUrl(){
|
|
|
38 |
return redirectUrl;
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
private void setRedirectUrl() {
|
|
|
42 |
StringBuffer paymentData = new StringBuffer(request.getParameter("DR"));
|
|
|
43 |
for (int i = 0; i < paymentData.length(); i++) {
|
|
|
44 |
if (paymentData.charAt(i) == ' ')
|
|
|
45 |
paymentData.setCharAt(i, '+');
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
redirectUrl = processingUrl + paymentData.toString();
|
|
|
49 |
}
|
|
|
50 |
}
|