| Line 448... |
Line 448... |
| 448 |
Integer quantity = obj.getInt("quantity");
|
448 |
Integer quantity = obj.getInt("quantity");
|
| 449 |
ItemQuantity iq = new ItemQuantity(itemId, quantity);
|
449 |
ItemQuantity iq = new ItemQuantity(itemId, quantity);
|
| 450 |
itemQuantities.add(iq);
|
450 |
itemQuantities.add(iq);
|
| 451 |
}
|
451 |
}
|
| 452 |
userClient = getClient();
|
452 |
userClient = getClient();
|
| - |
|
453 |
|
| 453 |
if (userClient.addItemsToCart(id, itemQuantities, jsonObj.getString("couponCode"))){
|
454 |
if (userClient.addItemsToCart(id, itemQuantities, jsonObj.has("couponCode")? jsonObj.getString("couponCode"):null)){
|
| 454 |
log.info("Items added to cart Successfully");
|
455 |
log.info("Items added to cart Successfully");
|
| 455 |
//Now validate cart and provide appropriate response.
|
456 |
//Now validate cart and provide appropriate response.
|
| 456 |
String cartString = userClient.validateCartNew(id, userinfo.getPincode(), -1);
|
457 |
String cartString = userClient.validateCartNew(id, userinfo.getPincode(), -1);
|
| 457 |
JSONObject cartObj = new JSONObject(cartString);
|
458 |
JSONObject cartObj = new JSONObject(cartString);
|
| 458 |
JSONArray arr = cartObj.getJSONArray("cartItems");
|
459 |
JSONArray arr = cartObj.getJSONArray("cartItems");
|
| Line 470... |
Line 471... |
| 470 |
cartObj.put("imageUrl", pp.getImageUrl());
|
471 |
cartObj.put("imageUrl", pp.getImageUrl());
|
| 471 |
cartObj.put("title", pp.getTitle());
|
472 |
cartObj.put("title", pp.getTitle());
|
| 472 |
}
|
473 |
}
|
| 473 |
cartObj.put("estimateString", LogisticsService.getDeliveryDateString(maxEstimate,DeliveryType.COD));
|
474 |
cartObj.put("estimateString", LogisticsService.getDeliveryDateString(maxEstimate,DeliveryType.COD));
|
| 474 |
cartObj.put("sameEstimate", allSame);
|
475 |
cartObj.put("sameEstimate", allSame);
|
| 475 |
cartPojoJson = new Gson().toJson(cartObj);
|
476 |
cartPojoJson = cartObj.toString();
|
| 476 |
} else {
|
477 |
} else {
|
| 477 |
cartPojoJson = "{\"response\":\"error\", \"message\":\"Problem occurred while updating cart\"}";
|
478 |
cartPojoJson = "{\"response\":\"error\", \"message\":\"Problem occurred while updating cart\"}";
|
| 478 |
}
|
479 |
}
|
| 479 |
}
|
480 |
}
|
| 480 |
}catch(Exception e) {
|
481 |
}catch(Exception e) {
|