Examples of OfferMaxUseExceededException


Examples of org.broadleafcommerce.core.offer.service.exception.OfferMaxUseExceededException

       
        for (Offer offer : appliedOffers) {
            if (offer.isLimitedUsePerCustomer()) {
                Long currentUses = offerAuditService.countUsesByCustomer(order.getCustomer().getId(), offer.getId());
                if (currentUses >= offer.getMaxUsesPerCustomer()) {
                    throw new OfferMaxUseExceededException("The customer has used this offer more than the maximum allowed number of times.");
                }
            }
        }
       
        //TODO: allow lenient checking on offer code usage
        for (OfferCode code : order.getAddedOfferCodes()) {
            if (code.isLimitedUse()) {
                Long currentCodeUses = offerAuditService.countOfferCodeUses(code.getId());
                if (currentCodeUses >= code.getMaxUses()) {
                    throw new OfferMaxUseExceededException("Offer code " + code.getOfferCode() + " with id " + code.getId()
                            + " has been than the maximum allowed number of times.");
                }
            }
        }
       
View Full Code Here

Examples of org.broadleafcommerce.core.offer.service.exception.OfferMaxUseExceededException

        if (offerCodes != null && !offerCodes.isEmpty()) {
            for (OfferCode offerCode : offerCodes) {
                //TODO: give some sort of notification that adding the offer code to the order was unsuccessful
                if (!order.getAddedOfferCodes().contains(offerCode) && !addedOffers.contains(offerCode.getOffer())) {
                    if (!offerService.verifyMaxCustomerUsageThreshold(order.getCustomer(), offerCode)) {
                        throw new OfferMaxUseExceededException("The customer has used this offer code more than the maximum allowed number of times.");
                    }
                    order.getAddedOfferCodes().add(offerCode);
                }
            }
            order = save(order, priceOrder);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.