Package org.hoteia.qalingo.core.domain

Examples of org.hoteia.qalingo.core.domain.OrderCustomer


    public void afterReturning(final StaticPart staticPart, final Object result) {
        if(logger.isDebugEnabled()){
            logger.debug("DocumentGeneratorAspect, afterReturning");
        }
        try {
            final OrderCustomer order = (OrderCustomer) result;
           
            final GenerationDocumentMessageJms generationDocumentMessageJms = new GenerationDocumentMessageJms();
            generationDocumentMessageJms.setEnvironmentName(environmentName);
            generationDocumentMessageJms.setEnvironmentId(environmentId);
            generationDocumentMessageJms.setApplicationName(applicationName);
            generationDocumentMessageJms.setServerName(InetAddress.getLocalHost().getHostName());
            generationDocumentMessageJms.setServerIp(InetAddress.getLocalHost().getHostAddress());
            if(order != null){
                generationDocumentMessageJms.setOrderId(order.getId());
                if(order.getStatus().equals(OrderStatus.ORDER_STATUS_PENDING.getPropertyKey())){
                    generationDocumentMessageJms.setDocumentType(OrderDocumentType.ORDER_CONFIRMATION.getPropertyKey());

                } else if(order.getStatus().equals(OrderStatus.ORDER_STATUS_SENDED.getPropertyKey())){
                    generationDocumentMessageJms.setDocumentType(OrderDocumentType.SHIPPING_CONFIRMATION.getPropertyKey());
                   
                else if(order.getStatus().equals(OrderStatus.ORDER_STATUS_CHARGED.getPropertyKey())){
                    generationDocumentMessageJms.setDocumentType(OrderDocumentType.SHIPPING_CONFIRMATION.getPropertyKey());
                   
                }
               
                // Generate and send the JMS message
View Full Code Here


    @Autowired
    protected OrderCustomerService orderCustomerService;
   
    public OrderCustomer checkout(final Customer customer, final Cart cart) throws Exception {
        OrderCustomer orderCustomer = new OrderCustomer();
        // ORDER NUMBER IS CREATE BY DAO
       
        orderCustomer.setStatus(OrderStatus.ORDER_STATUS_PENDING.getPropertyKey());

        orderCustomer.setCurrency(cart.getCurrency());
        orderCustomer.setMarketAreaId(cart.getMarketAreaId());
        orderCustomer.setRetailerId(cart.getRetailerId());
        orderCustomer.setLocalizationId(cart.getLocalizationId());
        orderCustomer.setCustomerId(customer.getId());
       
        OrderAddress billingAddress = new OrderAddress();
        BeanUtils.copyProperties(customer.getAddress(cart.getBillingAddressId()), billingAddress);
        orderCustomer.setBillingAddress(billingAddress);

        OrderAddress shippingAddress = new OrderAddress();
        BeanUtils.copyProperties(customer.getAddress(cart.getShippingAddressId()), shippingAddress);
        orderCustomer.setShippingAddress(shippingAddress);
       
        // SHIPMENT
        Set<OrderShipment> orderShipments = new HashSet<OrderShipment>();
        Set<DeliveryMethod> deliveryMethods = cart.getDeliveryMethods();
        if(deliveryMethods != null){
            for (Iterator<DeliveryMethod> iteratorDeliveryMethod = deliveryMethods.iterator(); iteratorDeliveryMethod.hasNext();) {
                DeliveryMethod deliveryMethod = (DeliveryMethod) iteratorDeliveryMethod.next();
                OrderShipment orderShipment = new OrderShipment();
                orderShipment.setName(deliveryMethod.getName());
                orderShipment.setExpectedDeliveryDate(null);
                orderShipment.setDeliveryMethodId(deliveryMethod.getId());
                orderShipment.setPrice(deliveryMethod.getPrice(cart.getCurrency().getId()));
               
                Set<CartItem> cartItems = cart.getCartItems();
                Set<OrderItem> orderItems = new HashSet<OrderItem>();
                for (Iterator<CartItem> iteratorCartItem = cartItems.iterator(); iteratorCartItem.hasNext();) {
                    CartItem cartItem = (CartItem) iteratorCartItem.next();
                    OrderItem orderItem = new OrderItem();
                    orderItem.setCurrency(cart.getCurrency());
                    orderItem.setProductSkuCode(cartItem.getProductSkuCode());
                    orderItem.setProductSku(cartItem.getProductSku());
                    orderItem.setPrice(cartItem.getPrice(cart.getMarketAreaId(), cart.getRetailerId()).getSalePrice());
                    orderItem.setQuantity(cartItem.getQuantity());
                   
                    // TAXES
                    Set<CartItemTax> taxes = cartItem.getTaxes();
                    if(taxes != null){
                        for (Iterator<CartItemTax> iteratorCartItemTax = taxes.iterator(); iteratorCartItemTax.hasNext();) {
                            CartItemTax cartItemTax = (CartItemTax) iteratorCartItemTax.next();
                            OrderTax orderTax = new OrderTax();
                            orderTax.setName(cartItemTax.getTax().getName());
                            orderTax.setPercent(cartItemTax.getTax().getPercent());
                            orderTax.setAmount(cartItemTax.getTaxAmount());
                            orderItem.getOrderTaxes().add(orderTax);
                        }
                    }
                   
                    orderItems.add(orderItem);
                }
                orderShipment.setOrderItems(orderItems);
                orderShipments.add(orderShipment);
            }
        }
        orderCustomer.setOrderShipments(orderShipments);
       
        orderCustomer = orderCustomerService.createNewOrder(orderCustomer);
       
        return orderCustomer;
    }
View Full Code Here

                String valueJMSMessage = tm.getText();
               
                if(StringUtils.isNotEmpty(valueJMSMessage)){
                    final GenerationDocumentMessageJms doucmentMessageJms = xmlMapper.getXmlMapper().readValue(valueJMSMessage, GenerationDocumentMessageJms.class);
                   
                    final OrderCustomer order = orderCustomerService.getOrderById(doucmentMessageJms.getOrderId());
                   
                    if(doucmentMessageJms.getDocumentType().equals(OrderDocumentType.ORDER_CONFIRMATION.getPropertyKey())){
                        documentService.generateOrderConfirmation(order);
                       
                    } else if(doucmentMessageJms.getDocumentType().equals(OrderDocumentType.SHIPPING_CONFIRMATION.getPropertyKey())){
View Full Code Here

        Criteria criteria = createDefaultCriteria(OrderCustomer.class);

        FetchPlan fetchPlan =  handleSpecificFetchMode(criteria, params);

        criteria.add(Restrictions.eq("id", orderCustomerId));
        OrderCustomer orderCustomer = (OrderCustomer) criteria.uniqueResult();
        if(orderCustomer != null){
            orderCustomer.setFetchPlan(fetchPlan);
        }
        return orderCustomer;
    }
View Full Code Here

        Criteria criteria = createDefaultCriteria(OrderCustomer.class);

        FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);

        criteria.add(Restrictions.eq("orderNum", orderNum));
        OrderCustomer orderCustomer = (OrderCustomer) criteria.uniqueResult();
        if(orderCustomer != null){
            orderCustomer.setFetchPlan(fetchPlan);
        }
        return orderCustomer;
    }
View Full Code Here

        }
        return orderCustomer;
    }

    private OrderCustomer createNewOrderWithRightOrderNumber(final OrderCustomer orderCustomer) {
        OrderCustomer mergedOrSavedOrderCustomer = null;
        try {
            Session session = (Session) em.getDelegate();
            String hql = "FROM OrderNumber";
            Query query = session.createQuery(hql);
            OrderNumber orderNumber = (OrderNumber) query.uniqueResult();
View Full Code Here

//        }
       
        if (em.contains(orderCustomer)) {
            em.refresh(orderCustomer);
        }
        OrderCustomer mergedOrderCustomer = em.merge(orderCustomer);
        em.flush();
        return mergedOrderCustomer;
    }
View Full Code Here

        final Customer customer = requestData.getCustomer();

        if (customer != null) {
            final List<OrderCustomer> orders = orderCustomerService.findOrdersByCustomerId(customer.getId().toString());
            for (Iterator<OrderCustomer> iterator = orders.iterator(); iterator.hasNext();) {
                OrderCustomer order = (OrderCustomer) iterator.next();
                if(requestURL.contains(order.getPrefixHashFolder())){
                    String filename = null;
                    String filePath = null;
                    if(requestURL.contains(OrderDocumentType.ORDER_CONFIRMATION.getPropertyKey())){
                        filename = documentService.buildOrderConfirmationFileName(order);
                        filePath = documentService.getOrderConfirmationFilePath(order);
View Full Code Here

     *
     */
    public List<OrderViewBean> buildListViewBeanOrder(final RequestData requestData, final List<OrderCustomer> orders) throws Exception {
        final List<OrderViewBean> orderViewBeans = new ArrayList<OrderViewBean>();
        for (Iterator<OrderCustomer> iterator = orders.iterator(); iterator.hasNext();) {
            OrderCustomer order = (OrderCustomer) iterator.next();
            orderViewBeans.add(buildViewBeanOrder(requestData, order));
        }
        return orderViewBeans;
    }
View Full Code Here

  public ModelAndView removeFromWishlist(final HttpServletRequest request, final Model model) throws Exception {
    ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.PERSONAL_ORDER_DETAILS.getVelocityPage());
    final RequestData requestData = requestUtil.getRequestData(request);
    final String orderCustomerId = request.getParameter(RequestConstants.REQUEST_PARAMETER_CUSTOMER_ORDER_GUID);
    if(StringUtils.isNotEmpty(orderCustomerId)){
      final OrderCustomer orderCustomer = orderCustomerService.getOrderById(orderCustomerId);
      if(orderCustomer != null){
        // SANITY CHECK

            final Customer currentCustomer = requestData.getCustomer();
       
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.domain.OrderCustomer

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.