Package com.jada.order.cart

Examples of com.jada.order.cart.ShoppingCart


            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
      init(request);
      ContentBean contentBean = getContentBean(request);
      Site site = contentBean.getSiteDomain().getSite();
    ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
      EntityManager em = null;
    em = JpaConnection.getInstance().getCurrentEntityManager();
   
    Customer customer = getCustomer(request);
    if (customer.getCustPassword() == null) {
        ShoppingCartActionForm form = (ShoppingCartActionForm) actionForm;
      ActionMessages errors = validate(form, site.getSiteId());
      if (errors.size() != 0) {
        saveMessages(request, errors);
        form.setCustPassword(null);
        form.setCustVerifyPassword(null);
        this.initAddressInfo(form, site, shoppingCart, request, errors);
        this.initSearchInfo(form, site.getSiteId(), errors);
        this.initCartInfo(form, site, shoppingCart, request, errors);
            createEmptySecureTemplateInfo(request);
        return actionMapping.findForward("error");
      }
      Customer c = (Customer) em.find(Customer.class, customer.getCustId());
      c.setCustPassword(AESEncoder.getInstance().encode(form.getCustPassword()));
      c.setCustPublicName(form.getCustPublicName());
       }
   
      PayPalEngine paymentEngine = (PayPalEngine) shoppingCart.getPaymentEngine();
      String orderNum = null;
      createEmptySecureTemplateInfo(request);
    OrderEngine orderEngine = new OrderEngine(shoppingCart, null);
      try {
        OrderHeader orderHeader = orderEngine.getOrderHeader();
      InvoiceEngine invoiceEngine = new InvoiceEngine(orderHeader, null);
      invoiceEngine.invoiceAll();
      invoiceEngine.setCreditCardInfo(orderEngine.getCreditCardInfo());
      invoiceEngine.payOrder(shoppingCart.getPaymentEngine(), request);
      orderEngine.saveOrder();
      orderNum = orderEngine.getOrderHeader().getOrderNum();
      invoiceEngine.saveOrder();
      }
      catch (PaymentException e) {
        logger.error(e);
        paymentEngine.cancelPayment();
        shoppingCart.cancelTransaction();
        em.getTransaction().setRollbackOnly();
        return actionMapping.findForward("paymentError");
      }
     
      try {
View Full Code Here


      return info;

  }
 
  public ShoppingCartSummaryInfo getShoppingCartSummary(HttpServletRequest request) throws Exception {
    ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, false);
    ShoppingCartSummaryInfo info = new ShoppingCartSummaryInfo();
    Vector<ItemInfo> itemVector = new Vector<ItemInfo>();
    int itemCount = 0;
    double priceTotal = 0;
    if (shoppingCart != null) {
      Vector<?> vector = shoppingCart.getShoppingCartItems();
      Iterator<?> iterator = vector.iterator();
      while (iterator.hasNext()) {
        ShoppingCartItem shoppingCartItem = (ShoppingCartItem) iterator.next();
        ItemInfo itemInfo = formatItem(shoppingCartItem.getItem());
        itemInfo.setItemOrderedQty(Format.getInt(shoppingCartItem.getItemQty()));
        itemVector.add(itemInfo);
      }
      itemCount = shoppingCart.getItemCount();
      priceTotal = shoppingCart.getPriceTotal();
    }
    ItemInfo cartItems[] = new ItemInfo[itemVector.size()];
    itemVector.copyInto(cartItems);
    info.setCartItems(cartItems);
    info.setItemCount(Format.getInt(itemCount));
View Full Code Here

    public ActionForward list(ActionMapping actionMapping,
            ActionForm actionForm,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {

      ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
      PaymentEngine paymentEngine = shoppingCart.getPaymentEngine();
      try {
        ContentBean contentBean = getContentBean(request);
        if (paymentEngine != null) {
          paymentEngine.callBack(request, shoppingCart, contentBean);
          if (paymentEngine.isProvideCustomer()) {
          }
        }
        shoppingCart.recalculate(contentBean);
      }
      catch (PaymentException e) {
        logger.error(e);
        paymentEngine.abort();
        shoppingCart.cancelTransaction();
        createEmptySecureTemplateInfo(request);
        return actionMapping.findForward("paymentError");
      }
      catch (PaymentCustomerException e) {
        paymentEngine.abort();
        shoppingCart.cancelTransaction();
        createEmptySecureTemplateInfo(request);
        return actionMapping.findForward("paymentCustomerError");
      }
     
    this.saveToken(request);
View Full Code Here

            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
      ContentBean contentBean = getContentBean(request);
      ShoppingCartActionForm form = (ShoppingCartActionForm) actionForm;
      Site site = contentBean.getContentSessionBean().getSiteDomain().getSite();
      ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
    ActionMessages messages = new ActionMessages();
      createEmptySecureTemplateInfo(request);
    try {
      this.finalizeOrder(form, site, shoppingCart, request, messages);
      }
    catch (AuthorizationException e) {
      logger.error(e);
      this.ignoreToken(request, true);
      return actionMapping.findForward("authorizationException");
    }
    catch (NotImplementedException e) {
      logger.error(e);
      this.ignoreToken(request, true);
      return actionMapping.findForward("authorizationException");
    }
    catch (PaymentException e) {
      logger.error(e);
      return actionMapping.findForward("paymentError");
    }

      request.setAttribute("shoppingCart.orderNum", shoppingCart.getOrderNum());
      ShoppingCart.remove(request);
      ActionForward forward = actionMapping.findForward("success");
        forward = new ActionForward(forward.getPath() +
                      "&prefix=" + contentBean.getSiteDomain().getSiteDomainPrefix() +
                      "&langName=" + contentBean.getContentSessionKey().getLangName() +
                      "&shoppingCart.orderNum=" + shoppingCart.getOrderNum(),
                      forward.getRedirect());
        return forward;
    }
View Full Code Here

      ActionForward actionForward = actionMapping.findForward("success");
      ShoppingCartActionForm form = (ShoppingCartActionForm) actionForm;
      ContentBean contentBean = getContentBean(request);
      Site site = contentBean.getContentSessionBean().getSiteDomain().getSite();
   
    ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
    ActionMessages messages = new ActionMessages();
    this.initCartInfo(form, site, shoppingCart, request, messages);
    this.initCreditCardInfo(form, site, shoppingCart, request, messages);
    this.initSearchInfo(form, site.getSiteId(), messages);
   
    if (form.getPaymentError() != null && form.getPaymentError().equalsIgnoreCase("true")) {
      form.setPaymentMessage(shoppingCart.getPaymentEngine().getPaymentMessage());
    }
   
    if (shoppingCart.isShippingQuoteLock()) {
      this.saveOpenOrder(shoppingCart, Constants.ORDER_STEP_QUOTE_CREDITCARD);
    }
    else {
      this.saveOpenOrder(shoppingCart, Constants.ORDER_STEP_CREDITCARD);
    }
View Full Code Here

      saveMessages(request, messages);
        initSearchInfo(form, site.getSiteId(), messages);
            ActionForward actionForward = actionMapping.findForward("error");
            return actionForward;
      }
    ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
      this.saveCreditCard(form, site, shoppingCart, contentBean);

      initSearchInfo(form, site.getSiteId(), messages);

        ActionForward actionForward = actionMapping.findForward("updateSuccess");
View Full Code Here

      ActionForward actionForward = actionMapping.findForward("success");
      ShoppingCartActionForm form = (ShoppingCartActionForm) actionForm;
      ContentBean contentBean = getContentBean(request);
      Site site = contentBean.getContentSessionBean().getSiteDomain().getSite();
   
    ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
    if (shoppingCart.isShippingQuoteLock()) {
          actionForward = actionMapping.findForward("quote");
            return actionForward;
    }
   
    ActionMessages messages = new ActionMessages();
View Full Code Here

     
      ContentBean contentBean = getContentBean(request);
      Site site = contentBean.getContentSessionBean().getSiteDomain().getSite();
      createEmptySecureTemplateInfo(request);
      ShoppingCartActionForm form = (ShoppingCartActionForm) actionForm;
    ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
//    shoppingCart.setShippingPickUp(false);
    ActionForward actionForward = null;
    if (shoppingCart.isShippingQuoteLock()) {
          actionForward = actionMapping.findForward("quote");
            return actionForward;
    }

    this.init(request);
View Full Code Here

   
    private void mergeOrder(HttpServletRequest request, MyAccountLoginActionForm form, Customer customer) throws Exception {
      ContentBean contentBean = getContentBean(request);
      Site site = contentBean.getSiteDomain().getSite();
        if (contentBean.isShoppingCartEnabled()) {
        ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
        shoppingCart.initCustomer(customer, contentBean);
        OrderHeader orderHeader = null;
        String orderNum = form.getOrderNum();
        if (!Format.isNullOrEmpty(orderNum)) {
          orderHeader = OrderHeaderDAO.load(site.getSiteId(), orderNum);
          if (!orderHeader.getCustomer().getCustId().equals(customer.getCustId())) {
            orderHeader = null;
          }
        }
        else {
              orderHeader = shoppingCart.locateAbundentOrder();
        }
            if (orderHeader != null) {
              shoppingCart.mergeOrder(orderHeader.getOrderHeaderId(), contentBean);
            }
        }
    }
View Full Code Here

            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
      ContentBean contentBean = getContentBean(request);
      ShoppingCartActionForm form = (ShoppingCartActionForm) actionForm;
      Site site = contentBean.getContentSessionBean().getSiteDomain().getSite();
      ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
    ActionMessages messages = new ActionMessages();
      createEmptySecureTemplateInfo(request);
    try {
      this.finalizeOrder(form, site, shoppingCart, request, messages);
      }
    catch (AuthorizationException e) {
      logger.error(e);
      this.ignoreToken(request, true);
      return actionMapping.findForward("authorizationException");
    }
    catch (PaymentException e) {
      logger.error(e);
      return actionMapping.findForward("paymentError");
    }

      request.setAttribute("shoppingCart.orderNum", shoppingCart.getOrderNum());
      ShoppingCart.remove(request);
      ActionForward forward = actionMapping.findForward("success");
        forward = new ActionForward(forward.getPath() +
                      "&prefix=" + contentBean.getSiteDomain().getSiteDomainPrefix() +
                      "&langName=" + contentBean.getContentSessionKey().getLangName() +
                      "&shoppingCart.orderNum=" + shoppingCart.getOrderNum(), forward.getRedirect());
        return forward;
    }
View Full Code Here

TOP

Related Classes of com.jada.order.cart.ShoppingCart

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.