| Line 1... |
Line 1... |
| 1 |
package in.shop2020.serving.controllers;
|
1 |
package in.shop2020.serving.controllers;
|
| 2 |
|
2 |
|
| 3 |
import java.io.IOException;
|
3 |
import java.io.IOException;
|
| 4 |
import java.util.HashMap;
|
- |
|
| 5 |
import java.util.List;
|
4 |
import java.util.List;
|
| 6 |
import java.util.Map;
|
- |
|
| 7 |
|
5 |
|
| - |
|
6 |
import org.apache.commons.lang.StringUtils;
|
| - |
|
7 |
import org.apache.log4j.Logger;
|
| 8 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
8 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
| 9 |
import org.apache.struts2.convention.annotation.InterceptorRefs;
|
9 |
import org.apache.struts2.convention.annotation.InterceptorRefs;
|
| 10 |
import org.apache.struts2.convention.annotation.Result;
|
- |
|
| 11 |
import org.apache.struts2.convention.annotation.Results;
|
- |
|
| 12 |
import org.apache.thrift.TException;
|
10 |
import org.apache.thrift.TException;
|
| 13 |
|
11 |
|
| 14 |
import in.shop2020.model.v1.order.Order;
|
12 |
import in.shop2020.model.v1.order.Order;
|
| 15 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
13 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 16 |
import in.shop2020.payments.PaymentException;
|
14 |
import in.shop2020.payments.PaymentException;
|
| - |
|
15 |
import in.shop2020.serving.utils.DataLogger;
|
| - |
|
16 |
import in.shop2020.serving.utils.DataLogger.Event;
|
| 17 |
import in.shop2020.thrift.clients.PaymentServiceClient;
|
17 |
import in.shop2020.thrift.clients.PaymentServiceClient;
|
| 18 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
18 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
| 19 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
19 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
| 20 |
import in.shop2020.utils.Logger;
|
- |
|
| 21 |
|
20 |
|
| 22 |
@InterceptorRefs({
|
21 |
@InterceptorRefs({
|
| 23 |
@InterceptorRef("myDefault"),
|
22 |
@InterceptorRef("myDefault"),
|
| 24 |
@InterceptorRef("login")
|
23 |
@InterceptorRef("login")
|
| 25 |
})
|
24 |
})
|
| 26 |
|
25 |
|
| 27 |
public class PayErrorController extends BaseController{
|
26 |
public class PayErrorController extends BaseController{
|
| 28 |
private static final long serialVersionUID = 1L;
|
27 |
private static final long serialVersionUID = 1L;
|
| - |
|
28 |
private static Logger log = Logger.getLogger(Class.class);
|
| - |
|
29 |
private static Logger dataLog = DataLogger.getLogger();
|
| 29 |
PaymentServiceClient pclient = null;
|
30 |
PaymentServiceClient pclient = null;
|
| 30 |
TransactionServiceClient tsc = null;
|
31 |
TransactionServiceClient tsc = null;
|
| 31 |
UserContextServiceClient usc = null;
|
32 |
UserContextServiceClient usc = null;
|
| 32 |
|
33 |
|
| 33 |
long merchantPaymentId;
|
34 |
long merchantPaymentId;
|
| Line 39... |
Line 40... |
| 39 |
try {
|
40 |
try {
|
| 40 |
pclient = new PaymentServiceClient();
|
41 |
pclient = new PaymentServiceClient();
|
| 41 |
tsc = new TransactionServiceClient();
|
42 |
tsc = new TransactionServiceClient();
|
| 42 |
usc = new UserContextServiceClient();
|
43 |
usc = new UserContextServiceClient();
|
| 43 |
} catch (Exception e) {
|
44 |
} catch (Exception e) {
|
| 44 |
Logger.log("Could not initialize the paymentservice client", this);
|
45 |
log.error("Could not initialize the paymentservice client");
|
| 45 |
}
|
46 |
}
|
| 46 |
}
|
47 |
}
|
| 47 |
|
48 |
|
| 48 |
public String index() throws IOException, SecurityException, PaymentException, TException, TransactionServiceException{
|
49 |
public String index() throws IOException, SecurityException, PaymentException, TException, TransactionServiceException{
|
| 49 |
this.message = "Payment failed at the payment gateway. Please pay again.";
|
50 |
this.message = "Payment failed at the payment gateway. Please pay again.";
|
| 50 |
|
51 |
|
| 51 |
merchantPaymentId = Long.parseLong(this.request.getParameter("paymentId"));
|
52 |
merchantPaymentId = Long.parseLong(this.request.getParameter("paymentId"));
|
| - |
|
53 |
dataLog.info(StringUtils.join(new String[] { Event.PAYMENT_SUCCESS.name(),
|
| - |
|
54 |
userinfo.getEmail(), Long.toString(merchantPaymentId)}, ", "));
|
| 52 |
return "index";
|
55 |
return "index";
|
| 53 |
}
|
56 |
}
|
| 54 |
|
57 |
|
| 55 |
|
58 |
|
| 56 |
public String getMessage(){
|
59 |
public String getMessage(){
|