Class DefaultPriceInfoService
- All Implemented Interfaces:
 PriceInfoService
- Author:
 - Chad Harchar (charchar), Nathan Moore (nathanmoore)
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Comparator<com.broadleafcommerce.pricing.client.domain.PriceDetailComparable> - 
Constructor Summary
ConstructorsConstructorDescriptionDefaultPriceInfoService(PriceDataService<PriceData> priceDataService, com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService ruleEvaluationService, PriceableFieldProperties priceableFields, PriceListService<PriceList> priceListService, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator validator, com.broadleafcommerce.common.extension.TypeFactory typeFactory)  - 
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddBaseCostPriceDetail(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.protected voidaddBasePriceDetail(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.protected voidaddPriceDetail(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, PriceList priceList, PriceListPriceDetail listPriceDetail, Map<String, List<PriceDataTier>> priceTiers) protected voidaddPriceDetail(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, PriceList priceList, javax.money.MonetaryAmount price, Map<String, List<PriceDataTier>> priceTiers) Deprecated, for removal: This API element is subject to removal in a future version.protected voidaddPriceInfoForTarget(List<com.broadleafcommerce.pricing.client.domain.PriceInfo> priceInfos, com.broadleafcommerce.pricing.client.domain.PriceableTarget priceableTarget, com.broadleafcommerce.pricing.client.domain.PriceDetail bestPriceDetail, PriceableTargetPriceState priceState, boolean skipDetails) Uses the best price detail found for the target and creates aPriceInfofor it.protected voidaddPriceTypeDetail(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, String type, com.broadleafcommerce.pricing.client.domain.PriceDetail detail) protected booleanareCharacteristicsEquivalent(@NonNull com.broadleafcommerce.pricing.client.domain.BasePriceableTarget a, @NonNull com.broadleafcommerce.pricing.client.domain.BasePriceableTarget b) protected PriceSummarybuildSummaryFromPriceData(@NonNull com.broadleafcommerce.pricing.client.domain.PriceableTarget target, @NonNull PriceData data) Builds aPriceSummaryofdata.convertPriceListsToPriceListIds(Collection<PriceList> priceLists) protected Optional<PriceDataTier>determineMaxTier(com.broadleafcommerce.pricing.client.domain.PriceableTarget priceableTarget, List<PriceDataTier> priceDataTiers) protected StringformatPrice(javax.money.MonetaryAmount price) Helper method to format aMonetaryAmountas a price stringprotected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail>getBackupPrice(com.broadleafcommerce.pricing.client.domain.PriceDetail currentBestPrice, PriceableTargetPriceState priceState) Gets the backup price for the current limited best price.protected javax.money.MonetaryAmountgetBaseCost(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) By default, gets thePriceableFieldProperties.getBaseCost().protected javax.money.MonetaryAmountgetBasePrice(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) By default, gets thePriceableFieldProperties.getBasePrice().protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail>getBestPriceForType(Map<PriceList, javax.money.MonetaryAmount> pricesMap) Deprecated.in favor ofgetBestPriceFromPriceLists(Map)in order to hold & pass on more details than justMonetaryAmount.protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail>getBestPriceFromPriceLists(Map<PriceList, PriceListPriceDetail> priceListPriceDetailMap) Picks the best (lowest) price for the price list type out of all the matches found.protected com.broadleafcommerce.pricing.client.domain.PriceDetailgetBestPriceOverall(Map<String, com.broadleafcommerce.pricing.client.domain.PriceDetail> prices) Deprecated.in favor ofgetBestPriceOverall(Map, Currency)protected com.broadleafcommerce.pricing.client.domain.PriceDetailgetBestPriceOverall(Map<String, com.broadleafcommerce.pricing.client.domain.PriceDetail> prices, Currency defaultCurrency) Retrieves all of thePriceableFieldTypesin ascending order byPriceableFieldType.order().protected org.springframework.validation.ErrorsgetErrors(com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) getFallbackPriceData(com.broadleafcommerce.pricing.client.domain.PriceableTargetRef targetRef, String priceListId, PriceableTargetPriceState priceState) protected PriceableFieldPropertiesprotected PriceDataService<PriceData>protected Comparator<com.broadleafcommerce.pricing.client.domain.PriceDetailComparable>RetrievespriceDetailComparatorif not null; else,DEFAULT_PRICE_DETAIL_COMPARATOR.protected Optional<PriceListPriceDetail>getPriceDetailFromListForTarget(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Checks forPriceDatafor thePriceableTargetIf none, checks forPriceModifiers If none, works up thePriceListhierarchy look for #1 or #2. If still none, checks for custom logic to get the price from somewhere else (getPriceFromElsewhere(PriceableTarget, PriceList, ContextInfo)) If still none, returns thePriceableFieldProperties.getBasePrice()(also seePriceableFieldType.BASE_PRICEprotected Optional<javax.money.MonetaryAmount>getPriceFromElsewhere(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Extension point for getting aPriceSummaryfrom somewhere other than aPriceDataorPriceList.getPriceModifier().protected Optional<javax.money.MonetaryAmount>getPriceFromListForTarget(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.protected Optional<javax.money.MonetaryAmount>getPriceFromModifier(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected Optional<javax.money.MonetaryAmount>getPriceFromPriceData(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, String priceListId, PriceableTargetPriceState priceState) Deprecated, for removal: This API element is subject to removal in a future version.protected StringgetPriceKey(String type) protected Map<org.apache.commons.lang3.tuple.Pair<String,com.broadleafcommerce.pricing.client.domain.PriceableTargetRef>, PriceData> getPriceListAndTargetPriceDataMap(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget> priceableTargets, List<PriceList> priceLists) protected PriceListService<PriceList>protected Optional<PriceModifier>getPriceModifierForTarget(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected Optional<PriceSummary>getPriceSummaryFromElsewhere(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Extension point for getting aPriceSummaryfrom somewhere other than aPriceDataorPriceList.getPriceModifier().protected Optional<PriceSummary>getPriceSummaryFromPriceData(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, String priceListId, PriceableTargetPriceState priceState) Gets thePriceSummaryfrom a matchingPriceData.protected com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationServicegetTargetsBaseDetails(@NonNull com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds a map ofPriceDetailsfor each field ofPriceableTarget.getPriceableFields()where the key is the type.protected com.broadleafcommerce.common.extension.TypeFactoryprotected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorprotected booleanisEqualPrice(com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail1, com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail2) Checks if the givenPriceDetailshave the same price.protected booleanisSalePrice(com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail) Checks if the givenPriceDetailis of typePriceableFieldType.SALE_PRICE.protected javax.money.MonetaryAmountmodifyPrice(javax.money.MonetaryAmount baseAmount, PriceModifier priceModifier) Performs thePriceModifier.getModificationType()on the base price.protected voidmodifyPriceContext(com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext) Extend this if you want to modify the provided price context, for example removing certain attributes for security reasons.booleannoCurrency(AtomicReference<javax.money.MonetaryAmount> refAmount) Deprecated, for removal: This API element is subject to removal in a future version.Unusedprotected javax.money.MonetaryAmountperformOtherOperation(String modificationType, BigDecimal modificationAmount, javax.money.MonetaryAmount baseAmount) Extension point for performing custom PriceModifier operationsprotected com.broadleafcommerce.pricing.client.domain.PriceDataTierRefpopulatePriceDataTierRef(PriceDataTier priceDataTier) protected voidpopulatePriceDetailFromSummary(@NonNull PriceListPriceDetail priceDetail, @NonNull PriceSummary summary) Populates fields onto aPriceListPriceDetailfrom aPriceSummary.prepareEligiblePriceLists(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) Reads all priceLists that are in scope for the priceInfo request and splits them inprotected booleanpriceDataMatchesTarget(@NonNull com.broadleafcommerce.pricing.client.domain.PriceableTarget target, @NonNull PriceData priceData, @NonNull PriceableTargetPriceState priceState) Compares the terms and characteristics of thepriceDatato those requested on thetargetto ensure it matches.protected voidputBestPriceForType(String type, String priceKey, PriceableTargetPriceState priceState) Records the highest-priority best (lowest) price for the price list type out of all the matches found.protected voidputPricesForType(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Map<String, List<PriceList>> listsByType, String type, PriceableTargetPriceState priceState) org.springframework.data.domain.Page<com.broadleafcommerce.pricing.client.domain.PriceInfo>retrievePriceInfosByPriceContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) First retrieves thePriceListRefsfor thePriceContextthen retrieves thePriceInfoassociated thereto.org.springframework.data.domain.Page<com.broadleafcommerce.pricing.client.domain.PriceInfo>retrievePriceInfosByPriceLists(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) RetrievesPriceDatafor the providedPriceInfoContext.getPriceLists()andPriceInfoContext.getPriceableTargets(), then translates them into a list ofPriceInfo.protected org.springframework.data.domain.Page<com.broadleafcommerce.pricing.client.domain.PriceInfo>retrievePriceInfosByPriceLists(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, List<PriceList> priceLists) voidsetPriceDetailComparator(PriceDetailComparator priceDetailComparator) splitPriceListsByType(List<PriceList> priceLists) protected booleantargetsAreEquivalent(@NonNull com.broadleafcommerce.pricing.client.domain.BasePriceableTarget a, @NonNull com.broadleafcommerce.pricing.client.domain.BasePriceableTarget b) Method allowing comparisons betweenBasePriceableTargetsusing only core fields—ignores vendor ref.protected voidupdateContextInfoCurrency(List<PriceList> priceLists, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  
- 
Field Details
- 
DEFAULT_PRICE_DETAIL_COMPARATOR
protected static final Comparator<com.broadleafcommerce.pricing.client.domain.PriceDetailComparable> DEFAULT_PRICE_DETAIL_COMPARATOR - 
DEFAULT_PRICE_LIST_TYPES
 
 - 
 - 
Constructor Details
- 
DefaultPriceInfoService
public DefaultPriceInfoService(PriceDataService<PriceData> priceDataService, com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService ruleEvaluationService, PriceableFieldProperties priceableFields, PriceListService<PriceList> priceListService, com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator validator, com.broadleafcommerce.common.extension.TypeFactory typeFactory)  
 - 
 - 
Method Details
- 
getPriceDetailComparator
protected Comparator<com.broadleafcommerce.pricing.client.domain.PriceDetailComparable> getPriceDetailComparator()RetrievespriceDetailComparatorif not null; else,DEFAULT_PRICE_DETAIL_COMPARATOR.- Returns:
 priceDetailComparatorif not null; else,DEFAULT_PRICE_DETAIL_COMPARATOR.
 - 
retrievePriceInfosByPriceContext
@Transactional("pricingTransactionManager") public org.springframework.data.domain.Page<com.broadleafcommerce.pricing.client.domain.PriceInfo> retrievePriceInfosByPriceContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) Description copied from interface:PriceInfoServiceFirst retrieves the
PriceListRefsfor thePriceContextthen retrieves thePriceInfoassociated thereto.Calls
PriceInfoService.retrievePriceInfosByPriceLists(ContextInfo, PriceInfoContext)- Specified by:
 retrievePriceInfosByPriceContextin interfacePriceInfoService
 - 
updateContextInfoCurrency
 - 
retrievePriceInfosByPriceLists
public org.springframework.data.domain.Page<com.broadleafcommerce.pricing.client.domain.PriceInfo> retrievePriceInfosByPriceLists(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) Description copied from interface:PriceInfoServiceRetrievesPriceDatafor the providedPriceInfoContext.getPriceLists()andPriceInfoContext.getPriceableTargets(), then translates them into a list ofPriceInfo.- Specified by:
 retrievePriceInfosByPriceListsin interfacePriceInfoService
 - 
retrievePriceInfosByPriceLists
protected org.springframework.data.domain.Page<com.broadleafcommerce.pricing.client.domain.PriceInfo> retrievePriceInfosByPriceLists(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, List<PriceList> priceLists)  - 
modifyPriceContext
protected void modifyPriceContext(com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext) Extend this if you want to modify the provided price context, for example removing certain attributes for security reasons. Left blank by default. - 
prepareEligiblePriceLists
protected List<PriceList> prepareEligiblePriceLists(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) Reads all priceLists that are in scope for the priceInfo request and splits them in- Parameters:
 contextInfo-priceInfoContext-- Returns:
 
 - 
splitPriceListsByType
 - 
getPriceListTypes
 - 
getPriceListAndTargetPriceDataMap
protected Map<org.apache.commons.lang3.tuple.Pair<String,com.broadleafcommerce.pricing.client.domain.PriceableTargetRef>, getPriceListAndTargetPriceDataMapPriceData> (com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget> priceableTargets, List<PriceList> priceLists)  - 
getPriceKey
 - 
putPricesForType
 - 
getPriceFromListForTarget
@NonNull @Deprecated(forRemoval=true, since="1.7.14, 2.0.1") protected Optional<javax.money.MonetaryAmount> getPriceFromListForTarget(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version. - 
getPriceDetailFromListForTarget
@NonNull protected Optional<PriceListPriceDetail> getPriceDetailFromListForTarget(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Checks for 
PriceDatafor thePriceableTarget - If none, checks for 
PriceModifiers - If none, works up the 
PriceListhierarchy look for #1 or #2. - If still none, checks for custom logic to get the price from somewhere else
     (
getPriceFromElsewhere(PriceableTarget, PriceList, ContextInfo)) - If still none, returns the 
PriceableFieldProperties.getBasePrice()(also seePriceableFieldType.BASE_PRICE 
 - Checks for 
 - 
populatePriceDetailFromSummary
protected void populatePriceDetailFromSummary(@NonNull @NonNull PriceListPriceDetail priceDetail, @NonNull @NonNull PriceSummary summary) Populates fields onto aPriceListPriceDetailfrom aPriceSummary.- Parameters:
 priceDetail- Price detail to populatesummary- Source of price details- Since:
 - Pricing Service 2.1.0, Release Train 2.2.0
 
 - 
convertPriceListsToPriceListIds
 - 
getPriceFromPriceData
@Deprecated(since="Pricing Service 2.1.0", forRemoval=true) protected Optional<javax.money.MonetaryAmount> getPriceFromPriceData(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, String priceListId, PriceableTargetPriceState priceState) Deprecated, for removal: This API element is subject to removal in a future version.UsegetPriceSummaryFromPriceData(PriceableTarget, String, PriceableTargetPriceState). This will return new fields for recurring and usage prices rather than a singel price.Gets the price from a matching price data.For a
PriceableTargetthat has a vendorRef, if the exact match of target's type, id, and vendorRef cannot be found, it will fall back to a price data that has only has the match of target's type and id withnullvendorRef. If both price data exist, then the exact match takes precedence.- Parameters:
 target- thePriceableTargetto matchpriceListId- thePriceList.getId()to look forpriceState- the currentPriceableTargetPriceState- Returns:
 - an 
Optionalof the price found. 
 - 
getPriceSummaryFromPriceData
protected Optional<PriceSummary> getPriceSummaryFromPriceData(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, String priceListId, PriceableTargetPriceState priceState) Gets thePriceSummaryfrom a matchingPriceData.For a
PriceableTargetthat has a vendorRef, if the exact match of target's type, id, and vendorRef cannot be found, it will fall back to a price data that has only has the match of target's type and id withnullvendorRef. If both price data exist, then the exact match takes precedence.- Parameters:
 target- thePriceableTargetto matchpriceListId- thePriceList.getId()to look forpriceState- the currentPriceableTargetPriceState- Returns:
 - an 
Optional<PriceSummary>. 
 - 
priceDataMatchesTarget
protected boolean priceDataMatchesTarget(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.PriceableTarget target, @NonNull @NonNull PriceData priceData, @NonNull @NonNull PriceableTargetPriceState priceState) Compares the terms and characteristics of thepriceDatato those requested on thetargetto ensure it matches. ThepriceDatashould already match the target's id and type by this point.- Parameters:
 target- The requestedtargetto be pricedpriceData- The potentialPriceDatamatching the target- Returns:
 - Whether 
priceDatamatches the terms and characteristics on thetarget. - Since:
 - Pricing Service 2.1.0, Release Train 2.2.0
 
 - 
targetsAreEquivalent
protected boolean targetsAreEquivalent(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.BasePriceableTarget a, @NonNull @NonNull com.broadleafcommerce.pricing.client.domain.BasePriceableTarget b) Method allowing comparisons betweenBasePriceableTargetsusing only core fields—ignores vendor ref.- Parameters:
 a- The first target.b- The other target.- Returns:
 - Whether the targets are equal when comparing core fields.
 
 - 
areCharacteristicsEquivalent
protected boolean areCharacteristicsEquivalent(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.BasePriceableTarget a, @NonNull @NonNull com.broadleafcommerce.pricing.client.domain.BasePriceableTarget b)  - 
getFallbackPriceData
protected Optional<PriceData> getFallbackPriceData(com.broadleafcommerce.pricing.client.domain.PriceableTargetRef targetRef, String priceListId, PriceableTargetPriceState priceState)  - 
buildSummaryFromPriceData
protected PriceSummary buildSummaryFromPriceData(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.PriceableTarget target, @NonNull @NonNull PriceData data) Builds aPriceSummaryofdata. This was introduced along with the new fields for recurring and usage prices.- Parameters:
 target- The requestedtargetto be priceddata- ThePriceDatamatching the target- Returns:
 - A 
PriceSummaryof thedatathat matchedtarget - Since:
 - Pricing Service 2.1.0, Release Train 2.2.0
 - See Also:
 
 - 
determineMaxTier
protected Optional<PriceDataTier> determineMaxTier(com.broadleafcommerce.pricing.client.domain.PriceableTarget priceableTarget, List<PriceDataTier> priceDataTiers)  - 
getPriceFromModifier
protected Optional<javax.money.MonetaryAmount> getPriceFromModifier(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
getPriceModifierForTarget
protected Optional<PriceModifier> getPriceModifierForTarget(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  - 
modifyPrice
protected javax.money.MonetaryAmount modifyPrice(javax.money.MonetaryAmount baseAmount, PriceModifier priceModifier) Performs thePriceModifier.getModificationType()on the base price. - 
performOtherOperation
protected javax.money.MonetaryAmount performOtherOperation(String modificationType, BigDecimal modificationAmount, javax.money.MonetaryAmount baseAmount) Extension point for performing custom PriceModifier operations - 
getPriceFromElsewhere
protected Optional<javax.money.MonetaryAmount> getPriceFromElsewhere(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Extension point for getting aPriceSummaryfrom somewhere other than aPriceDataorPriceList.getPriceModifier(). - 
getPriceSummaryFromElsewhere
protected Optional<PriceSummary> getPriceSummaryFromElsewhere(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Extension point for getting aPriceSummaryfrom somewhere other than aPriceDataorPriceList.getPriceModifier().- Since:
 - Pricing Service 2.1.0, Release Train 2.2.0
 
 - 
getTargetsBaseDetails
@NonNull protected Map<String,com.broadleafcommerce.pricing.client.domain.PriceDetail> getTargetsBaseDetails(@NonNull @NonNull @NonNull com.broadleafcommerce.pricing.client.domain.PriceableTarget target, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds a map ofPriceDetailsfor each field ofPriceableTarget.getPriceableFields()where the key is the type.- Parameters:
 target- ThePriceableTargetcontextInfo- Additional tenant and sandbox info- Returns:
 - A map of 
PriceDetailsfor each field oftarget#priceableFieldswhere the key is the type. 
 - 
addBasePriceDetail
@Deprecated protected void addBasePriceDetail(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated. - 
addBaseCostPriceDetail
@Deprecated protected void addBaseCostPriceDetail(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated. - 
getBasePrice
@Nullable protected javax.money.MonetaryAmount getBasePrice(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) By default, gets thePriceableFieldProperties.getBasePrice(). - 
getBaseCost
@Nullable protected javax.money.MonetaryAmount getBaseCost(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) By default, gets thePriceableFieldProperties.getBaseCost(). - 
putBestPriceForType
protected void putBestPriceForType(String type, String priceKey, PriceableTargetPriceState priceState) Records the highest-priority best (lowest) price for the price list type out of all the matches found. - 
formatPrice
Helper method to format aMonetaryAmountas a price string - 
getBestPriceForType
@Deprecated protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail> getBestPriceForType(Map<PriceList, javax.money.MonetaryAmount> pricesMap) Deprecated.in favor ofgetBestPriceFromPriceLists(Map)in order to hold & pass on more details than justMonetaryAmount. - 
getBestPriceFromPriceLists
protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail> getBestPriceFromPriceLists(Map<PriceList, PriceListPriceDetail> priceListPriceDetailMap) Picks the best (lowest) price for the price list type out of all the matches found. - 
noCurrency
@Deprecated(since="Pricing Service 2.1.0", forRemoval=true) public boolean noCurrency(AtomicReference<javax.money.MonetaryAmount> refAmount) Deprecated, for removal: This API element is subject to removal in a future version.Unused - 
getBestPriceOverall
@Nullable protected com.broadleafcommerce.pricing.client.domain.PriceDetail getBestPriceOverall(@Nullable Map<String, com.broadleafcommerce.pricing.client.domain.PriceDetail> prices, @Nullable Currency defaultCurrency) Retrieves all of thePriceableFieldTypesin ascending order byPriceableFieldType.order(). Then, returns aPriceDetailfor the best price found for the type.Out of the box, if a price with currency matching the default is found, we want to prioritize that. Otherwise, the lowest price is chosen.
If there are more than one price that are equal to the lowest price (i.e. standard and sale price are equally the lowest), then we want to prioritize whichever
PriceDetailthat is not a sale price.- Parameters:
 prices- map of price type (e.g., standardPrice, salePrice, contractPrice) to its correspondingPriceDetaildefaultCurrency- default currency in the current context- Returns:
 PriceDetailfor the best price found
 - 
getBackupPrice
protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail> getBackupPrice(com.broadleafcommerce.pricing.client.domain.PriceDetail currentBestPrice, PriceableTargetPriceState priceState) Gets the backup price for the current limited best price.This is for "flash sale" concept where a sale price has a limited quantity. To support cases where the
PriceData.getAvailableQuantity()is not sufficient for the target quantity, a backup price is provided, which out of box is the second best price that does not have a limit.- Parameters:
 currentBestPrice- the current best pricepriceState- the current price state- Returns:
 - the backup price for the current limited best price
 
 - 
isEqualPrice
protected boolean isEqualPrice(com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail1, com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail2) Checks if the givenPriceDetailshave the same price.- Parameters:
 priceDetail1- the firstPriceDetailto comparepriceDetail2- the secondPriceDetailto compare- Returns:
 - true if both 
PriceDetailshave the same price, otherwise false 
 - 
isSalePrice
protected boolean isSalePrice(com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail) Checks if the givenPriceDetailis of typePriceableFieldType.SALE_PRICE.- Parameters:
 priceDetail- thePriceDetailto check against- Returns:
 - true of the given 
PriceDetailis of typePriceableFieldType.SALE_PRICE, otherwise false 
 - 
getBestPriceOverall
@Deprecated protected com.broadleafcommerce.pricing.client.domain.PriceDetail getBestPriceOverall(Map<String, com.broadleafcommerce.pricing.client.domain.PriceDetail> prices) Deprecated.in favor ofgetBestPriceOverall(Map, Currency)Retrieves all of the
PriceableFieldTypesin ascending order byPriceableFieldType.order(). Then, returns aPriceDetailfor the best price found for the type.Out of the box, the lowest price is chosen.
 - 
addPriceInfoForTarget
protected void addPriceInfoForTarget(List<com.broadleafcommerce.pricing.client.domain.PriceInfo> priceInfos, com.broadleafcommerce.pricing.client.domain.PriceableTarget priceableTarget, com.broadleafcommerce.pricing.client.domain.PriceDetail bestPriceDetail, PriceableTargetPriceState priceState, boolean skipDetails) Uses the best price detail found for the target and creates aPriceInfofor it. Then, addsPriceTypeDetailsfor each type of price found. Optionally, this also addsPriceDetailsfor all candidate prices found besides the best one, ifskipDetails == false.- Parameters:
 priceInfos- The current list ofPriceInfosinto which to add a newPriceInfo.priceableTarget- ThePriceableTargetfor which the newPriceInfocorresponds.bestPriceDetail- ThePriceDetailof the best overall price from amongst all types of prices.priceState- The currentPriceableTargetPriceStatewith fall the important pricing info discovered for the targets.skipDetails- Whether to not includePriceDetailsin thePriceInfo
 - 
addPriceTypeDetail
protected void addPriceTypeDetail(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, String type, com.broadleafcommerce.pricing.client.domain.PriceDetail detail)  - 
addPriceDetail
@Deprecated(forRemoval=true, since="1.7.14, 2.0.1") protected void addPriceDetail(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, PriceList priceList, javax.money.MonetaryAmount price, Map<String, List<PriceDataTier>> priceTiers) Deprecated, for removal: This API element is subject to removal in a future version. - 
addPriceDetail
protected void addPriceDetail(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, PriceList priceList, PriceListPriceDetail listPriceDetail, Map<String, List<PriceDataTier>> priceTiers)  - 
populatePriceDataTierRef
protected com.broadleafcommerce.pricing.client.domain.PriceDataTierRef populatePriceDataTierRef(PriceDataTier priceDataTier)  - 
getErrors
protected org.springframework.validation.Errors getErrors(com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) - Parameters:
 priceInfoContext- The price info context to bind an errors object to.- Returns:
 - An errors object bound to 
priceInfoContext 
 - 
getPriceDataService
 - 
getRuleEvaluationService
protected com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService getRuleEvaluationService() - 
getPriceableFields
 - 
getPriceListService
 - 
getValidator
protected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator getValidator() - 
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() - 
setPriceDetailComparator
@Autowired(required=false) public void setPriceDetailComparator(PriceDetailComparator priceDetailComparator)  
 - 
 
getTargetsBaseDetails(PriceableTarget, ContextInfo)