Package org.broadleafcommerce.core.order.domain

Examples of org.broadleafcommerce.core.order.domain.DiscreteOrderItemImpl$Presentation$Group


        //group1.setTotalTax(new Money(1D));
        //group2.setTotalTax(new Money(1D));
        order.setSubTotal(total);
        order.setTotal(total);

        DiscreteOrderItem item = new DiscreteOrderItemImpl();
        Sku sku = new SkuImpl();
        sku.setRetailPrice(new Money(15D));
        sku.setDiscountable(true);
        sku.setName("Test Sku");
       
        sku = catalogService.saveSku(sku);
       
        item.setSku(sku);
        item.setQuantity(1);
        item.setOrder(order);
       
        item = (DiscreteOrderItem) orderItemService.saveOrderItem(item);
       
        List<OrderItem> items = new ArrayList<OrderItem>();
        items.add(item);
View Full Code Here


        order.getPayments().add(payment);
        return payment;
    }

    private void addSampleItemToOrder(Order order, FulfillmentGroup group) {
        DiscreteOrderItem item = new DiscreteOrderItemImpl();
        item.setOrder(order);
        item.setQuantity(1);

        Sku newSku = new SkuImpl();
        newSku.setName("Under Armor T-Shirt -- Red");
        newSku.setRetailPrice(new Money(14.99));
        newSku.setActiveStartDate(SystemTime.asDate());
        newSku.setDiscountable(false);
        newSku = catalogService.saveSku(newSku);
        item.setSku(newSku);

        item = (DiscreteOrderItem) orderItemService.saveOrderItem(item);

        List<OrderItem> items = new ArrayList<OrderItem>();
        items.add(item);
View Full Code Here

        xref2.setProduct(product2);
        xref2.setCategory(category2);
       
        category2.getAllProductXrefs().add(xref2);
       
        DiscreteOrderItem orderItem1 = new DiscreteOrderItemImpl();
        orderItem1.setCategory(category1);
        orderItem1.setName("test1");
        orderItem1.setOrder(order);
        orderItem1.setOrderItemType(OrderItemType.DISCRETE);
        orderItem1.setProduct(product1);
        orderItem1.setQuantity(2);
        orderItem1.setSku(sku1);
        orderItem1.setId(getOrderItemId());
        orderItem1.setOrder(order);
       
        OrderItemPriceDetail priceDetail1 = new OrderItemPriceDetailImpl();
        priceDetail1.setOrderItem(orderItem1);
        priceDetail1.setQuantity(2);
        orderItem1.getOrderItemPriceDetails().add(priceDetail1);
       
        order.getOrderItems().add(orderItem1);
       
        DiscreteOrderItem orderItem2 = new DiscreteOrderItemImpl();
        orderItem2.setCategory(category2);
        orderItem2.setName("test2");
        orderItem2.setOrder(order);
        orderItem2.setOrderItemType(OrderItemType.DISCRETE);
        orderItem2.setProduct(product2);
        orderItem2.setQuantity(3);
        orderItem2.setSku(sku2);
        orderItem2.setId(getOrderItemId());
        orderItem2.setOrder(order);
       
        OrderItemPriceDetail priceDetail2 = new OrderItemPriceDetailImpl();
        priceDetail2.setOrderItem(orderItem2);
        priceDetail2.setQuantity(3);
        orderItem2.getOrderItemPriceDetails().add(priceDetail2);
       
        order.getOrderItems().add(orderItem2);
       
        Customer customer = new CustomerImpl();
        customer.setEmailAddress("test@test.com");
View Full Code Here

        priceDetail.setQuantity(2);
        bundleOrderItem.getOrderItemPriceDetails().add(priceDetail);

        order.getOrderItems().add(bundleOrderItem);

        DiscreteOrderItem orderItem1 = new DiscreteOrderItemImpl();
        orderItem1.setCategory(category1);
        orderItem1.setName("test1");
        orderItem1.setOrder(order);
        orderItem1.setOrderItemType(OrderItemType.DISCRETE);
        orderItem1.setProduct(product1);
        orderItem1.setQuantity(2);
        orderItem1.setSku(sku1);
        orderItem1.setId(getOrderItemId());
        orderItem1.setOrder(order);

        OrderItemPriceDetail priceDetail1 = new OrderItemPriceDetailImpl();
        priceDetail1.setOrderItem(orderItem1);
        priceDetail1.setQuantity(2);
        orderItem1.getOrderItemPriceDetails().add(priceDetail1);

        bundleOrderItem.getDiscreteOrderItems().add(orderItem1);

        DiscreteOrderItem orderItem2 = new DiscreteOrderItemImpl();
        orderItem2.setCategory(category2);
        orderItem2.setName("test2");
        orderItem2.setOrder(order);
        orderItem2.setOrderItemType(OrderItemType.DISCRETE);
        orderItem2.setProduct(product2);
        orderItem2.setQuantity(3);
        orderItem2.setSku(sku2);
        orderItem2.setId(getOrderItemId());
        orderItem2.setOrder(order);

        OrderItemPriceDetail priceDetail2 = new OrderItemPriceDetailImpl();
        priceDetail2.setOrderItem(orderItem2);
        priceDetail2.setQuantity(3);
        orderItem2.getOrderItemPriceDetails().add(priceDetail2);

        bundleOrderItem.getDiscreteOrderItems().add(orderItem2);

        Customer customer = new CustomerImpl();
        customer.setEmailAddress("test@test.com");
View Full Code Here

        group.setRetailShippingPrice(total);
        group.setShippingPrice(total);

        DiscreteOrderItem item1;
        {
        item1 = new DiscreteOrderItemImpl();
        Sku sku = new SkuImpl();
        sku.setName("Test Sku");
        sku.setRetailPrice(new Money(10D));
        sku.setDiscountable(true);

        sku = catalogService.saveSku(sku);

        item1.setSku(sku);
        item1.setQuantity(2);
        item1.setOrder(order);
        item1.setOrderItemType(OrderItemType.DISCRETE);

        item1 = (DiscreteOrderItem) orderItemService.saveOrderItem(item1);

        order.addOrderItem(item1);
        FulfillmentGroupItem fgItem = new FulfillmentGroupItemImpl();
        fgItem.setFulfillmentGroup(group);
        fgItem.setOrderItem(item1);
        fgItem.setQuantity(2);
        //fgItem.setPrice(new Money(0D));
        group.addFulfillmentGroupItem(fgItem);
        }

        {
        DiscreteOrderItem item = new DiscreteOrderItemImpl();
        Sku sku = new SkuImpl();
        sku.setName("Test Product 2");
        sku.setRetailPrice(new Money(20D));
        sku.setDiscountable(true);

        sku = catalogService.saveSku(sku);

        item.setSku(sku);
        item.setQuantity(1);
        item.setOrder(order);
        item.setOrderItemType(OrderItemType.DISCRETE);

        item = (DiscreteOrderItem) orderItemService.saveOrderItem(item);

        order.addOrderItem(item);

        FulfillmentGroupItem fgItem = new FulfillmentGroupItemImpl();
        fgItem.setFulfillmentGroup(group);
        fgItem.setOrderItem(item);
        fgItem.setQuantity(1);
        //fgItem.setPrice(new Money(0D));
        group.addFulfillmentGroupItem(fgItem);
        }

        {
        GiftWrapOrderItem item = new GiftWrapOrderItemImpl();
        Sku sku = new SkuImpl();
        sku.setName("Test GiftWrap");
        sku.setRetailPrice(new Money(1D));
        sku.setDiscountable(true);

        sku = catalogService.saveSku(sku);

        item.setSku(sku);
        item.setQuantity(1);
        item.setOrder(order);
        item.getWrappedItems().add(item1);
        item.setOrderItemType(OrderItemType.GIFTWRAP);

        item = (GiftWrapOrderItem) orderItemService.saveOrderItem(item);

        order.addOrderItem(item);
View Full Code Here

        Order result = new OrderImpl();

        List<FulfillmentGroupItem> fulfillmentItems = new ArrayList<FulfillmentGroupItem>();
        for (int i = 0; i < orderItemsToCreate; i++) {
            DiscreteOrderItem orderItem = new DiscreteOrderItemImpl();
            Sku sku = new SkuImpl();
            //set the sku price to some arbitrary amount - won't matter because the test is based on order item price
            sku.setRetailPrice(new Money("1"));
            orderItem.setSku(sku);

            if (flatRates != null && i < flatRates.length) {
                sku.getFulfillmentFlatRates().put(option, new BigDecimal(flatRates[i]));
            }

            if (option instanceof BandedPriceFulfillmentOption) {
                orderItem.setPrice(new Money(total.divide(new BigDecimal(orderItemsToCreate))));
            } else if (option instanceof BandedWeightFulfillmentOption) {
                Weight weight = new Weight();
                weight.setWeight(total.divide(new BigDecimal(orderItemsToCreate)));
                weight.setWeightUnitOfMeasure(WeightUnitOfMeasureType.POUNDS);
                orderItem.getSku().setWeight(weight);
                orderItem.setPrice(new Money(BigDecimal.ZERO));
            }
            orderItem.setOrder(result);

            FulfillmentGroupItem fulfillmentItem = new FulfillmentGroupItemImpl();
            fulfillmentItem.setOrderItem(orderItem);
            if (quantities == null) {
                fulfillmentItem.setQuantity(1);
View Full Code Here

        group.setRetailShippingPrice(total);
        group.setShippingPrice(total);

        DiscreteOrderItem item1;
        {
        item1 = new DiscreteOrderItemImpl();
        Sku sku = new SkuImpl();
        sku.setName("Test Sku");
        sku.setRetailPrice(new Money(10D));
        sku.setDiscountable(true);

        sku = catalogService.saveSku(sku);

        item1.setSku(sku);
        item1.setQuantity(2);
        item1.setOrder(order);
        item1.setOrderItemType(OrderItemType.DISCRETE);

        item1 = (DiscreteOrderItem) orderItemService.saveOrderItem(item1);

        order.addOrderItem(item1);
        FulfillmentGroupItem fgItem = new FulfillmentGroupItemImpl();
        fgItem.setFulfillmentGroup(group);
        fgItem.setOrderItem(item1);
        fgItem.setQuantity(2);
        //fgItem.setPrice(new Money(0D));
        group.addFulfillmentGroupItem(fgItem);
        }

        {
        DiscreteOrderItem item = new DiscreteOrderItemImpl();
        Sku sku = new SkuImpl();
        sku.setName("Test Product 2");
        sku.setRetailPrice(new Money(20D));
        sku.setDiscountable(true);

        sku = catalogService.saveSku(sku);

        item.setSku(sku);
        item.setQuantity(1);
        item.setOrder(order);
        item.setOrderItemType(OrderItemType.DISCRETE);

        item = (DiscreteOrderItem) orderItemService.saveOrderItem(item);

        order.addOrderItem(item);

        FulfillmentGroupItem fgItem = new FulfillmentGroupItemImpl();
        fgItem.setFulfillmentGroup(group);
        fgItem.setOrderItem(item);
        fgItem.setQuantity(1);
        //fgItem.setPrice(new Money(0D));
        group.addFulfillmentGroupItem(fgItem);
        }

        {
        GiftWrapOrderItem item = new GiftWrapOrderItemImpl();
        Sku sku = new SkuImpl();
        sku.setName("Test GiftWrap");
        sku.setRetailPrice(new Money(1D));
        sku.setDiscountable(true);

        sku = catalogService.saveSku(sku);

        item.setSku(sku);
        item.setQuantity(1);
        item.setOrder(order);
        item.getWrappedItems().add(item1);
        item.setOrderItemType(OrderItemType.GIFTWRAP);

        item = (GiftWrapOrderItem) orderItemService.saveOrderItem(item);

        order.addOrderItem(item);
View Full Code Here

        xref2.setProduct(product2);
        xref2.setCategory(category2);

        category2.getAllProductXrefs().add(xref2);
       
        DiscreteOrderItemImpl orderItem1 = new DiscreteOrderItemImpl();
        orderItem1.setCategory(category1);
        orderItem1.setName("test1");
        orderItem1.setOrderItemType(OrderItemType.DISCRETE);
        orderItem1.setProduct(product1);
        orderItem1.setQuantity(2);
        orderItem1.setSku(sku1);
       
        Order order = new OrderImpl();
        orderItem1.setOrder(order);
       
        promotableOrder = new PromotableOrderImpl(order, new PromotableItemFactoryImpl(), false);
        offer = dataProvider.createItemBasedOfferWithItemCriteria(
                "order.subTotal.getAmount()>20",
                OfferDiscountType.PERCENT_OFF,
View Full Code Here

        //----------------------------------------------------------------------------------------------------
        // Mock up some order data
        OrderImpl order = new OrderImpl();
        CategoryImpl category = new CategoryImpl();
        category.setName("t-shirt");
        DiscreteOrderItemImpl orderItem = new DiscreteOrderItemImpl();
        ProductImpl product = new ProductImpl();
        ArrayList<CategoryProductXref> categories = new ArrayList<CategoryProductXref>();
        CategoryProductXref categoryXref = new CategoryProductXrefImpl();
        categoryXref.setProduct(product);
        categoryXref.setCategory(category);
        categories.add(categoryXref);
        product.setAllParentCategoryXrefs(categories);
        orderItem.setProduct(product);
        order.getOrderItems().add(orderItem);
        order.setSubTotal(new Money(110D));

        //Set up MVEL Context
        ParserContext context = new ParserContext();
View Full Code Here

    }

    @Test
    public void testOfferAppliesToSpecificItems() {

        DiscreteOrderItemImpl orderItem = new DiscreteOrderItemImpl();
        Sku sku = new SkuImpl();
        sku.setRetailPrice(new Money("1"));
        sku.setId(1234L);
        orderItem.setSku(sku);
        OfferImpl offer = new OfferImpl();
        offer.setType(OfferType.ORDER_ITEM);

        //Set up MVEL Context
        ParserContext context = new ParserContext();
View Full Code Here

TOP

Related Classes of org.broadleafcommerce.core.order.domain.DiscreteOrderItemImpl$Presentation$Group

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.