| Line 71... |
Line 71... |
| 71 |
@ApiOperation(value = "Add items to cart")
|
71 |
@ApiOperation(value = "Add items to cart")
|
| 72 |
public ResponseEntity<?> validateCart(HttpServletRequest request,@RequestBody AddCartRequest cartRequest){
|
72 |
public ResponseEntity<?> validateCart(HttpServletRequest request,@RequestBody AddCartRequest cartRequest){
|
| 73 |
UserAccounts userAccount = null;
|
73 |
UserAccounts userAccount = null;
|
| 74 |
ValidateCartResponse vc = null;
|
74 |
ValidateCartResponse vc = null;
|
| 75 |
try {
|
75 |
try {
|
| 76 |
userAccount = userAccountRepository.getUserAccountByType(47, AccountType.cartId);
|
76 |
userAccount = userAccountRepository.getUserAccountByType(14, AccountType.cartId);
|
| 77 |
logger.info("UserAccount "+userAccount);
|
77 |
logger.info("UserAccount "+userAccount);
|
| 78 |
} catch (ProfitMandiBusinessException e1) {
|
78 |
} catch (ProfitMandiBusinessException e1) {
|
| 79 |
vc = new ValidateCartResponse(null, "Error","Error while getting cart information");
|
79 |
vc = new ValidateCartResponse(null, "Error","Error while getting cart information");
|
| 80 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, vc);
|
80 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, vc);
|
| 81 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
81 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.INTERNAL_SERVER_ERROR);
|
| Line 214... |
Line 214... |
| 214 |
}
|
214 |
}
|
| 215 |
else if(maxEstimate==-2){
|
215 |
else if(maxEstimate==-2){
|
| 216 |
cartObj.put("estimateString", "Out of Stock");
|
216 |
cartObj.put("estimateString", "Out of Stock");
|
| 217 |
} else {
|
217 |
} else {
|
| 218 |
try {
|
218 |
try {
|
| 219 |
cartObj.put("cod", userClient.showCODOption(Integer.valueOf(userAccount.getAccount_key()), 0, "110002"));
|
219 |
cartObj.put("cod", cartObj.getBoolean("codAllowed"));
|
| 220 |
cartObj.put("estimateString", LogisticsService.getDeliveryDateString(maxEstimate,DeliveryType.COD));
|
220 |
cartObj.put("estimateString", LogisticsService.getDeliveryDateString(maxEstimate,DeliveryType.COD));
|
| 221 |
} catch (NumberFormatException | JSONException | TException e) {
|
221 |
} catch (NumberFormatException | JSONException | TException e) {
|
| 222 |
// TODO Auto-generated catch block
|
222 |
// TODO Auto-generated catch block
|
| 223 |
e.printStackTrace();
|
223 |
e.printStackTrace();
|
| 224 |
vc = new ValidateCartResponse(null, "Error","Problem occurred while getting delivery estimates");
|
224 |
vc = new ValidateCartResponse(null, "Error","Problem occurred while getting delivery estimates");
|