Package org.broadleafcommerce.core.offer.domain

Examples of org.broadleafcommerce.core.offer.domain.OfferRule


        assertTrue(adjustmentCount == 0);
        //assertTrue(order.getSubTotal().equals(new Money(124.95D)));

        order = dataProvider.createBasicOrder();
        myOrder.set(order);
        OfferRule orderRule = new OfferRuleImpl();
        //orderRule.setMatchRule("order.subTotal.getAmount()>124");
        orderRule.setMatchRule("order.subTotal.getAmount()>100");
        offers.get(0).getOfferMatchRules().put(OfferRuleType.ORDER.getType(), orderRule);

        offerService.applyAndSaveOffersToOrder(offers, order);

        //now that the order restriction has been lessened, even with the item level discounts applied,
View Full Code Here


        boolean totalitarianOffer,
        OfferType offerType,
        BigDecimal value
    ) {
        Offer offer = new OfferImpl();
        OfferRule customerRule = new OfferRuleImpl();
        customerRule.setMatchRule(appliesToCustomerRules);
        offer.getOfferMatchRules().put(OfferRuleType.CUSTOMER.getType(), customerRule);
        OfferRule fgRule = new OfferRuleImpl();
        fgRule.setMatchRule(appliesToFulfillmentGroupRules);
        offer.getOfferMatchRules().put(OfferRuleType.FULFILLMENT_GROUP.getType(), fgRule);
        OfferRule orderRule = new OfferRuleImpl();
        orderRule.setMatchRule(appliesToRules);
        offer.getOfferMatchRules().put(OfferRuleType.ORDER.getType(), orderRule);
        offer.setApplyDiscountToSalePrice(applyToSalePrice);
        offer.setCombinableWithOtherOffers(combinableWithOtherOffers);
        offer.setDeliveryType(deliveryType);
        offer.setAutomaticallyAdded(OfferDeliveryType.AUTOMATIC==deliveryType);
View Full Code Here

        order.setTotalFufillmentCharges(totalFulfillmentCharges);
    }

    protected boolean couldOfferApplyToFulfillmentGroup(Offer offer, PromotableFulfillmentGroup fulfillmentGroup) {
        boolean appliesToItem = false;
        OfferRule rule = offer.getOfferMatchRules().get(OfferRuleType.FULFILLMENT_GROUP.getType());
        if (rule != null && rule.getMatchRule() != null) {
            HashMap<String, Object> vars = new HashMap<String, Object>();
            fulfillmentGroup.updateRuleVariables(vars);
            Boolean expressionOutcome = executeExpression(rule.getMatchRule(), vars);
            if (expressionOutcome != null && expressionOutcome) {
                appliesToItem = true;
            }
        } else {
            appliesToItem = true;
View Full Code Here

    protected boolean couldOfferApplyToRequestDTO(Offer offer, RequestDTO requestDTO) {
        boolean appliesToRequestRule = false;

        String rule = null;

        OfferRule customerRule = offer.getOfferMatchRules().get(OfferRuleType.REQUEST.getType());
        if (customerRule != null) {
            rule = customerRule.getMatchRule();
        }

        if (rule != null) {
            HashMap<String, Object> vars = new HashMap<String, Object>();
            vars.put("request", requestDTO);
View Full Code Here

    protected boolean couldOfferApplyToTimePeriod(Offer offer) {
        boolean appliesToTimePeriod = false;

        String rule = null;

        OfferRule timeRule = offer.getOfferMatchRules().get(OfferRuleType.TIME.getType());
        if (timeRule != null) {
            rule = timeRule.getMatchRule();
        }
       
        if (rule != null) {
            TimeZone timeZone = getOfferTimeZoneProcessor().getTimeZone(offer);
            TimeDTO timeDto = new TimeDTO(SystemTime.asCalendar(timeZone));
View Full Code Here

       
        String rule = null;
        if (!StringUtils.isEmpty(offer.getAppliesToCustomerRules())) {
            rule = offer.getAppliesToCustomerRules();
        } else {
            OfferRule customerRule = offer.getOfferMatchRules().get(OfferRuleType.CUSTOMER.getType());
            if (customerRule != null) {
                rule = customerRule.getMatchRule();
            }
        }

        if (rule != null) {
            HashMap<String, Object> vars = new HashMap<String, Object>();
View Full Code Here

        boolean appliesToItem = false;
        String rule = null;
        if (offer.getAppliesToOrderRules() != null && offer.getAppliesToOrderRules().trim().length() != 0) {
            rule = offer.getAppliesToOrderRules();
        } else {
            OfferRule orderRule = offer.getOfferMatchRules().get(OfferRuleType.ORDER.getType());
            if (orderRule != null) {
                rule = orderRule.getMatchRule();
            }
        }

        if (rule != null) {
View Full Code Here

TOP

Related Classes of org.broadleafcommerce.core.offer.domain.OfferRule

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.