| Line 40... |
Line 40... |
| 40 |
import com.spice.profitmandi.web.model.ResponseStatus;
|
40 |
import com.spice.profitmandi.web.model.ResponseStatus;
|
| 41 |
import com.spice.profitmandi.web.req.AddCartRequest;
|
41 |
import com.spice.profitmandi.web.req.AddCartRequest;
|
| 42 |
import com.spice.profitmandi.web.req.CartItems;
|
42 |
import com.spice.profitmandi.web.req.CartItems;
|
| 43 |
import com.spice.profitmandi.web.res.CartResponse;
|
43 |
import com.spice.profitmandi.web.res.CartResponse;
|
| 44 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
44 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
| - |
|
45 |
import com.spice.profitmandi.web.util.ResponseSender;
|
| 45 |
|
46 |
|
| 46 |
import in.shop2020.logistics.DeliveryType;
|
47 |
import in.shop2020.logistics.DeliveryType;
|
| 47 |
import in.shop2020.model.v1.user.ItemQuantity;
|
48 |
import in.shop2020.model.v1.user.ItemQuantity;
|
| 48 |
import in.shop2020.model.v1.user.UserContextService;
|
49 |
import in.shop2020.model.v1.user.UserContextService;
|
| 49 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
50 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
| Line 53... |
Line 54... |
| 53 |
|
54 |
|
| 54 |
@Controller
|
55 |
@Controller
|
| 55 |
public class CartController {
|
56 |
public class CartController {
|
| 56 |
|
57 |
|
| 57 |
private static final Logger logger=LoggerFactory.getLogger(CartController.class);
|
58 |
private static final Logger logger=LoggerFactory.getLogger(CartController.class);
|
| - |
|
59 |
|
| - |
|
60 |
@Autowired
|
| - |
|
61 |
ResponseSender<?> responseSender;
|
| 58 |
|
62 |
|
| 59 |
@Autowired
|
63 |
@Autowired
|
| 60 |
UserAccountRepository userAccountRepository;
|
64 |
UserAccountRepository userAccountRepository;
|
| 61 |
|
65 |
|
| 62 |
@RequestMapping(value = ProfitMandiConstants.URL_CART, method=RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
66 |
@RequestMapping(value = ProfitMandiConstants.URL_CART, method=RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
| Line 241... |
Line 245... |
| 241 |
public ResponseEntity<?> changeAddress(HttpServletRequest request,@PathVariable(value="cartId") long cartId, @RequestParam(value="addressId") long addressId){
|
245 |
public ResponseEntity<?> changeAddress(HttpServletRequest request,@PathVariable(value="cartId") long cartId, @RequestParam(value="addressId") long addressId){
|
| 242 |
ProfitMandiResponse<?> profitMandiResponse;
|
246 |
ProfitMandiResponse<?> profitMandiResponse;
|
| 243 |
try {
|
247 |
try {
|
| 244 |
UserContextService.Client userClient = new UserClient().getClient();
|
248 |
UserContextService.Client userClient = new UserClient().getClient();
|
| 245 |
userClient.addAddressToCart(cartId, addressId);
|
249 |
userClient.addAddressToCart(cartId, addressId);
|
| 246 |
profitMandiResponse = new ProfitMandiResponse<>(request.getRequestURL().toString(), "Address changed successfully");
|
250 |
return responseSender.ok("Address Changed successfully");
|
| 247 |
} catch(Exception e) {
|
251 |
} catch(Exception e) {
|
| 248 |
profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, "Could not changed the address");
|
252 |
profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, "Could not changed the address");
|
| 249 |
logger.error("Unable to change address", e);
|
253 |
logger.error("Unable to change address", e);
|
| 250 |
}
|
254 |
}
|
| 251 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
255 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|