Package org.broadleafcommerce.core.order.domain

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


        address.setPostalCode("75240");
        address.setPrimaryPhone("972-978-9067");
        address.setState(state);
        address.setCountry(country);
       
        FulfillmentGroup group = new FulfillmentGroupImpl();
        group.setAddress(address);
        List<FulfillmentGroup> groups = new ArrayList<FulfillmentGroup>();
        group.setMethod("standard");
        group.setService(ShippingServiceType.BANDED_SHIPPING.getType());
        group.setOrder(order);
        groups.add(group);
        order.setFulfillmentGroups(groups);
        Money total = new Money(8.5D);
        group.setShippingPrice(total);

        {
        DiscreteOrderItem item = new DiscreteOrderItemImpl();
        Sku sku = new SkuImpl();
        sku.setName("Test Sku");
        sku.setRetailPrice(new Money(10D));
        sku.setDiscountable(true);
          
        SkuFee fee = new SkuFeeImpl();
        fee.setFeeType(SkuFeeType.FULFILLMENT);
        fee.setName("fee test");
        fee.setAmount(new Money(10D));
        fee = catalogService.saveSkuFee(fee);
        List<SkuFee> fees = new ArrayList<SkuFee>();
        fees.add(fee);
       
        sku.setFees(fees);
        sku = catalogService.saveSku(sku);
       
        item.setSku(sku);
        item.setQuantity(2);
        item.setOrder(order);
       
        item = (DiscreteOrderItem) orderItemService.saveOrderItem(item);
       
        order.addOrderItem(item);
        FulfillmentGroupItem fgItem = new FulfillmentGroupItemImpl();
        fgItem.setFulfillmentGroup(group);
        fgItem.setOrderItem(item);
        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 = (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);
        }
       
        order.addOfferCode(createOfferCode("20 Percent Off Item Offer", OfferType.ORDER_ITEM, OfferDiscountType.PERCENT_OFF, 20, null, "discreteOrderItem.sku.name==\"Test Sku\""));
        order.addOfferCode(createOfferCode("3 Dollars Off Item Offer", OfferType.ORDER_ITEM, OfferDiscountType.AMOUNT_OFF, 3, null, "discreteOrderItem.sku.name!=\"Test Sku\""));
        order.addOfferCode(createOfferCode("1.20 Dollars Off Order Offer", OfferType.ORDER, OfferDiscountType.AMOUNT_OFF, 1.20, null, null));
View Full Code Here


    public void testShipping() throws Exception {
        Order order = orderService.createNewCartForCustomer(createCustomer());
       
        customerService.saveCustomer(order.getCustomer());
       
        FulfillmentGroup group1 = new FulfillmentGroupImpl();
        FulfillmentGroup group2 = new FulfillmentGroupImpl();

        // setup group1 - standard
        group1.setMethod("standard");
        group1.setService(ShippingServiceType.BANDED_SHIPPING.getType());

        Country country = new CountryImpl();
        country.setAbbreviation("US");
        country.setName("United States");

        country = countryService.save(country);

        State state = new StateImpl();
        state.setAbbreviation("TX");
        state.setName("Texas");
        state.setCountry(country);

        state = stateService.save(state);
       
        Address address = new AddressImpl();
        address.setAddressLine1("123 Test Rd");
        address.setCity("Dallas");
        address.setFirstName("Jeff");
        address.setLastName("Fischer");
        address.setPostalCode("75240");
        address.setPrimaryPhone("972-978-9067");

        address.setState(state);
        address.setCountry(country);
        group1.setAddress(address);
        group1.setOrder(order);

        // setup group2 - truck
        group2.setMethod("truck");
        group2.setService(ShippingServiceType.BANDED_SHIPPING.getType());
        group2.setOrder(order);

        List<FulfillmentGroup> groups = new ArrayList<FulfillmentGroup>();
        groups.add(group1);
        //groups.add(group2);
        order.setFulfillmentGroups(groups);
        Money total = new Money(8.5D);
        group1.setShippingPrice(total);
        group2.setShippingPrice(total);
        //group1.setTotalTax(new Money(1D));
        //group2.setTotalTax(new Money(1D));
        order.setSubTotal(total);
        order.setTotal(total);
View Full Code Here

        //fgItem.setPrice(new Money(0D));
        group.addFulfillmentGroupItem(fgItem);
    }

    private FulfillmentGroup buildFulfillmentGroup(Order order, Address address) {
        FulfillmentGroup group = new FulfillmentGroupImpl();
        group.setIsShippingPriceTaxable(true);
        group.setOrder(order);
        group.setAddress(address);
        List<FulfillmentGroup> groups = new ArrayList<FulfillmentGroup>();
        groups.add(group);
        order.setFulfillmentGroups(groups);
        Money total = new Money(5D);
        group.setShippingPrice(total);
        group.setMethod("standard");
        group.setService(ShippingServiceType.BANDED_SHIPPING.getType());
        return group;
    }
View Full Code Here

       
        order.setCustomer(customer);
       
        order.setEmailAddress("test@test.com");
       
        FulfillmentGroup fg1 = new FulfillmentGroupImpl();
        fg1.setId(1L);
        Address address1 = new AddressImpl();
        address1.setAddressLine1("123 Test Road");
        address1.setCity("Dallas");
       
        Country country = new CountryImpl();
        country.setAbbreviation("US");
        country.setName("United States");
       
        address1.setCountry(country);
        address1.setDefault(true);
        address1.setFirstName("John");
        address1.setLastName("Tester");
        address1.setPostalCode("75244");

        Phone primary = new PhoneImpl();
        primary.setPhoneNumber("972-976-1234");
        address1.setPhonePrimary(primary);
       
        State state = new StateImpl();
        state.setAbbreviation("TX");
        state.setCountry(country);
        state.setName("Texas");
       
        address1.setState(state);
        fg1.setAddress(address1);
        fg1.setOrder(order);
        fg1.setPrimary(true);
        fg1.setRetailShippingPrice(new Money(10D));
        fg1.setShippingPrice(new Money(10D));
        fg1.setType(FulfillmentType.PHYSICAL_SHIP);
        fg1.setOrder(order);
       
        FulfillmentGroupItem fgItem1 = new FulfillmentGroupItemImpl();
        fgItem1.setFulfillmentGroup(fg1);
        fgItem1.setOrderItem(orderItem1);
        fgItem1.setQuantity(2);
        //fgItem1.setRetailPrice(new Money(19.99D));
        fg1.getFulfillmentGroupItems().add(fgItem1);
       
        order.getFulfillmentGroups().add(fg1);
       
        FulfillmentGroup fg2 = new FulfillmentGroupImpl();
        fg2.setId(2L);
        Address address2 = new AddressImpl();
        address2.setAddressLine1("124 Test Road");
        address2.setCity("Dallas");
       
        Country country2 = new CountryImpl();
        country2.setAbbreviation("US");
        country2.setName("United States");
       
        address2.setCountry(country2);
        address2.setDefault(true);
        address2.setFirstName("John");
        address2.setLastName("Tester");
        address2.setPostalCode("75244");

        Phone primary2 = new PhoneImpl();
        primary2.setPhoneNumber("972-976-1234");
        address2.setPhonePrimary(primary2);
       
        State state2 = new StateImpl();
        state2.setAbbreviation("TX");
        state2.setCountry(country2);
        state2.setName("Texas");
       
        address2.setState(state2);
        fg2.setAddress(address2);
        fg2.setOrder(order);
        fg2.setPrimary(true);
        fg2.setRetailShippingPrice(new Money(20D));
        fg2.setShippingPrice(new Money(20D));
        fg2.setType(FulfillmentType.PHYSICAL_SHIP);
        fg2.setOrder(order);
       
        FulfillmentGroupItem fgItem2 = new FulfillmentGroupItemImpl();
        fgItem2.setFulfillmentGroup(fg2);
        fgItem2.setOrderItem(orderItem2);
        fgItem2.setQuantity(3);
        //fgItem2.setRetailPrice(new Money(29.99D));
        fg2.getFulfillmentGroupItems().add(fgItem2);
       
        order.getFulfillmentGroups().add(fg2);
       
        order.setSubTotal(new Money((2 * 19.99D) + (3 * 29.99D)));
       
View Full Code Here

        order.setCustomer(customer);

        order.setEmailAddress("test@test.com");

        FulfillmentGroup fg1 = new FulfillmentGroupImpl();
        fg1.setId(1L);
        Address address1 = new AddressImpl();
        address1.setAddressLine1("123 Test Road");
        address1.setCity("Dallas");

        Country country = new CountryImpl();
        country.setAbbreviation("US");
        country.setName("United States");

        address1.setCountry(country);
        address1.setDefault(true);
        address1.setFirstName("John");
        address1.setLastName("Tester");
        address1.setPostalCode("75244");

        Phone primary = new PhoneImpl();
        primary.setPhoneNumber("972-976-1234");
        address1.setPhonePrimary(primary);

        State state = new StateImpl();
        state.setAbbreviation("TX");
        state.setCountry(country);
        state.setName("Texas");

        address1.setState(state);
        fg1.setAddress(address1);
        fg1.setOrder(order);
        fg1.setPrimary(true);
        fg1.setRetailShippingPrice(new Money(10D));
        fg1.setShippingPrice(new Money(10D));
        fg1.setType(FulfillmentType.PHYSICAL_SHIP);
        fg1.setOrder(order);

        FulfillmentGroupItem fgItem1 = new FulfillmentGroupItemImpl();
        fgItem1.setFulfillmentGroup(fg1);
        fgItem1.setOrderItem(orderItem1);
        fgItem1.setQuantity(2);
        //fgItem1.setRetailPrice(new Money(19.99D));
        fg1.getFulfillmentGroupItems().add(fgItem1);

        order.getFulfillmentGroups().add(fg1);

        FulfillmentGroup fg2 = new FulfillmentGroupImpl();
        fg2.setId(2L);
        Address address2 = new AddressImpl();
        address2.setAddressLine1("124 Test Road");
        address2.setCity("Dallas");

        Country country2 = new CountryImpl();
        country2.setAbbreviation("US");
        country2.setName("United States");

        address2.setCountry(country2);
        address2.setDefault(true);
        address2.setFirstName("John");
        address2.setLastName("Tester");
        address2.setPostalCode("75244");

        Phone primary2 = new PhoneImpl();
        primary2.setPhoneNumber("972-976-1234");
        address2.setPhonePrimary(primary2);

        State state2 = new StateImpl();
        state2.setAbbreviation("TX");
        state2.setCountry(country2);
        state2.setName("Texas");

        address2.setState(state2);
        fg2.setAddress(address2);
        fg2.setOrder(order);
        fg2.setPrimary(true);
        fg2.setRetailShippingPrice(new Money(20D));
        fg2.setShippingPrice(new Money(20D));
        fg2.setType(FulfillmentType.PHYSICAL_SHIP);
        fg2.setOrder(order);

        FulfillmentGroupItem fgItem2 = new FulfillmentGroupItemImpl();
        fgItem2.setFulfillmentGroup(fg2);
        fgItem2.setOrderItem(orderItem2);
        fgItem2.setQuantity(3);
        //fgItem2.setRetailPrice(new Money(29.99D));
        fg2.getFulfillmentGroupItems().add(fgItem2);

        order.getFulfillmentGroups().add(fg2);

        order.setSubTotal(new Money((2 * 19.99D) + (3 * 29.99D)));

 
View Full Code Here

       
        options.add(option1);
        options.add(option2);
       
        FixedPriceFulfillmentPricingProvider provider = new FixedPriceFulfillmentPricingProvider();
        FulfillmentGroup fg = new FulfillmentGroupImpl();
        FulfillmentEstimationResponse response = provider.estimateCostForFulfillmentGroup(fg, options);
       
        for (Entry<? extends FulfillmentOption, Money> entry : response.getFulfillmentOptionPrices().entrySet()) {
            assertEquals(((FixedPriceFulfillmentOption) entry.getKey()).getPrice(), entry.getValue());
        }
View Full Code Here

        address.setPostalCode("75240");
        address.setPrimaryPhone("972-978-9067");
        address.setState(stateService.findStateByAbbreviation("KY"));
        address.setCountry(countryService.findCountryByAbbreviation("US"));

        FulfillmentGroup group = new FulfillmentGroupImpl();
        group.setAddress(address);
        group.setIsShippingPriceTaxable(true);
        List<FulfillmentGroup> groups = new ArrayList<FulfillmentGroup>();
        group.setMethod("standard");
        group.setService(ShippingServiceType.BANDED_SHIPPING.getType());
        group.setShippingPrice(new Money("0"));
        group.setOrder(order);
        groups.add(group);
        group.setTotal(new Money(0));
        order.setFulfillmentGroups(groups);
        Money total = new Money(5D);
        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);

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

        return order;
    }
View Full Code Here

            }

            fulfillmentItems.add(fulfillmentItem);
        }

        FulfillmentGroup group = new FulfillmentGroupImpl();
        group.setOrder(result);
        group.setFulfillmentGroupItems(fulfillmentItems);
        List<FulfillmentGroup> groups = new ArrayList<FulfillmentGroup>();
        groups.add(group);

        result.setFulfillmentGroups(groups);
        return result;
View Full Code Here

        address.setPostalCode("75240");
        address.setPrimaryPhone("972-978-9067");
        address.setState(stateService.findStateByAbbreviation("KY"));
        address.setCountry(countryService.findCountryByAbbreviation("US"));

        FulfillmentGroup group = new FulfillmentGroupImpl();
        group.setAddress(address);
        group.setIsShippingPriceTaxable(true);
        List<FulfillmentGroup> groups = new ArrayList<FulfillmentGroup>();

        FixedPriceFulfillmentOption option = new FixedPriceFulfillmentOptionImpl();
        option.setPrice(new Money("8.50"));       
        option.setFulfillmentType(FulfillmentType.PHYSICAL_SHIP);
        group.setFulfillmentOption(option);

        group.setFulfillmentOption(option);
        group.setOrder(order);
        groups.add(group);
        order.setFulfillmentGroups(groups);
        Money total = new Money(5D);
        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);

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

        return order;
    }
View Full Code Here

    @Test
    public void testOfferAppliesToFulfillmentGroup() {
        OrderImpl order = new OrderImpl();
        order.setSubTotal(new Money(110D));
        FulfillmentGroupImpl group = new FulfillmentGroupImpl();
        group.setPrimary(true);

        OfferImpl offer = new OfferImpl();
        offer.setType(OfferType.FULFILLMENT_GROUP);
        order.getFulfillmentGroups().add(group);
View Full Code Here

TOP

Related Classes of org.broadleafcommerce.core.order.domain.FulfillmentGroupImpl$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.