| Line 223... |
Line 223... |
| 223 |
|
223 |
|
| 224 |
vc = new ValidateCartResponse(cartValidationResponse, "Success", "Items added to cart successfully");
|
224 |
vc = new ValidateCartResponse(cartValidationResponse, "Success", "Items added to cart successfully");
|
| 225 |
return responseSender.ok(vc);
|
225 |
return responseSender.ok(vc);
|
| 226 |
}
|
226 |
}
|
| 227 |
|
227 |
|
| 228 |
@RequestMapping(value = "/cart/item", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 229 |
@ApiImplicitParams({
|
- |
|
| 230 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
- |
|
| 231 |
@ApiOperation(value = "Add or update a single cart item")
|
- |
|
| 232 |
public ResponseEntity<?> updateCartItem(HttpServletRequest request,
|
- |
|
| 233 |
@RequestParam int itemId, @RequestParam int quantity,
|
- |
|
| 234 |
@RequestParam(defaultValue = "0") float sellingPrice) throws Throwable {
|
- |
|
| 235 |
int userId = (int) request.getAttribute("userId");
|
- |
|
| 236 |
int cartId = userAccountRepository.selectByUserIdType(userId, AccountType.cartId).getAccountKey();
|
- |
|
| 237 |
cartService.updateCartItem(cartId, itemId, quantity, sellingPrice);
|
- |
|
| 238 |
return responseSender.ok(cartService.getCartItems(cartId));
|
- |
|
| 239 |
}
|
- |
|
| 240 |
|
- |
|
| 241 |
@RequestMapping(value = "/cart/item", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 242 |
@ApiImplicitParams({
|
- |
|
| 243 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
- |
|
| 244 |
@ApiOperation(value = "Remove an item from cart")
|
- |
|
| 245 |
public ResponseEntity<?> removeCartItem(HttpServletRequest request,
|
- |
|
| 246 |
@RequestParam int itemId) throws Throwable {
|
- |
|
| 247 |
int userId = (int) request.getAttribute("userId");
|
- |
|
| 248 |
int cartId = userAccountRepository.selectByUserIdType(userId, AccountType.cartId).getAccountKey();
|
- |
|
| 249 |
cartService.removeCartItem(cartId, itemId);
|
- |
|
| 250 |
return responseSender.ok(cartService.getCartItems(cartId));
|
- |
|
| 251 |
}
|
- |
|
| 252 |
|
- |
|
| 253 |
@RequestMapping(value = "/cart/items", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 254 |
@ApiImplicitParams({
|
- |
|
| 255 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
- |
|
| 256 |
@ApiOperation(value = "Get current cart items")
|
- |
|
| 257 |
public ResponseEntity<?> getCartItems(HttpServletRequest request) throws Throwable {
|
- |
|
| 258 |
int userId = (int) request.getAttribute("userId");
|
- |
|
| 259 |
int cartId = userAccountRepository.selectByUserIdType(userId, AccountType.cartId).getAccountKey();
|
- |
|
| 260 |
return responseSender.ok(cartService.getCartItems(cartId));
|
- |
|
| 261 |
}
|
- |
|
| 262 |
|
- |
|
| 263 |
@RequestMapping(value = ProfitMandiConstants.URL_CART_CHANGE_ADDRESS, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
228 |
@RequestMapping(value = ProfitMandiConstants.URL_CART_CHANGE_ADDRESS, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 264 |
@ApiImplicitParams({
|
229 |
@ApiImplicitParams({
|
| 265 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
230 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 266 |
|
231 |
|
| 267 |
@ApiOperation(value = "Change address")
|
232 |
@ApiOperation(value = "Change address")
|