| Line 13... |
Line 13... |
| 13 |
import in.shop2020.model.v1.user.Line;
|
13 |
import in.shop2020.model.v1.user.Line;
|
| 14 |
import in.shop2020.model.v1.user.User;
|
14 |
import in.shop2020.model.v1.user.User;
|
| 15 |
import in.shop2020.model.v1.user.UserContextService;
|
15 |
import in.shop2020.model.v1.user.UserContextService;
|
| 16 |
import in.shop2020.serving.controllers.BaseController;
|
16 |
import in.shop2020.serving.controllers.BaseController;
|
| 17 |
import in.shop2020.serving.utils.DataLogger;
|
17 |
import in.shop2020.serving.utils.DataLogger;
|
| - |
|
18 |
import in.shop2020.serving.utils.FormattingUtils;
|
| 18 |
import in.shop2020.serving.utils.Utils;
|
19 |
import in.shop2020.serving.utils.Utils;
|
| 19 |
import in.shop2020.serving.utils.DataLogger.Event;
|
20 |
import in.shop2020.serving.utils.DataLogger.Event;
|
| 20 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
21 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
| 21 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
22 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
| 22 |
|
23 |
|
| Line 206... |
Line 207... |
| 206 |
CatalogServiceClient catalogServiceClient = null;
|
207 |
CatalogServiceClient catalogServiceClient = null;
|
| 207 |
in.shop2020.model.v1.catalog.InventoryService.Client catalogClient = null;
|
208 |
in.shop2020.model.v1.catalog.InventoryService.Client catalogClient = null;
|
| 208 |
UserContextServiceClient userContextServiceClient = null;
|
209 |
UserContextServiceClient userContextServiceClient = null;
|
| 209 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
210 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
| 210 |
|
211 |
|
| - |
|
212 |
FormattingUtils formattingUtils = new FormattingUtils();
|
| - |
|
213 |
|
| 211 |
try {
|
214 |
try {
|
| 212 |
catalogServiceClient = new CatalogServiceClient();
|
215 |
catalogServiceClient = new CatalogServiceClient();
|
| 213 |
catalogClient = catalogServiceClient.getClient();
|
216 |
catalogClient = catalogServiceClient.getClient();
|
| 214 |
userContextServiceClient = new UserContextServiceClient();
|
217 |
userContextServiceClient = new UserContextServiceClient();
|
| 215 |
userClient = userContextServiceClient.getClient();
|
218 |
userClient = userContextServiceClient.getClient();
|
| Line 229... |
Line 232... |
| 229 |
+ (( (item.getColor() != null && !item.getColor().trim().equals("NA"))) ? "("+item.getColor()+")" : "" );
|
232 |
+ (( (item.getColor() != null && !item.getColor().trim().equals("NA"))) ? "("+item.getColor()+")" : "" );
|
| 230 |
|
233 |
|
| 231 |
itemdetail.put("ITEM_NAME", itemName);
|
234 |
itemdetail.put("ITEM_NAME", itemName);
|
| 232 |
itemdetail.put("ITEM_ID", line.getItemId()+"");
|
235 |
itemdetail.put("ITEM_ID", line.getItemId()+"");
|
| 233 |
itemdetail.put("ITEM_QUANTITY", ((int)line.getQuantity())+"");
|
236 |
itemdetail.put("ITEM_QUANTITY", ((int)line.getQuantity())+"");
|
| 234 |
itemdetail.put("MRP", ((int)item.getMrp())+"");
|
237 |
itemdetail.put("MRP", formattingUtils.formatPrice(item.getMrp()));
|
| 235 |
itemdetail.put("SELLING_PRICE", (int)item.getSellingPrice()+"");
|
238 |
itemdetail.put("SELLING_PRICE", formattingUtils.formatPrice(item.getSellingPrice()));
|
| 236 |
itemdetail.put("TOTAL_PRICE", (int)(item.getSellingPrice()*line.getQuantity())+"");
|
239 |
itemdetail.put("TOTAL_PRICE", formattingUtils.formatPrice((item.getSellingPrice()*line.getQuantity())));
|
| 237 |
itemdetail.put("SHIPPING_TIME", line.getEstimate()+"");
|
240 |
itemdetail.put("SHIPPING_TIME", line.getEstimate()+"");
|
| 238 |
totalamount = totalamount + line.getQuantity()*item.getSellingPrice();
|
- |
|
| 239 |
items.add(itemdetail);
|
241 |
items.add(itemdetail);
|
| 240 |
}
|
242 |
}
|
| 241 |
}
|
243 |
}
|
| 242 |
|
244 |
totalamount = cart.getTotalPrice();
|
| 243 |
addresses = userClient.getAllAddressesForUser(cart.getUserId());
|
245 |
addresses = userClient.getAllAddressesForUser(cart.getUserId());
|
| 244 |
User user = userClient.getUserById(cart.getUserId());
|
246 |
User user = userClient.getUserById(cart.getUserId());
|
| 245 |
|
247 |
|
| 246 |
fullName = user.getName();
|
248 |
fullName = user.getName();
|
| 247 |
phoneNumber = user.getMobileNumber();
|
249 |
phoneNumber = user.getMobileNumber();
|
| Line 252... |
Line 254... |
| 252 |
defaultAddressId = userClient.getDefaultAddressId(cart.getUserId());
|
254 |
defaultAddressId = userClient.getDefaultAddressId(cart.getUserId());
|
| 253 |
}
|
255 |
}
|
| 254 |
|
256 |
|
| 255 |
String couponCode = cart.getCouponCode();
|
257 |
String couponCode = cart.getCouponCode();
|
| 256 |
context.put("couponcode", couponCode == null ? "" : couponCode);
|
258 |
context.put("couponcode", couponCode == null ? "" : couponCode);
|
| 257 |
context.put("discountedamount", cart.getDiscountedPrice() + "");
|
259 |
context.put("discountedamount", formattingUtils.formatPrice(cart.getDiscountedPrice()));
|
| 258 |
|
260 |
|
| 259 |
} catch (Exception e) {
|
261 |
} catch (Exception e) {
|
| 260 |
e.printStackTrace();
|
262 |
e.printStackTrace();
|
| 261 |
}
|
263 |
}
|
| 262 |
System.out.println(fullName + " | " + phoneNumber);
|
264 |
System.out.println(fullName + " | " + phoneNumber);
|
| 263 |
|
265 |
|
| 264 |
context.put("fullname", fullName);
|
266 |
context.put("fullname", fullName);
|
| 265 |
context.put("phonenumber", phoneNumber);
|
267 |
context.put("phonenumber", phoneNumber);
|
| 266 |
|
268 |
|
| 267 |
context.put("items", items);
|
269 |
context.put("items", items);
|
| 268 |
context.put("totalamount", (int)totalamount+"");
|
270 |
context.put("totalamount", formattingUtils.formatPrice(totalamount));
|
| 269 |
context.put("addresses", addresses);
|
271 |
context.put("addresses", addresses);
|
| 270 |
context.put("defaultAddressId", defaultAddressId+"");
|
272 |
context.put("defaultAddressId", defaultAddressId+"");
|
| 271 |
context.put("errorMsg", errorMsg);
|
273 |
context.put("errorMsg", errorMsg);
|
| 272 |
htmlString = pageLoader.getHtmlFromVelocity(templateFile, context);
|
274 |
htmlString = pageLoader.getHtmlFromVelocity(templateFile, context);
|
| 273 |
return htmlString;
|
275 |
return htmlString;
|