Class OfferValidator

  • All Implemented Interfaces:
    com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator

    public class OfferValidator
    extends Object
    implements com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
    Validations for Offer.
    Author:
    Samarth Dhruva (samarthd)
    • Constructor Detail

      • OfferValidator

        public OfferValidator()
    • Method Detail

      • supports

        public boolean supports​(Class<?> serviceClass,
                                com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Specified by:
        supports in interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
      • validate

        public void validate​(@NonNull
                             Object businessInstance,
                             @NonNull
                             org.springframework.validation.Errors errors,
                             com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Specified by:
        validate in interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
      • validateCheapestTargetGroupingStrategyOnlyOrderItemTargetType

        protected void validateCheapestTargetGroupingStrategyOnlyOrderItemTargetType​(Offer offer,
                                                                                     org.springframework.validation.Errors errors)
      • validateFreeGiftOffer

        protected void validateFreeGiftOffer​(Offer offer,
                                             org.springframework.validation.Errors errors)
      • validateVoucherOffer

        protected void validateVoucherOffer​(Offer offer,
                                            org.springframework.validation.Errors errors)
      • validateNotFixedPrice

        protected void validateNotFixedPrice​(Offer offer,
                                             org.springframework.validation.Errors errors)
      • validateItemCriteria

        protected void validateItemCriteria​(Offer offer,
                                            org.springframework.validation.Errors errors)
      • validateName

        protected void validateName​(Offer offer,
                                    org.springframework.validation.Errors errors)
      • validateActiveStartDate

        protected void validateActiveStartDate​(Offer offer,
                                               org.springframework.validation.Errors errors)
      • validateActiveEndDate

        protected void validateActiveEndDate​(Offer offer,
                                             org.springframework.validation.Errors errors)
      • validateDiscount

        protected boolean validateDiscount​(Offer offer,
                                           org.springframework.validation.Errors errors)
      • isLessThanOrEqualTo

        protected boolean isLessThanOrEqualTo​(BigDecimal actual,
                                              BigDecimal maxValue)
      • validateDiscountTiers

        protected void validateDiscountTiers​(Offer offer,
                                             org.springframework.validation.Errors errors)
      • validateDiscountTier

        protected void validateDiscountTier​(Offer offer,
                                            DiscountTier discountTier,
                                            org.springframework.validation.Errors errors,
                                            String offerDiscountStrategy)
      • validateUserTargets

        protected void validateUserTargets​(Offer offer,
                                           org.springframework.validation.Errors errors)
      • validateCombinabilityType

        protected void validateCombinabilityType​(Offer offer,
                                                 org.springframework.validation.Errors errors)
      • validateMaxUsesPerUserStrategy

        protected void validateMaxUsesPerUserStrategy​(Offer offer,
                                                      org.springframework.validation.Errors errors)
      • validateSubscriptionDiscount

        protected void validateSubscriptionDiscount​(Offer offer,
                                                    org.springframework.validation.Errors errors)
      • isOrderTargetType

        protected boolean isOrderTargetType​(Offer offer)
      • isOrderItemTargetType

        protected boolean isOrderItemTargetType​(Offer offer)
      • isFulfillmentTargetType

        protected boolean isFulfillmentTargetType​(Offer offer)
      • isFulfillmentItemTargetType

        protected boolean isFulfillmentItemTargetType​(Offer offer)