Package org.hoteia.qalingo.core.pojo.cart

Examples of org.hoteia.qalingo.core.pojo.cart.FoCheckoutPojo


   
    @RequestMapping(value = FoUrls.GET_CART_AJAX_URL, method = RequestMethod.GET)
    @ResponseBody
    public FoCheckoutPojo getCart(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
        final FoCheckoutPojo checkout = new FoCheckoutPojo();
        injectCart(requestData, checkout);
        return checkout;
    }
View Full Code Here


    @ResponseBody
    public FoCheckoutPojo updateItemQuantity(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
        final String productSkuCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_CART_ITEM_SKU_CODE);
        final String quantity = request.getParameter(RequestConstants.REQUEST_PARAMETER_CART_ITEM_SKU_QUANTITY);
        final FoCheckoutPojo checkout = new FoCheckoutPojo();
        try {
            int quantityValue = Integer.parseInt(quantity);
            webManagementService.updateCart(requestData, productSkuCode, quantityValue);
        } catch (Exception e) {
            logger.error("", e);
            FoMessagePojo errorMessage = new FoMessagePojo();
            errorMessage.setId("error-update-quantity");
            errorMessage.setMessage(e.getMessage());
            checkout.getErrorMessages().add(errorMessage);
            checkout.setStatuts(false);
            return checkout;
        }
        injectCart(requestData, checkout);
        return checkout;
    }
View Full Code Here

    @RequestMapping(value = FoUrls.DELETE_CART_ITEM_AJAX_URL, method = RequestMethod.GET)
    @ResponseBody
    public FoCheckoutPojo deleteItem(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
        final String productSkuCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_CART_ITEM_SKU_CODE);
        final FoCheckoutPojo checkout = new FoCheckoutPojo();
        try {
            webManagementService.deleteCartItem(requestData, productSkuCode);
           
            final Cart cart = requestData.getCart();
            if(cart != null
                    && cart.getTotalCartItems() == 0){
                FoMessagePojo errorMessage = new FoMessagePojo();
                errorMessage.setId("warning-empty-cart");
                errorMessage.setMessage("Your cart is empty");
                checkout.getErrorMessages().add(errorMessage);
            }
           
        } catch (Exception e) {
            logger.error("", e);
            FoMessagePojo errorMessage = new FoMessagePojo();
            errorMessage.setId("error-delete-item");
            errorMessage.setMessage(e.getMessage());
            checkout.getErrorMessages().add(errorMessage);
            checkout.setStatuts(false);
            return checkout;
        }
        injectCart(requestData, checkout);
        return checkout;
    }
View Full Code Here

   
    @RequestMapping(value = FoUrls.APPLY_PROMO_CODE_AJAX_URL, method = RequestMethod.GET)
    @ResponseBody
    public FoCheckoutPojo applyPromoCode(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
        final FoCheckoutPojo checkout = new FoCheckoutPojo();
        injectCart(requestData, checkout);
        return checkout;
    }
View Full Code Here

    @RequestMapping(value = FoUrls.SET_SHIPPING_ADDRESS_AJAX_URL, method = RequestMethod.GET)
    @ResponseBody
    public FoCheckoutPojo setShippingAddress(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
        final String customerShippingAddressGuid = request.getParameter(RequestConstants.REQUEST_PARAMETER_CART_SHIPPING_ADDRESS_GUID);
        final FoCheckoutPojo checkout = new FoCheckoutPojo();
        try {
            webManagementService.setShippingAddress(requestData, customerShippingAddressGuid);
        } catch (Exception e) {
            logger.error("", e);
            FoMessagePojo errorMessage = new FoMessagePojo();
            errorMessage.setId("error-set-shipping-address");
            errorMessage.setMessage(e.getMessage());
            checkout.getErrorMessages().add(errorMessage);
            checkout.setStatuts(false);
            return checkout;
        }
        injectCart(requestData, checkout);
        return checkout;
    }
View Full Code Here

    @RequestMapping(value = FoUrls.SET_BILLING_ADDRESS_AJAX_URL, method = RequestMethod.GET)
    @ResponseBody
    public FoCheckoutPojo setBillingAddress(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
        final String customerBillingAddressGuid = request.getParameter(RequestConstants.REQUEST_PARAMETER_CART_BILLING_ADDRESS_GUID);
        final FoCheckoutPojo checkout = new FoCheckoutPojo();
        try {
            webManagementService.setBillingAddress(requestData, customerBillingAddressGuid);
        } catch (Exception e) {
            logger.error("", e);
            FoMessagePojo errorMessage = new FoMessagePojo();
            errorMessage.setId("error-set-billing-address");
            errorMessage.setMessage(e.getMessage());
            checkout.getErrorMessages().add(errorMessage);
            checkout.setStatuts(false);
            return checkout;
        }
        injectCart(requestData, checkout);
        return checkout;
    }
View Full Code Here

    @RequestMapping(value = FoUrls.SET_DELIVERY_METHOD_AJAX_URL, method = RequestMethod.GET)
    @ResponseBody
    public FoCheckoutPojo setDeliveryMethod(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
        final RequestData requestData = requestUtil.getRequestData(request);
        final String deliveryMethodCode = request.getParameter(RequestConstants.REQUEST_PARAMETER_CART_DELIVERY_METHOD_CODE);
        final FoCheckoutPojo checkout = new FoCheckoutPojo();
        try {
            webManagementService.deleteCartItem(requestData, deliveryMethodCode);
           
        } catch (Exception e) {
            logger.error("", e);
            FoMessagePojo errorMessage = new FoMessagePojo();
            errorMessage.setId("error-set-delivery-method");
            errorMessage.setMessage(e.getMessage());
            checkout.getErrorMessages().add(errorMessage);
            checkout.setStatuts(false);
            return checkout;
        }
        injectCart(requestData, checkout);
        return checkout;
    }
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.pojo.cart.FoCheckoutPojo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.