Package org.broadleafcommerce.profile.core.domain

Examples of org.broadleafcommerce.profile.core.domain.CustomerAddress


    public void testAddFulfillmentGroupToOrder(ShippingRate shippingRate, ShippingRate sr2) throws PricingException, ItemNotFoundException{
        shippingRate = shippingRateService.save(shippingRate);
        sr2 = shippingRateService.save(sr2);
        Customer customer = createCustomerWithAddresses();
        Order order = initializeExistingCart(customer);
        CustomerAddress customerAddress = customerAddressService.readActiveCustomerAddressesByCustomerId(customer.getId()).get(0);
       
        FulfillmentGroupRequest fgRequest = new FulfillmentGroupRequest();
       
        List<FulfillmentGroupItemRequest> fgiRequests = new ArrayList<FulfillmentGroupItemRequest>();

        for (OrderItem orderItem : order.getOrderItems()) {
            FulfillmentGroupItemRequest fgiRequest = new FulfillmentGroupItemRequest();
            fgiRequest.setOrderItem(orderItem);
            fgiRequest.setQuantity(1);
            fgiRequests.add(fgiRequest);
        }
       
        fgRequest.setAddress(customerAddress.getAddress());
        fgRequest.setFulfillmentGroupItemRequests(fgiRequests);
        fgRequest.setOrder(cartService.findCartForCustomer(customer));
        fgRequest.setMethod("standard");
        fgRequest.setService(ShippingServiceType.BANDED_SHIPPING.getType());
        cartService.addFulfillmentGroupToOrder(fgRequest);
       
        Order resultOrder = cartService.findOrderById(order.getId());
        assert resultOrder.getFulfillmentGroups().size() == 1;
        assert resultOrder.getFulfillmentGroups().get(0).getFulfillmentGroupItems().size() == 2;
       
        cartService.removeAllFulfillmentGroupsFromOrder(order, false);
        resultOrder = cartService.findOrderById(order.getId());
        assert resultOrder.getFulfillmentGroups().size() == 0;
       
        FulfillmentGroup defaultFg = cartService.createDefaultFulfillmentGroup(order, customerAddress.getAddress());
        defaultFg.setMethod("standard");
        defaultFg.setService(ShippingServiceType.BANDED_SHIPPING.getType());
        assert defaultFg.isPrimary();
        cartService.addFulfillmentGroupToOrder(order, defaultFg);
        resultOrder = cartService.findOrderById(order.getId());
View Full Code Here

TOP

Related Classes of org.broadleafcommerce.profile.core.domain.CustomerAddress

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.