| Line 3... |
Line 3... |
| 3 |
import java.io.IOException;
|
3 |
import java.io.IOException;
|
| 4 |
import java.util.HashMap;
|
4 |
import java.util.HashMap;
|
| 5 |
import java.util.List;
|
5 |
import java.util.List;
|
| 6 |
import java.util.Map;
|
6 |
import java.util.Map;
|
| 7 |
|
7 |
|
| - |
|
8 |
import org.apache.juli.logging.Log;
|
| - |
|
9 |
import org.apache.juli.logging.LogFactory;
|
| 8 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
10 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
| 9 |
import org.apache.struts2.convention.annotation.InterceptorRefs;
|
11 |
import org.apache.struts2.convention.annotation.InterceptorRefs;
|
| 10 |
import org.apache.struts2.convention.annotation.Result;
|
12 |
import org.apache.struts2.convention.annotation.Result;
|
| 11 |
import org.apache.struts2.convention.annotation.Results;
|
13 |
import org.apache.struts2.convention.annotation.Results;
|
| 12 |
import org.apache.thrift.TException;
|
14 |
import org.apache.thrift.TException;
|
| Line 33... |
Line 35... |
| 33 |
private static final long serialVersionUID = 1L;
|
35 |
private static final long serialVersionUID = 1L;
|
| 34 |
PaymentServiceClient pclient = null;
|
36 |
PaymentServiceClient pclient = null;
|
| 35 |
TransactionServiceClient tsc = null;
|
37 |
TransactionServiceClient tsc = null;
|
| 36 |
UserContextServiceClient usc = null;
|
38 |
UserContextServiceClient usc = null;
|
| 37 |
|
39 |
|
| - |
|
40 |
private static Log log = LogFactory.getLog(Class.class);
|
| 38 |
long merchantPaymentId;
|
41 |
long merchantPaymentId;
|
| 39 |
List<Order> orders = null;
|
42 |
List<Order> orders = null;
|
| 40 |
String message = null;
|
43 |
String message = null;
|
| 41 |
|
44 |
|
| 42 |
public PaySuccessController(){
|
45 |
public PaySuccessController(){
|
| Line 48... |
Line 51... |
| 48 |
} catch (Exception e) {
|
51 |
} catch (Exception e) {
|
| 49 |
Logger.log("Could not initialize the paymentservice client", this);
|
52 |
Logger.log("Could not initialize the paymentservice client", this);
|
| 50 |
}
|
53 |
}
|
| 51 |
}
|
54 |
}
|
| 52 |
|
55 |
|
| 53 |
public String index() throws IOException, SecurityException, PaymentException, TException, TransactionServiceException, ShoppingCartException{
|
56 |
public String index() {
|
| 54 |
this.message = "Payment completed successfully.";
|
57 |
this.message = "Payment completed successfully.";
|
| 55 |
System.out.println("Inside the index method of pay response");
|
58 |
System.out.println("Inside the index method of pay response");
|
| 56 |
|
59 |
|
| 57 |
merchantPaymentId = Long.parseLong(this.request.getParameter("paymentId"));
|
60 |
merchantPaymentId = Long.parseLong(this.request.getParameter("paymentId"));
|
| 58 |
|
61 |
|
| - |
|
62 |
long txnId;
|
| - |
|
63 |
try {
|
| 59 |
long txnId = pclient.getClient().getPayment(merchantPaymentId).getMerchantTxnId();
|
64 |
txnId = pclient.getClient().getPayment(merchantPaymentId).getMerchantTxnId();
|
| 60 |
|
65 |
|
| 61 |
orders = tsc.getClient().getOrdersForTransaction(txnId);
|
66 |
orders = tsc.getClient().getOrdersForTransaction(txnId);
|
| 62 |
|
67 |
|
| 63 |
int totalItems = usc.getClient().getCart(userinfo.getCartId()).getLinesSize();
|
68 |
int totalItems = usc.getClient().getCart(userinfo.getCartId()).getLinesSize();
|
| 64 |
userinfo.setTotalItems(totalItems);
|
69 |
userinfo.setTotalItems(totalItems);
|
| - |
|
70 |
} catch (PaymentException e) {
|
| - |
|
71 |
log.error("Payment service not responding. Payment id is" + merchantPaymentId);
|
| - |
|
72 |
e.printStackTrace();
|
| - |
|
73 |
} catch (TException e) {
|
| - |
|
74 |
log.error("Thrift service exception. Payment id is" + merchantPaymentId);
|
| - |
|
75 |
e.printStackTrace();
|
| - |
|
76 |
} catch (TransactionServiceException e) {
|
| - |
|
77 |
log.error("Transaction service exception. Payment id is" + merchantPaymentId);
|
| - |
|
78 |
e.printStackTrace();
|
| - |
|
79 |
} catch (ShoppingCartException e) {
|
| - |
|
80 |
log.error("Shopping cart service exception. Payment id is" + merchantPaymentId + " message id and name are " + e.getId() + e.getMessage());
|
| - |
|
81 |
e.printStackTrace();
|
| - |
|
82 |
}
|
| 65 |
|
83 |
|
| 66 |
return "index";
|
84 |
return "index";
|
| 67 |
}
|
85 |
}
|
| 68 |
|
86 |
|
| 69 |
|
87 |
|
| 70 |
|
88 |
|