Search in sources :

Example 6 with PromotableItemFactoryImpl

use of org.broadleafcommerce.core.offer.service.discount.domain.PromotableItemFactoryImpl in project BroadleafCommerce by BroadleafCommerce.

the class FulfillmentGroupOfferProcessorTest method setUp.

@Override
protected void setUp() throws Exception {
    offerService = new OfferServiceImpl();
    CustomerOfferDao customerOfferDaoMock = EasyMock.createMock(CustomerOfferDao.class);
    OfferCodeDao offerCodeDaoMock = EasyMock.createMock(OfferCodeDao.class);
    orderServiceMock = EasyMock.createMock(OrderService.class);
    orderItemDaoMock = EasyMock.createMock(OrderItemDao.class);
    orderItemServiceMock = EasyMock.createMock(OrderItemService.class);
    fgItemDaoMock = EasyMock.createMock(FulfillmentGroupItemDao.class);
    offerDaoMock = EasyMock.createMock(OfferDao.class);
    fgServiceMock = EasyMock.createMock(FulfillmentGroupService.class);
    multishipOptionServiceMock = EasyMock.createMock(OrderMultishipOptionService.class);
    offerServiceUtilitiesMock = EasyMock.createMock(OfferServiceUtilities.class);
    offerTimeZoneProcessorMock = EasyMock.createMock(OfferTimeZoneProcessor.class);
    fgProcessor = new TestableFulfillmentGroupOfferProcessor();
    fgProcessor.setOfferDao(offerDaoMock);
    fgProcessor.setOrderItemDao(orderItemDaoMock);
    fgProcessor.setPromotableItemFactory(new PromotableItemFactoryImpl());
    fgProcessor.setOfferServiceUtilities(offerServiceUtilitiesMock);
    OfferServiceUtilitiesImpl offerServiceUtilities = new OfferServiceUtilitiesImpl();
    offerServiceUtilities.setOfferDao(offerDaoMock);
    offerServiceUtilities.setPromotableItemFactory(new PromotableItemFactoryImpl());
    OrderOfferProcessorImpl orderProcessor = new OrderOfferProcessorImpl();
    orderProcessor.setOfferDao(offerDaoMock);
    orderProcessor.setPromotableItemFactory(new PromotableItemFactoryImpl());
    orderProcessor.setOfferServiceUtilities(offerServiceUtilitiesMock);
    orderProcessor.setOfferTimeZoneProcessor(offerTimeZoneProcessorMock);
    orderProcessor.setOrderItemDao(orderItemDaoMock);
    orderProcessor.setOfferServiceUtilities(offerServiceUtilities);
    ItemOfferProcessorImpl itemProcessor = new ItemOfferProcessorImpl();
    itemProcessor.setOfferDao(offerDaoMock);
    itemProcessor.setPromotableItemFactory(new PromotableItemFactoryImpl());
    itemProcessor.setOrderItemDao(orderItemDaoMock);
    itemProcessor.setOfferServiceUtilities(offerServiceUtilities);
    offerService.setCustomerOfferDao(customerOfferDaoMock);
    offerService.setOfferCodeDao(offerCodeDaoMock);
    offerService.setOfferDao(offerDaoMock);
    offerService.setOrderOfferProcessor(orderProcessor);
    offerService.setItemOfferProcessor(itemProcessor);
    offerService.setFulfillmentGroupOfferProcessor(fgProcessor);
    offerService.setPromotableItemFactory(new PromotableItemFactoryImpl());
    offerService.setOrderService(orderServiceMock);
}
Also used : FulfillmentGroupItemDao(org.broadleafcommerce.core.order.dao.FulfillmentGroupItemDao) OrderItemDao(org.broadleafcommerce.core.order.dao.OrderItemDao) CustomerOfferDao(org.broadleafcommerce.core.offer.dao.CustomerOfferDao) OrderMultishipOptionService(org.broadleafcommerce.core.order.service.OrderMultishipOptionService) FulfillmentGroupService(org.broadleafcommerce.core.order.service.FulfillmentGroupService) PromotableItemFactoryImpl(org.broadleafcommerce.core.offer.service.discount.domain.PromotableItemFactoryImpl) OfferServiceImpl(org.broadleafcommerce.core.offer.service.OfferServiceImpl) OrderItemService(org.broadleafcommerce.core.order.service.OrderItemService) OfferServiceUtilities(org.broadleafcommerce.core.offer.service.OfferServiceUtilities) OfferCodeDao(org.broadleafcommerce.core.offer.dao.OfferCodeDao) OrderService(org.broadleafcommerce.core.order.service.OrderService) OfferDao(org.broadleafcommerce.core.offer.dao.OfferDao) CustomerOfferDao(org.broadleafcommerce.core.offer.dao.CustomerOfferDao) OfferServiceUtilitiesImpl(org.broadleafcommerce.core.offer.service.OfferServiceUtilitiesImpl)

Example 7 with PromotableItemFactoryImpl

use of org.broadleafcommerce.core.offer.service.discount.domain.PromotableItemFactoryImpl in project BroadleafCommerce by BroadleafCommerce.

the class OrderItemTest method setUp.

@Override
protected void setUp() throws Exception {
    PromotableOrder promotableOrder = new PromotableOrderImpl(new OrderImpl(), new PromotableItemFactoryImpl(), false);
    DiscreteOrderItemImpl discreteOrderItem1 = new DiscreteOrderItemImpl();
    discreteOrderItem1.setName("test1");
    discreteOrderItem1.setOrderItemType(OrderItemType.DISCRETE);
    discreteOrderItem1.setQuantity(2);
    discreteOrderItem1.setRetailPrice(new Money(19.99D));
    OrderItemPriceDetail pdetail = new OrderItemPriceDetailImpl();
    pdetail.setOrderItem(discreteOrderItem1);
    pdetail.setQuantity(2);
    PromotableOrderItem orderItem1 = new PromotableOrderItemImpl(discreteOrderItem1, null, new PromotableItemFactoryImpl(), false);
    priceDetail1 = new PromotableOrderItemPriceDetailImpl(orderItem1, 2);
    OfferDataItemProvider dataProvider = new OfferDataItemProvider();
    offer = dataProvider.createItemBasedOfferWithItemCriteria("order.subTotal.getAmount()>20", OfferDiscountType.PERCENT_OFF, "([MVEL.eval(\"toUpperCase()\",\"test1\"), MVEL.eval(\"toUpperCase()\",\"test2\")] contains MVEL.eval(\"toUpperCase()\", discreteOrderItem.category.name))", "([MVEL.eval(\"toUpperCase()\",\"test1\"), MVEL.eval(\"toUpperCase()\",\"test2\")] contains MVEL.eval(\"toUpperCase()\", discreteOrderItem.category.name))").get(0);
    candidateOffer = new PromotableCandidateItemOfferImpl(promotableOrder, offer);
}
Also used : PromotableOrderItemImpl(org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrderItemImpl) PromotableOrderImpl(org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrderImpl) PromotableOrderItemPriceDetailImpl(org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrderItemPriceDetailImpl) PromotableCandidateItemOfferImpl(org.broadleafcommerce.core.offer.service.discount.domain.PromotableCandidateItemOfferImpl) PromotableOrder(org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrder) PromotableOrderItem(org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrderItem) Money(org.broadleafcommerce.common.money.Money) PromotableItemFactoryImpl(org.broadleafcommerce.core.offer.service.discount.domain.PromotableItemFactoryImpl) PromotableOrderImpl(org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrderImpl) OfferDataItemProvider(org.broadleafcommerce.core.offer.service.OfferDataItemProvider) PromotableOrderItemPriceDetail(org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrderItemPriceDetail) PromotableOrderItemPriceDetailImpl(org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrderItemPriceDetailImpl)

Aggregations

PromotableItemFactoryImpl (org.broadleafcommerce.core.offer.service.discount.domain.PromotableItemFactoryImpl)7 OfferDao (org.broadleafcommerce.core.offer.dao.OfferDao)4 CustomerOfferDao (org.broadleafcommerce.core.offer.dao.CustomerOfferDao)3 OfferCodeDao (org.broadleafcommerce.core.offer.dao.OfferCodeDao)3 PromotableOrder (org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrder)3 PromotableOrderImpl (org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrderImpl)3 FulfillmentGroupItemDao (org.broadleafcommerce.core.order.dao.FulfillmentGroupItemDao)3 OrderItemDao (org.broadleafcommerce.core.order.dao.OrderItemDao)3 Order (org.broadleafcommerce.core.order.domain.Order)3 FulfillmentGroupService (org.broadleafcommerce.core.order.service.FulfillmentGroupService)3 OrderItemService (org.broadleafcommerce.core.order.service.OrderItemService)3 OrderMultishipOptionService (org.broadleafcommerce.core.order.service.OrderMultishipOptionService)3 OrderService (org.broadleafcommerce.core.order.service.OrderService)3 ArrayList (java.util.ArrayList)2 Money (org.broadleafcommerce.common.money.Money)2 OfferDataItemProvider (org.broadleafcommerce.core.offer.service.OfferDataItemProvider)2 OfferServiceImpl (org.broadleafcommerce.core.offer.service.OfferServiceImpl)2 OfferServiceUtilitiesImpl (org.broadleafcommerce.core.offer.service.OfferServiceUtilitiesImpl)2 PromotableCandidateItemOfferImpl (org.broadleafcommerce.core.offer.service.discount.domain.PromotableCandidateItemOfferImpl)2 PromotableOrderItem (org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrderItem)2