Class DefaultOfferUserService

    • Method Detail

      • isAnyCodeUsable

        public boolean isAnyCodeUsable​(@Nullable
                                       Set<String> codes,
                                       @NonNull
                                       Offer offer,
                                       @Nullable
                                       com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: OfferUserService
        For the provided codes, check if there is no more usage for the provided offer available.
        Specified by:
        isAnyCodeUsable in interface OfferUserService
        Parameters:
        codes - list of codes to check against the offer
        offer - the offer that we are checking usage against
        contextInfo - context information around sandbox and multitenant state
        Returns:
        whether this offer has met it's max code usage for the given order and context info
      • getCodeUsabilityInfo

        @NonNull
        public com.broadleafcommerce.promotion.offer.client.web.context.CodeUsabilityInfo getCodeUsabilityInfo​(@NonNull
                                                                                                               String code,
                                                                                                               @NonNull
                                                                                                               List<? extends Offer> offersForCode,
                                                                                                               @Nullable
                                                                                                               com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Description copied from interface: OfferUserService
        Checks the provided SharedCode.getCode() SharedCode's code} against the provided Offers' SharedCodes to determine whether the code is usable.
        Specified by:
        getCodeUsabilityInfo in interface OfferUserService
        Parameters:
        code - the code for which to check usability
        offersForCode - the offers against which we are checking usability
        context - context information around sandbox and multitenant state
        Returns:
        a CodeUsabilityInfo which contains a boolean to tell if the code can be used and a detailed structure informing on the code usage.
      • addCodeUsages

        protected com.broadleafcommerce.promotion.offer.client.web.context.CodeUsabilityInfo addCodeUsages​(List<? extends Offer> offersForCode,
                                                                                                           com.broadleafcommerce.promotion.offer.client.web.context.CodeUsabilityInfo codeUsabilityInfo,
                                                                                                           com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      • getCodeUses

        protected com.broadleafcommerce.promotion.offer.client.web.context.CodeUsage getCodeUses​(Offer offer,
                                                                                                 SharedCode sharedCode,
                                                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      • determineCodeUsability

        protected String determineCodeUsability​(String code,
                                                boolean canUse,
                                                boolean hasOffers)
      • canUserUseOffer

        public boolean canUserUseOffer​(@NonNull
                                       Offer offer,
                                       @Nullable
                                       com.broadleafcommerce.promotion.offer.client.web.context.CustomerContext customerContext,
                                       @Nullable
                                       com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: OfferUserService
        For the provided customer information, check if there are no more usages for the provided offer available.
        Specified by:
        canUserUseOffer in interface OfferUserService
        Parameters:
        offer - the offer that we are checking usage against
        customerContext - context information for the customer
        contextInfo - context information around sandbox and multitenant state
        Returns:
        whether this offer has met it's max user usage for the given order and context info
      • getUserIdForOtherUserType

        protected String getUserIdForOtherUserType​(com.broadleafcommerce.promotion.offer.client.web.context.CustomerContext customerContext,
                                                   String maxUsesPerUserStrategy)
      • getCountMaxUserUses

        protected Long getCountMaxUserUses​(Offer offer,
                                           com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo,
                                           UserTarget userTarget)