Class DefaultCandidateOfferUtility
java.lang.Object
com.broadleafcommerce.promotion.offer.service.engine.candidate.DefaultCandidateOfferUtility
- All Implemented Interfaces:
CandidateOfferUtility
- Author:
- Chad Harchar (charchar)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.broadleafcommerce.common.extension.TypeFactory -
Constructor Summary
ConstructorsConstructorDescriptionDefaultCandidateOfferUtility(com.broadleafcommerce.common.extension.TypeFactory offerFactory) -
Method Summary
Modifier and TypeMethodDescriptioncreateCandidateFulfillmentGroupOffer(EnhancedOrder order, Offer offer) Creates aCandidateFulfillmentGroupOfferfor the given order and offer.createCandidateFulfillmentItemOffer(EnhancedOrder order, Offer offer) Creates aCandidateItemOfferfor the given order and offer.createCandidateOrderItemOffer(EnhancedOrder order, Offer offer) Creates aCandidateItemOfferfor the given order and offer.createCandidateOrderOffer(EnhancedOrder order, Offer offer) Creates aCandidateOrderOfferfor the given order and offer.protected OfferServicePropertiesjavax.money.MonetaryAmountparseDynamicOfferAmount(String dynamicOfferKey, EnhancedOrder order) Looks for a map of dynamicOfferKey to amount.protected voidpopulateCandidateOfferCurrency(@NonNull BaseCandidateOffer candidateOffer, @NonNull EnhancedOrder order, @NonNull Offer offer) protected voidpopulateOfferRoundingProperties(BaseCandidateOffer candidateOffer) Populates offer rounding properties for order and item typed offers.voidsetOfferServiceProperties(OfferServiceProperties offerServiceProperties)
-
Field Details
-
offerFactory
protected final com.broadleafcommerce.common.extension.TypeFactory offerFactory
-
-
Constructor Details
-
DefaultCandidateOfferUtility
public DefaultCandidateOfferUtility(com.broadleafcommerce.common.extension.TypeFactory offerFactory)
-
-
Method Details
-
createCandidateOrderOffer
Description copied from interface:CandidateOfferUtilityCreates aCandidateOrderOfferfor the given order and offer.- Specified by:
createCandidateOrderOfferin interfaceCandidateOfferUtility- Parameters:
order- the order to be used when building theCandidateOrderOfferoffer- the offer to be used when building theCandidateOrderOffer- Returns:
- the created
CandidateOrderOfferbased on the provided order and offer
-
createCandidateOrderItemOffer
Description copied from interface:CandidateOfferUtilityCreates aCandidateItemOfferfor the given order and offer.- Specified by:
createCandidateOrderItemOfferin interfaceCandidateOfferUtility- Parameters:
order- the order to be used when building theCandidateItemOfferoffer- the offer to be used when building theCandidateItemOffer- Returns:
- the created
CandidateItemOfferbased on the provided order and offer
-
createCandidateFulfillmentGroupOffer
public CandidateFulfillmentGroupOffer createCandidateFulfillmentGroupOffer(EnhancedOrder order, Offer offer) Description copied from interface:CandidateOfferUtilityCreates aCandidateFulfillmentGroupOfferfor the given order and offer.- Specified by:
createCandidateFulfillmentGroupOfferin interfaceCandidateOfferUtility- Parameters:
order- the order to be used when building theCandidateFulfillmentGroupOfferoffer- the offer to be used when building theCandidateFulfillmentGroupOffer- Returns:
- the created
CandidateFulfillmentGroupOfferbased on the provided order and offer
-
createCandidateFulfillmentItemOffer
Description copied from interface:CandidateOfferUtilityCreates aCandidateItemOfferfor the given order and offer.- Specified by:
createCandidateFulfillmentItemOfferin interfaceCandidateOfferUtility- Parameters:
order- the order to be used when building theCandidateItemOfferoffer- the offer to be used when building theCandidateItemOffer- Returns:
- the created
CandidateItemOfferbased on the provided order and offer
-
parseDynamicOfferAmount
public javax.money.MonetaryAmount parseDynamicOfferAmount(String dynamicOfferKey, EnhancedOrder order) Description copied from interface:CandidateOfferUtilityLooks for a map of dynamicOfferKey to amount.- Specified by:
parseDynamicOfferAmountin interfaceCandidateOfferUtility- Parameters:
dynamicOfferKey- the key for which to find dynamic offer amounts.order- the order to search for dynamic offer amounts.- Returns:
- the parsed
MonetaryAmount
-
populateCandidateOfferCurrency
protected void populateCandidateOfferCurrency(@NonNull @NonNull BaseCandidateOffer candidateOffer, @NonNull @NonNull EnhancedOrder order, @NonNull @NonNull Offer offer) Populates theBaseCandidateOffer.getCurrency()based on the givenEnhancedOrderandOffer. If present, will also populateBaseCandidateOffer.getConvertedCurrencyDetail()If
Offer.getCurrency()is specified, then that currency is used. OtherwiseEnhancedOrder.getCurrency()is used, as the offer should be a candidate regardless of currency.- Parameters:
candidateOffer- theBaseCandidateOfferto populate the currency fororder- theEnhancedOrderthat has a currencyoffer- theOfferthat may have a currency specification- See Also:
-
populateOfferRoundingProperties
Populates offer rounding properties for order and item typed offers.- Parameters:
candidateOffer- theBaseCandidateOfferto populate the offer rounding properties for
-
getOfferServiceProperties
-
setOfferServiceProperties
-