Interface OfferUserService
-
- All Known Implementing Classes:
DefaultOfferUserService
public interface OfferUserServiceHelper 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 ofUserTargetsbased on the information provided in theCustomerContext.booleancanUserUseOffer(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.CodeUsabilityInfogetCodeUsabilityInfo(String code, List<? extends Offer> offersForCode, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Checks the providedSharedCode.getCode()SharedCode's code} against the providedOffers' SharedCodesto determine whether the code is usable.booleanisAnyCodeUsable(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 ofUserTargetsbased on the information provided in theCustomerContext.- Parameters:
customerContext- TheCustomerContextwith which to buildUserTargets- 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 offeroffer- the offer that we are checking usage againstcontextInfo- 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 providedSharedCode.getCode()SharedCode's code} against the providedOffers' SharedCodesto determine whether the code is usable.- Parameters:
code- the code for which to check usabilityoffersForCode- the offers against which we are checking usabilitycontextInfo- context information around sandbox and multitenant state- Returns:
- a
CodeUsabilityInfowhich 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 customeroffer- the offer that we are checking usage againstcontextInfo- 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
-
-