Interface OfferUserService

  • All Known Implementing Classes:
    DefaultOfferUserService

    public interface OfferUserService
    Helper methods around users for offers. Contains methods to determine if an offer has met max usage for a given order and context.
    Author:
    Chad Harchar (charchar)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Set<UserTarget> buildUserTargetsForCustomerContext​(com.broadleafcommerce.promotion.offer.client.web.context.CustomerContext customerContext)
      Build and return a list of UserTargets based on the information provided in the CustomerContext.
      boolean canUserUseOffer​(Offer offer, com.broadleafcommerce.promotion.offer.client.web.context.CustomerContext customerContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      For the provided customer information, check if there are no more usages for the provided offer available.
      com.broadleafcommerce.promotion.offer.client.web.context.CodeUsabilityInfo getCodeUsabilityInfo​(String code, List<? extends Offer> offersForCode, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Checks the provided SharedCode.getCode() SharedCode's code} against the provided Offers' SharedCodes to determine whether the code is usable.
      boolean isAnyCodeUsable​(Set<String> codes, Offer offer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      For the provided codes, check if there is no more usage for the provided offer available.
    • Method Detail

      • buildUserTargetsForCustomerContext

        @NonNull
        Set<UserTarget> buildUserTargetsForCustomerContext​(@Nullable
                                                           com.broadleafcommerce.promotion.offer.client.web.context.CustomerContext customerContext)
        Build and return a list of UserTargets based on the information provided in the CustomerContext.
        Parameters:
        customerContext - The CustomerContext with which to build UserTargets
        Returns:
        a set of UserTargets
      • isAnyCodeUsable

        boolean isAnyCodeUsable​(@Nullable
                                Set<String> codes,
                                @NonNull
                                Offer offer,
                                @Nullable
                                com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        For the provided codes, check if there is no more usage for the provided offer available.
        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
        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 contextInfo)
        Checks the provided SharedCode.getCode() SharedCode's code} against the provided Offers' SharedCodes to determine whether the code is usable.
        Parameters:
        code - the code for which to check usability
        offersForCode - the offers against which we are checking usability
        contextInfo - 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.
      • canUserUseOffer

        boolean canUserUseOffer​(@NonNull
                                Offer offer,
                                @Nullable
                                com.broadleafcommerce.promotion.offer.client.web.context.CustomerContext customerContext,
                                @Nullable
                                com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        For the provided customer information, check if there are no more usages for the provided offer available.
        Parameters:
        customerContext - context information for the customer
        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 user usage for the given order and context info