| Line 5... |
Line 5... |
| 5 |
import in.shop2020.mobileapi.serving.utils.PojoPopulator;
|
5 |
import in.shop2020.mobileapi.serving.utils.PojoPopulator;
|
| 6 |
import in.shop2020.mobileapi.serving.utils.SnippetType;
|
6 |
import in.shop2020.mobileapi.serving.utils.SnippetType;
|
| 7 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
7 |
import in.shop2020.model.v1.catalog.CatalogService.Client;
|
| 8 |
import in.shop2020.model.v1.catalog.Item;
|
8 |
import in.shop2020.model.v1.catalog.Item;
|
| 9 |
import in.shop2020.model.v1.user.Cart;
|
9 |
import in.shop2020.model.v1.user.Cart;
|
| - |
|
10 |
import in.shop2020.model.v1.user.Line;
|
| 10 |
import in.shop2020.model.v1.user.PromotionException;
|
11 |
import in.shop2020.model.v1.user.PromotionException;
|
| 11 |
import in.shop2020.model.v1.user.PromotionService;
|
12 |
import in.shop2020.model.v1.user.PromotionService;
|
| 12 |
import in.shop2020.model.v1.user.ShoppingCartException;
|
13 |
import in.shop2020.model.v1.user.ShoppingCartException;
|
| 13 |
import in.shop2020.model.v1.user.UserContextService;
|
14 |
import in.shop2020.model.v1.user.UserContextService;
|
| 14 |
import in.shop2020.thrift.clients.CatalogClient;
|
15 |
import in.shop2020.thrift.clients.CatalogClient;
|
| Line 72... |
Line 73... |
| 72 |
log.info("Cart Change/EMI Message rcvd from the service is:" + errorMsg);
|
73 |
log.info("Cart Change/EMI Message rcvd from the service is:" + errorMsg);
|
| 73 |
|
74 |
|
| 74 |
Cart cart = userClient.getCurrentCart(userinfo.getUserId());
|
75 |
Cart cart = userClient.getCurrentCart(userinfo.getUserId());
|
| 75 |
String pincode = "110001";
|
76 |
String pincode = "110001";
|
| 76 |
UserClient usc = new UserClient();
|
77 |
UserClient usc = new UserClient();
|
| 77 |
if(cart.getAddressId() < 1) {
|
78 |
if(!cart.isSetAddressId()) {
|
| 78 |
try {
|
79 |
try {
|
| 79 |
pincode = usc.getClient().getDefaultPincode(userinfo.getUserId());
|
80 |
pincode = usc.getClient().getDefaultPincode(userinfo.getUserId());
|
| 80 |
} catch(Exception e) {
|
81 |
} catch(Exception e) {
|
| 81 |
log.error("Unable to get default pincode for userId : " + userinfo.getUserId(), e);
|
82 |
log.error("Unable to get default pincode for userId : " + userinfo.getUserId(), e);
|
| 82 |
}
|
83 |
}
|
| Line 85... |
Line 86... |
| 85 |
pincode = usc.getClient().getAddressById(cart.getAddressId()).getPin();
|
86 |
pincode = usc.getClient().getAddressById(cart.getAddressId()).getPin();
|
| 86 |
} catch(Exception e) {
|
87 |
} catch(Exception e) {
|
| 87 |
log.error("Unable to get address for addressId : " + cart.getAddressId(), e);
|
88 |
log.error("Unable to get address for addressId : " + cart.getAddressId(), e);
|
| 88 |
}
|
89 |
}
|
| 89 |
}
|
90 |
}
|
| - |
|
91 |
Boolean needInuranceInfo = false;
|
| - |
|
92 |
for(Line line : cart.getLines()) {
|
| - |
|
93 |
if(line.isSetInsurer()){
|
| - |
|
94 |
long defaultAddressId = usc.getClient().getDefaultAddressId(userinfo.getUserId());
|
| - |
|
95 |
needInuranceInfo = !userClient.isInsuranceDetailPresent(defaultAddressId);
|
| - |
|
96 |
break;
|
| - |
|
97 |
}
|
| - |
|
98 |
}
|
| 90 |
|
99 |
|
| 91 |
cartPojoJson = new Gson().toJson(PojoPopulator.getCartPojo(cart, errorMsg, pincode));
|
100 |
cartPojoJson = new Gson().toJson(PojoPopulator.getCartPojo(cart, errorMsg, pincode, needInuranceInfo));
|
| 92 |
|
101 |
|
| 93 |
} catch (Exception e) {
|
102 |
} catch (Exception e) {
|
| 94 |
// This exception can be ignored for showing the cart. Not so
|
103 |
// This exception can be ignored for showing the cart. Not so
|
| 95 |
// innocent when this occurs at the time of checkout or when the
|
104 |
// innocent when this occurs at the time of checkout or when the
|
| 96 |
// user is proceeding to pay.
|
105 |
// user is proceeding to pay.
|