| Line 10... |
Line 10... |
| 10 |
import in.shop2020.model.v1.order.LineItem;
|
10 |
import in.shop2020.model.v1.order.LineItem;
|
| 11 |
import in.shop2020.model.v1.order.Order;
|
11 |
import in.shop2020.model.v1.order.Order;
|
| 12 |
import in.shop2020.model.v1.order.OrderStatus;
|
12 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 13 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
13 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 14 |
import in.shop2020.model.v1.user.Address;
|
14 |
import in.shop2020.model.v1.user.Address;
|
| 15 |
import in.shop2020.model.v1.user.User;
|
- |
|
| 16 |
import in.shop2020.model.v1.user.UserContextException;
|
15 |
import in.shop2020.model.v1.user.UserContextException;
|
| 17 |
import in.shop2020.payments.Attribute;
|
16 |
import in.shop2020.payments.Attribute;
|
| 18 |
import in.shop2020.payments.Constants;
|
17 |
import in.shop2020.payments.Constants;
|
| 19 |
import in.shop2020.payments.Payment;
|
18 |
import in.shop2020.payments.Payment;
|
| 20 |
import in.shop2020.payments.PaymentException;
|
19 |
import in.shop2020.payments.PaymentException;
|
| 21 |
import in.shop2020.payments.PaymentService.Client;
|
20 |
import in.shop2020.payments.PaymentService.Client;
|
| 22 |
import in.shop2020.serving.auth.CRMAuthorizingRealm;
|
21 |
import in.shop2020.serving.auth.CRMAuthorizingRealm;
|
| 23 |
import in.shop2020.serving.model.ShipmentUpdate;
|
22 |
import in.shop2020.serving.model.ShipmentUpdate;
|
| 24 |
import in.shop2020.serving.services.BlueDartTrackingService;
|
23 |
import in.shop2020.serving.services.BlueDartTrackingService;
|
| - |
|
24 |
import in.shop2020.serving.services.AramexTrackingService;
|
| 25 |
import in.shop2020.thrift.clients.CRMClient;
|
25 |
import in.shop2020.thrift.clients.CRMClient;
|
| 26 |
import in.shop2020.thrift.clients.PaymentClient;
|
26 |
import in.shop2020.thrift.clients.PaymentClient;
|
| 27 |
import in.shop2020.thrift.clients.TransactionClient;
|
27 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 28 |
import in.shop2020.thrift.clients.UserClient;
|
28 |
import in.shop2020.thrift.clients.UserClient;
|
| 29 |
import in.shop2020.utils.ModelUtils;
|
29 |
import in.shop2020.utils.ModelUtils;
|
| Line 49... |
Line 49... |
| 49 |
*/
|
49 |
*/
|
| 50 |
@SuppressWarnings("serial")
|
50 |
@SuppressWarnings("serial")
|
| 51 |
public class UserOrderInfoController extends BaseController {
|
51 |
public class UserOrderInfoController extends BaseController {
|
| 52 |
private static Logger log = Logger.getLogger(Class.class);
|
52 |
private static Logger log = Logger.getLogger(Class.class);
|
| 53 |
private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
|
53 |
private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
|
| - |
|
54 |
private static AramexTrackingService aramexTrackingService = new AramexTrackingService();
|
| 54 |
|
55 |
|
| 55 |
private long orderId;
|
56 |
private long orderId;
|
| 56 |
private Order order;
|
57 |
private Order order;
|
| 57 |
private List<Payment> payments;
|
58 |
private List<Payment> payments;
|
| 58 |
private List<ShipmentUpdate> shipmentUpdates = new ArrayList<ShipmentUpdate>();
|
59 |
private List<ShipmentUpdate> shipmentUpdates = new ArrayList<ShipmentUpdate>();
|
| Line 92... |
Line 93... |
| 92 |
// This is done to ensure that response from Crm web app is sent
|
93 |
// This is done to ensure that response from Crm web app is sent
|
| 93 |
// within given time limits. Also, we wont be affected in the cases
|
94 |
// within given time limits. Also, we wont be affected in the cases
|
| 94 |
// where bluedart site is down or slow
|
95 |
// where bluedart site is down or slow
|
| 95 |
Executors.newSingleThreadExecutor().invokeAll(Collections.singletonList(new Callable<Boolean>() {
|
96 |
Executors.newSingleThreadExecutor().invokeAll(Collections.singletonList(new Callable<Boolean>() {
|
| 96 |
public Boolean call() throws Exception {
|
97 |
public Boolean call() throws Exception {
|
| - |
|
98 |
if (order.getLogistics_provider_id() == 1)
|
| 97 |
shipmentUpdates = blueDartTrackingService.getUpdates(order.getAirwaybill_no());
|
99 |
shipmentUpdates = blueDartTrackingService.getUpdates(order.getAirwaybill_no());
|
| - |
|
100 |
else if (order.getLogistics_provider_id() == 2) {
|
| - |
|
101 |
shipmentUpdates = aramexTrackingService.getUpdates(order.getAirwaybill_no());
|
| - |
|
102 |
}
|
| - |
|
103 |
else {
|
| - |
|
104 |
log.error("Error : providerId = " + order.getLogistics_provider_id() + "for orderId : " + order.getId());
|
| - |
|
105 |
}
|
| 98 |
return true;
|
106 |
return true;
|
| 99 |
}
|
107 |
}
|
| 100 |
}), 5, TimeUnit.SECONDS);
|
108 |
}), 5, TimeUnit.SECONDS);
|
| 101 |
|
109 |
|
| 102 |
if (order.isCod() && OrderStatus.COD_VERIFICATION_PENDING.equals(order.getStatus())) {
|
110 |
if (order.isCod() && OrderStatus.COD_VERIFICATION_PENDING.equals(order.getStatus())) {
|