| Line 1... |
Line 1... |
| 1 |
package in.shop2020.serving.controllers;
|
1 |
package in.shop2020.serving.controllers;
|
| 2 |
|
2 |
|
| - |
|
3 |
import in.shop2020.logistics.AwbUpdate;
|
| 3 |
import in.shop2020.model.v1.order.LineItem;
|
4 |
import in.shop2020.model.v1.order.LineItem;
|
| 4 |
import in.shop2020.model.v1.order.Order;
|
5 |
import in.shop2020.model.v1.order.Order;
|
| 5 |
import in.shop2020.payments.Attribute;
|
6 |
import in.shop2020.payments.Attribute;
|
| 6 |
import in.shop2020.payments.Constants;
|
7 |
import in.shop2020.payments.Constants;
|
| 7 |
import in.shop2020.payments.Payment;
|
8 |
import in.shop2020.payments.Payment;
|
| 8 |
import in.shop2020.payments.PaymentException;
|
9 |
import in.shop2020.payments.PaymentException;
|
| - |
|
10 |
import in.shop2020.serving.model.ShipmentUpdate;
|
| - |
|
11 |
import in.shop2020.serving.services.BlueDartTrackingService;
|
| - |
|
12 |
import in.shop2020.thrift.clients.LogisticsServiceClient;
|
| 9 |
import in.shop2020.thrift.clients.PaymentServiceClient;
|
13 |
import in.shop2020.thrift.clients.PaymentServiceClient;
|
| 10 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
14 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
| 11 |
|
15 |
|
| 12 |
import java.text.SimpleDateFormat;
|
16 |
import java.text.SimpleDateFormat;
|
| 13 |
import java.util.ArrayList;
|
17 |
import java.util.ArrayList;
|
| Line 26... |
Line 30... |
| 26 |
*
|
30 |
*
|
| 27 |
*/
|
31 |
*/
|
| 28 |
@SuppressWarnings("serial")
|
32 |
@SuppressWarnings("serial")
|
| 29 |
public class UserOrderInfoController extends BaseController {
|
33 |
public class UserOrderInfoController extends BaseController {
|
| 30 |
private static Logger log = Logger.getLogger(Class.class);
|
34 |
private static Logger log = Logger.getLogger(Class.class);
|
| - |
|
35 |
private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
|
| - |
|
36 |
|
| 31 |
private long userId;
|
37 |
private long userId;
|
| 32 |
private long orderId;
|
38 |
private long orderId;
|
| 33 |
private Map<String, String> userOrder;
|
39 |
private Map<String, String> userOrder;
|
| 34 |
private List<Map<String, String>> lineItemsList;
|
40 |
private List<Map<String, String>> lineItemsList;
|
| 35 |
private List<Map<String, String>> paymentsList;
|
41 |
private List<Map<String, String>> paymentsList;
|
| - |
|
42 |
private List<ShipmentUpdate> shipmentUpdates;
|
| 36 |
|
43 |
|
| 37 |
public UserOrderInfoController(){
|
44 |
public UserOrderInfoController(){
|
| 38 |
super();
|
45 |
super();
|
| 39 |
}
|
46 |
}
|
| 40 |
|
47 |
|
| 41 |
public String index() throws Exception {
|
48 |
public String index() throws Exception {
|
| 42 |
PaymentServiceClient paymentServiceClient = new PaymentServiceClient();
|
49 |
PaymentServiceClient paymentServiceClient = new PaymentServiceClient();
|
| 43 |
TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
|
50 |
TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
|
| - |
|
51 |
|
| 44 |
Order order = null;
|
52 |
Order order = null;
|
| 45 |
try {
|
53 |
try {
|
| 46 |
order = transactionServiceClient.getClient().getOrderForCustomer(orderId, userId);
|
54 |
order = transactionServiceClient.getClient().getOrderForCustomer(orderId, userId);
|
| 47 |
}
|
55 |
}
|
| 48 |
catch (Exception e) {
|
56 |
catch (Exception e) {
|
| Line 57... |
Line 65... |
| 57 |
|
65 |
|
| 58 |
List<Payment> payments = paymentServiceClient.getClient().getPaymentForTxnId(order.getTransactionId());
|
66 |
List<Payment> payments = paymentServiceClient.getClient().getPaymentForTxnId(order.getTransactionId());
|
| 59 |
if (payments != null && !payments.isEmpty()) {
|
67 |
if (payments != null && !payments.isEmpty()) {
|
| 60 |
setPayments(payments, sdf, paymentServiceClient);
|
68 |
setPayments(payments, sdf, paymentServiceClient);
|
| 61 |
}
|
69 |
}
|
| - |
|
70 |
|
| - |
|
71 |
shipmentUpdates = blueDartTrackingService.getUpdates(order.getAirwaybill_no());
|
| 62 |
return "index";
|
72 |
return "index";
|
| 63 |
}
|
73 |
}
|
| 64 |
|
74 |
|
| 65 |
private void setPayments(List<Payment> payments, SimpleDateFormat sdf, PaymentServiceClient paymentServiceClient) throws PaymentException, TException {
|
75 |
private void setPayments(List<Payment> payments, SimpleDateFormat sdf, PaymentServiceClient paymentServiceClient) throws PaymentException, TException {
|
| 66 |
paymentsList = new ArrayList<Map<String,String>>();
|
76 |
paymentsList = new ArrayList<Map<String,String>>();
|
| Line 232... |
Line 242... |
| 232 |
}
|
242 |
}
|
| 233 |
|
243 |
|
| 234 |
public List<Map<String, String>> getPaymentsList() {
|
244 |
public List<Map<String, String>> getPaymentsList() {
|
| 235 |
return paymentsList;
|
245 |
return paymentsList;
|
| 236 |
}
|
246 |
}
|
| - |
|
247 |
|
| - |
|
248 |
public List<ShipmentUpdate> getShipmentUpdates() {
|
| - |
|
249 |
return shipmentUpdates;
|
| - |
|
250 |
}
|
| - |
|
251 |
|
| - |
|
252 |
public void setShipmentUpdates(List<ShipmentUpdate> shipmentUpdates) {
|
| - |
|
253 |
this.shipmentUpdates = shipmentUpdates;
|
| - |
|
254 |
}
|
| 237 |
}
|
255 |
}
|
| 238 |
|
256 |
|