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