@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public CommonCartPojoResponse getCart(GetCartPojoRequest getCartPojoRequest) {
CommonCartPojoResponse commonCartPojoResponse = new CommonCartPojoResponse();
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (!(authentication instanceof AnonymousAuthenticationToken)) {
String currentCustomerName = authentication.getName();
if(StringUtils.isNotEmpty(currentCustomerName)){
Customer customer = customerService.getCustomerByLoginOrEmail(currentCustomerName);
if(StringUtils.isNotEmpty(getCartPojoRequest.getMarketAreaCode())){
MarketArea marketArea = marketService.getMarketAreaByCode(getCartPojoRequest.getMarketAreaCode());
try {
CartPojo cartPojo = checkoutPojoService.getCart(marketArea, customer);
commonCartPojoResponse.setCart(cartPojo);
} catch (Exception e) {
// TODO SEND ERREUR
}
}
} else {