Class DefaultPriceInfoService
- All Implemented Interfaces:
PriceInfoService
- Author:
- Chad Harchar (charchar), Nathan Moore (nathanmoore)
-
Field Summary
Fields -
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 voidaddBackupPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, com.broadleafcommerce.pricing.client.domain.PriceDetail backupDetail, PriceableTargetPriceState priceState) protected 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 voidaddPriceAdjustmentInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, com.broadleafcommerce.pricing.client.domain.PriceDetail detail) 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 com.broadleafcommerce.pricing.client.domain.PriceInfoaddPriceInfoForTarget(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 voidaddTargetToPriceListMapForTarget(Map<TargetKeyDto, Map<String, Set<PriceList>>> priceListsByTypeByTarget, TargetKeyDto targetKeyDto, PriceList priceList) protected javax.money.MonetaryAmountamountOrZero(javax.money.CurrencyUnit currencyUnit, javax.money.MonetaryAmount amount) protected voidapplyPriceDataAdjustment(com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail, PriceData priceData) protected booleanapplyPriceListAdjustment(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail, PriceList priceList) Return true if a price list adjustment was made.protected Optional<javax.money.MonetaryAmount>baseAmountFromState(String fieldToModify, PriceableTargetPriceState priceState) protected List<com.broadleafcommerce.pricing.client.domain.PriceDataTierRef>buildModifiedPriceTiersList(@NonNull com.broadleafcommerce.pricing.client.domain.PriceDetail originalDetail, PriceModifier priceModifier, com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList) protected List<com.broadleafcommerce.pricing.client.domain.PriceDataTierRef>buildModifiedPriceTiersList(@NonNull com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail, String operationType, @NonNull BigDecimal value) protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail>buildNewPriceDetailForAdjustment(String phase, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) protected PriceSummarybuildSummaryFromPriceData(@NonNull com.broadleafcommerce.pricing.client.domain.PriceableTarget target, @NonNull PriceData data) Builds aPriceSummaryofdata.protected booleancheckForCharacteristicMatch(PriceData priceData, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) protected booleancheckForPaymentStrategyMatch(PriceData pd, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) protected booleancheckForRecurringFrequencyMatch(PriceData pd, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) protected booleancheckForTermMatch(PriceData pd, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) protected booleancheckForVendorMatch(String vendorRef, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) protected com.broadleafcommerce.pricing.client.domain.PriceDataTierRefcloneTierRef(@NonNull com.broadleafcommerce.pricing.client.domain.PriceDataTierRef original, @NonNull javax.money.MonetaryAmount newAmount) Returns a copy of the passed in PriceDataTierRef with an updated amountconvertPriceListsToPriceListIds(Collection<PriceList> priceLists) protected List<TargetKeyDto>convertTargetsToTargetKeyDtos(Collection<com.broadleafcommerce.pricing.client.domain.PriceableTarget> targets) protected Optional<PriceDataTier>determineMaxTier(com.broadleafcommerce.pricing.client.domain.PriceableTarget priceableTarget, List<PriceDataTier> priceDataTiers) protected List<PriceDataTier>filterPriceDataTiers(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceData priceData) Filters the tiers on the providedPriceDatabased on the attribute or characteristic.protected List<PriceDataTier>filterTiersByAttributeQuantity(Integer totalAttributeQuantity, List<PriceDataTier> potentialTiers) Return only tiers that have the greatestPriceDataTier.getAttributeMinValue()that is greater or equal to the total attribute quantity.findMatchingAdjustmentPriceData(PriceList priceList, com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceableTargetPriceState priceState) protected StringformatPrice(javax.money.MonetaryAmount price) Helper method to format aMonetaryAmountas a price stringprotected IntegergetAttributeQuantity(Object targetAttribute) Hook point to get the quantity of an attribute used for tier filtering.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 Comparator<com.broadleafcommerce.pricing.client.domain.PriceDetailComparable>getBestOverallPriceDetailComparator(javax.money.CurrencyUnit requestedCurrency) By default, when comparing price details across phases the system will prefer details in the correct currency followed by the detail with the lowest price.protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail>getBestPriceForType(Map<PriceList, javax.money.MonetaryAmount> pricesMap) Deprecated.in favor of#getBestPriceFromPriceLists(Map)in order to hold & pass on more details than justMonetaryAmount.protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail>getBestPriceFromPriceLists(Map<PriceList, PriceListPriceDetail> priceListPriceDetailMap, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail>getBestPriceFromPriceLists(Map<PriceList, PriceListPriceDetail> priceListPriceDetailMap, javax.money.CurrencyUnit requestedCurrency, boolean includeLimitedQuantity) 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, PriceableTargetPriceState priceState) Retrieves all of thePriceableFieldTypesin ascending order byPriceableFieldType.order().protected com.broadleafcommerce.pricing.client.domain.PriceDetailgetBestPriceOverall(Map<String, com.broadleafcommerce.pricing.client.domain.PriceDetail> prices, Currency defaultCurrency) Deprecated, for removal: This API element is subject to removal in a future version.since Pricing Services 2.2.0, Release Train 2.3.0, in favor ofgetBestPriceOverall(Map, PriceableTargetPriceState)protected IntegergetCharacteristicQuantity(String targetCharacteristic) Hook point to get the quantity of a characteristic used for tier filtering.protected CurrencyConversionServiceprotected org.springframework.validation.ErrorsgetErrors(com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) protected PriceableFieldPropertiesprotected PriceDataService<PriceData>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 PriceInfoPropertiesprotected StringgetPriceKey(String type) protected Map<org.apache.commons.lang3.tuple.Pair<String,TargetKeyDto>, List<PriceData>> getPriceListAndTargetPriceDataMap(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget> priceableTargets, List<PriceList> priceLists) Return an ordered list of price list types.protected PriceListPriceDetailComparatorgetPriceListPriceDetailComparator(javax.money.CurrencyUnit requestedCurrency) protected Optional<PriceListPriceDetail>getPriceListPriceDetailFromModifier(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected PriceListService<PriceList>protected Optional<PriceModifier>getPriceModifierForTarget(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList 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 <T extends com.broadleafcommerce.pricing.client.domain.PriceableTarget,R extends PriceData>
Set<T>getTargetsForAllRecurringPeriodTypes(@NonNull Set<T> priceableTargets, @NonNull Set<R> availablePriceData, boolean matchPaymentStrategy) Gets a newSetofPriceableTargets with all available term and frequency combinations.protected com.broadleafcommerce.common.extension.TypeFactoryprotected com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidatorgroupAdjustmentListsByPhase(List<PriceList> adjPriceLists) Moves adjustment price lists into a structure to support processing by phase (e.g.protected booleanhasTermOrFrequency(@NonNull PriceData priceData) protected com.broadleafcommerce.pricing.client.domain.PriceInfoinitPriceInfoFromDetail(com.broadleafcommerce.pricing.client.domain.PriceDetail detail, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) protected booleanisAdjustmentApplicableToTarget(PriceList priceList, com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail) protected booleanisAdjustmentPriceListValidForType(PriceList priceList, String type) Determines if an adjustment price list is targeting a price list phase based on its value forPriceModifier.fieldToModifyprotected booleanisBaseField(String field) protected booleanisEqualPrice(com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail1, com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail2) Checks if the givenPriceDetailshave the same price.protected booleanprotected booleanisFieldValidForSalePhase(String phase) protected booleanprotected 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, com.broadleafcommerce.pricing.client.domain.PriceableTarget priceableTarget, PriceList priceList) protected javax.money.MonetaryAmountmodifyPrice(javax.money.MonetaryAmount baseAmount, String modificationType, BigDecimal modAmount) 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.protected javax.money.MonetaryAmountperformOtherOperation(String modificationType, BigDecimal modificationAmount, javax.money.MonetaryAmount baseAmount) Extension point for performing custom PriceModifier operationsprotected voidpopulatePriceContextCurrencies(com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) Populates thePriceContext.getPriceTargetCurrencies()with the currencies of thePriceInfoContext.getPriceableTargets().protected 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 booleanpriceDataMatchesTarget(@NonNull com.broadleafcommerce.pricing.client.domain.PriceableTarget target, @NonNull PriceData priceData, PriceableTargetPriceState priceState, boolean checkTerm, boolean checkRecurringFrequency, boolean checkPaymentStrategy) Compares the terms and characteristics of thepriceDatato those requested on thetargetto ensure it matches.protected voidprocessBackupPriceAdjustments(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Map<String, List<PriceList>> adjListsByPhase, String phase, PriceableTargetPriceState priceState, Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail> detail) protected voidprocessPriceAdjustments(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Map<String, List<PriceList>> adjListsByPhase, String phase, PriceableTargetPriceState priceState, Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail> detail) protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail>putBestBackupPriceForType(String type, String priceKey, PriceableTargetPriceState priceState) Records the best backup price for the price list type out of all the matches found.protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail>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.protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail>putBestPriceForTypeInternal(String type, String priceKey, PriceableTargetPriceState priceState, boolean includeLimitedQuantity) 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) protected voidremovePriceDataFromLowerPriorityPriceLists(Map<org.apache.commons.lang3.tuple.Pair<String, TargetKeyDto>, List<PriceData>> priceListAndTargetPriceDataMap, Map<TargetKeyDto, Map<String, Set<PriceList>>> priceListsByTypeByTarget) 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) voidsetCurrencyConversionService(CurrencyConversionService currencyConversionService) voidsetPriceDetailComparator(PriceDetailComparator priceDetailComparator) voidsetPriceInfoProperties(PriceInfoProperties priceInfoProperties) splitPriceListsByType(List<PriceList> priceLists) protected booleantargetContainsValidField(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, String fieldName) protected voidupdateContextInfoCurrency(List<PriceList> priceLists, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidupdateCostFromCostList(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, List<PriceList> costPriceLists, PriceableTargetPriceState priceState) protected voidupdatePriceContextWithVendorRefList(com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext) To support better query efficiency related to large numbers of vendor price lists, store the list of applicable vendors for this pricing request on the PriceContext.
-
Field Details
-
BASE_FIELDS_LIST
-
-
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
-
getPriceListPriceDetailComparator
protected PriceListPriceDetailComparator getPriceListPriceDetailComparator(javax.money.CurrencyUnit requestedCurrency) -
getBestOverallPriceDetailComparator
protected Comparator<com.broadleafcommerce.pricing.client.domain.PriceDetailComparable> getBestOverallPriceDetailComparator(javax.money.CurrencyUnit requestedCurrency) By default, when comparing price details across phases the system will prefer details in the correct currency followed by the detail with the lowest price.If a priceDetailComparator is configured, it will use that over the default logic.
-
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
-
updatePriceContextWithVendorRefList
protected void updatePriceContextWithVendorRefList(com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext) To support better query efficiency related to large numbers of vendor price lists, store the list of applicable vendors for this pricing request on the PriceContext. -
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) -
getTargetsForAllRecurringPeriodTypes
protected <T extends com.broadleafcommerce.pricing.client.domain.PriceableTarget,R extends PriceData> Set<T> getTargetsForAllRecurringPeriodTypes(@NonNull @NonNull Set<T> priceableTargets, @NonNull @NonNull Set<R> availablePriceData, boolean matchPaymentStrategy) Gets a newSetofPriceableTargets with all available term and frequency combinations.For example, consider a
PriceableTargetwith a 2-year term and two matching PriceData distinguished by their recurring period types. One hasDefaultRecurringPeriodType.MONTHLY, and one hasDefaultRecurringPeriodType.ANNUALLYfrequency. This method will return a new set ofPriceableTargetswith the originalPriceableTargetand a clone of it for each available frequency.Creating a
PriceableTargetfor each unique term and frequency combination allows them to be priced independently, which will consequently get the best price for each combination. -
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. -
populatePriceContextCurrencies
protected void populatePriceContextCurrencies(com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) Populates thePriceContext.getPriceTargetCurrencies()with the currencies of thePriceInfoContext.getPriceableTargets(). -
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:
-
groupAdjustmentListsByPhase
Moves adjustment price lists into a structure to support processing by phase (e.g. STANDARD, SALE, CONTRACT). -
isAdjustmentPriceListValidForType
Determines if an adjustment price list is targeting a price list phase based on its value forPriceModifier.fieldToModify -
isFieldValidForStandardPhase
-
isFieldValidForSalePhase
-
isFieldValidForContractPhase
-
splitPriceListsByType
-
getPriceListPhases
Return an ordered list of price list types. The order of this list is important to ensure that price formulas work as expected since, for example, a STANDARD price could depend on the result of a COST or a SALE could depend on the result of a STANDARD price. -
getPriceListAndTargetPriceDataMap
protected Map<org.apache.commons.lang3.tuple.Pair<String,TargetKeyDto>, getPriceListAndTargetPriceDataMapList<PriceData>> (com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget> priceableTargets, List<PriceList> priceLists) -
addTargetToPriceListMapForTarget
protected void addTargetToPriceListMapForTarget(Map<TargetKeyDto, Map<String, Set<PriceList>>> priceListsByTypeByTarget, TargetKeyDto targetKeyDto, PriceList priceList) Adds the givenTargetKeyDtoandPriceListto the givenMapofPriceLists by type by target.This should only be used if
PriceInfoProperties.isAllowMergingTermFrequencyAcrossPriceLists()is false. TheMapofPriceLists by type by target is used to track all thePriceLists that contains the available PriceData for a target, so that at the end, only the PriceData from the highest priority PriceList is kept.The recurring details are taken out to track available term and frequency combinations for the same target.
- Parameters:
priceListsByTypeByTarget- theMapofPriceLists by type by target to keep track of all thePriceLists that contains the available PriceData for a targettargetKeyDto- theTargetKeyDtoto add to theMapofPriceLists by type by targetpriceList- thePriceListthat the price data target is from- Since:
- Pricing Services 2.2.0, Release Train 2.3.0
-
removePriceDataFromLowerPriorityPriceLists
protected void removePriceDataFromLowerPriorityPriceLists(Map<org.apache.commons.lang3.tuple.Pair<String, TargetKeyDto>, List<PriceData>> priceListAndTargetPriceDataMap, Map<TargetKeyDto, Map<String, Set<PriceList>>> priceListsByTypeByTarget) Removes all thePriceDataentry from the givenMapofPriceDataif they are from a lower-priorityPriceList, so that only thePriceDataentry from the highest priority PriceList is kept.This should only be used if
PriceInfoProperties.isAllowMergingTermFrequencyAcrossPriceLists()is false.- Parameters:
priceListAndTargetPriceDataMap- theMapofPriceDataby aPairof price list id andPriceableTargetReffor thePriceDatato remove entries frompriceListsByTypeByTarget- theMapofPriceLists by type by target to keep track of all thePriceLists that contains the available PriceData for a target- Since:
- Pricing Services 2.2.0, Release Train 2.3.0
-
hasTermOrFrequency
-
getPriceKey
-
processPriceAdjustments
protected void processPriceAdjustments(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Map<String, List<PriceList>> adjListsByPhase, String phase, PriceableTargetPriceState priceState, Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail> detail) -
processBackupPriceAdjustments
protected void processBackupPriceAdjustments(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Map<String, List<PriceList>> adjListsByPhase, String phase, PriceableTargetPriceState priceState, Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail> detail) -
isAdjustmentApplicableToTarget
protected boolean isAdjustmentApplicableToTarget(PriceList priceList, com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail) -
buildNewPriceDetailForAdjustment
-
targetContainsValidField
protected boolean targetContainsValidField(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, String fieldName) -
findMatchingAdjustmentPriceData
protected Optional<PriceData> findMatchingAdjustmentPriceData(PriceList priceList, com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceableTargetPriceState priceState) -
checkForTermMatch
protected boolean checkForTermMatch(PriceData pd, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) -
checkForRecurringFrequencyMatch
protected boolean checkForRecurringFrequencyMatch(PriceData pd, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) -
checkForPaymentStrategyMatch
protected boolean checkForPaymentStrategyMatch(PriceData pd, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) -
checkForVendorMatch
protected boolean checkForVendorMatch(String vendorRef, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) -
checkForCharacteristicMatch
protected boolean checkForCharacteristicMatch(PriceData priceData, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) -
applyPriceDataAdjustment
protected void applyPriceDataAdjustment(com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail, PriceData priceData) -
applyPriceListAdjustment
protected boolean applyPriceListAdjustment(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail, PriceList priceList) Return true if a price list adjustment was made. -
putPricesForType
-
updateCostFromCostList
protected void updateCostFromCostList(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, List<PriceList> costPriceLists, PriceableTargetPriceState priceState) -
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
-
convertTargetsToTargetKeyDtos
protected List<TargetKeyDto> convertTargetsToTargetKeyDtos(Collection<com.broadleafcommerce.pricing.client.domain.PriceableTarget> targets) -
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
-
priceDataMatchesTarget
protected boolean priceDataMatchesTarget(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.PriceableTarget target, @NonNull @NonNull PriceData priceData, @Nullable PriceableTargetPriceState priceState, boolean checkTerm, boolean checkRecurringFrequency, boolean checkPaymentStrategy) 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 Services 2.2.0, Release Train 2.3.0
-
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:
-
filterPriceDataTiers
protected List<PriceDataTier> filterPriceDataTiers(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceData priceData) Filters the tiers on the providedPriceDatabased on the attribute or characteristic. Typically, this will only be called when thePriceData.getTierPricingStrategy()is set toTierPricingStrategyType.TWO_FACTOR.- Parameters:
target- the priceable targetpriceData- the price data containing the tiers to filter- Returns:
- the filtered list of price data tiers
- Since:
- Pricing Service 2.2.0, Release Train 2.3.0
-
getAttributeQuantity
Hook point to get the quantity of an attribute used for tier filtering.- Parameters:
targetAttribute- the attribute value- Returns:
- the quantity of the attribute
- Since:
- Pricing Service 2.2.0, Release Train 2.3.0
-
getCharacteristicQuantity
Hook point to get the quantity of a characteristic used for tier filtering.- Parameters:
targetCharacteristic- the attribute value- Returns:
- the quantity of the attribute
- Since:
- Pricing Service 2.2.0, Release Train 2.3.0
-
filterTiersByAttributeQuantity
protected List<PriceDataTier> filterTiersByAttributeQuantity(Integer totalAttributeQuantity, List<PriceDataTier> potentialTiers) Return only tiers that have the greatestPriceDataTier.getAttributeMinValue()that is greater or equal to the total attribute quantity. If no match, returns an empty list.- Parameters:
totalAttributeQuantity- the total attribute quantitypotentialTiers- the potential tiers to filter- Since:
- Pricing Service 2.2.0, Release Train 2.3.0
-
determineMaxTier
protected Optional<PriceDataTier> determineMaxTier(com.broadleafcommerce.pricing.client.domain.PriceableTarget priceableTarget, List<PriceDataTier> priceDataTiers) -
getPriceListPriceDetailFromModifier
protected Optional<PriceListPriceDetail> getPriceListPriceDetailFromModifier(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList, PriceableTargetPriceState priceState, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
buildModifiedPriceTiersList
protected List<com.broadleafcommerce.pricing.client.domain.PriceDataTierRef> buildModifiedPriceTiersList(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.PriceDetail priceDetail, String operationType, @NonNull @NonNull BigDecimal value) -
buildModifiedPriceTiersList
protected List<com.broadleafcommerce.pricing.client.domain.PriceDataTierRef> buildModifiedPriceTiersList(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.PriceDetail originalDetail, PriceModifier priceModifier, com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList) -
cloneTierRef
protected com.broadleafcommerce.pricing.client.domain.PriceDataTierRef cloneTierRef(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.PriceDataTierRef original, @NonNull @NonNull javax.money.MonetaryAmount newAmount) Returns a copy of the passed in PriceDataTierRef with an updated amount- Parameters:
original-PriceDataTierRefto clonenewAmount- Price to set on the clone- Returns:
- The clone with updated price
- Since:
- Pricing Service 2.2.0, Release Train 2.3.0
-
baseAmountFromState
protected Optional<javax.money.MonetaryAmount> baseAmountFromState(String fieldToModify, PriceableTargetPriceState priceState) -
isBaseField
-
getPriceModifierForTarget
protected Optional<PriceModifier> getPriceModifierForTarget(com.broadleafcommerce.pricing.client.domain.PriceableTarget target, PriceList priceList) -
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, String modificationType, BigDecimal modAmount) Performs thePriceModifier.getModificationType()on the base price. -
modifyPrice
protected javax.money.MonetaryAmount modifyPrice(javax.money.MonetaryAmount baseAmount, PriceModifier priceModifier, com.broadleafcommerce.pricing.client.domain.PriceableTarget priceableTarget, PriceList priceList) -
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 Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail> 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. -
putBestBackupPriceForType
protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail> putBestBackupPriceForType(String type, String priceKey, PriceableTargetPriceState priceState) Records the best backup price for the price list type out of all the matches found. -
putBestPriceForTypeInternal
protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail> putBestPriceForTypeInternal(String type, String priceKey, PriceableTargetPriceState priceState, boolean includeLimitedQuantity) -
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 of#getBestPriceFromPriceLists(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, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext) -
getBestPriceFromPriceLists
protected Optional<com.broadleafcommerce.pricing.client.domain.PriceDetail> getBestPriceFromPriceLists(Map<PriceList, PriceListPriceDetail> priceListPriceDetailMap, javax.money.CurrencyUnit requestedCurrency, boolean includeLimitedQuantity) Picks the best (lowest) price for the price list type out of all the matches found. -
getBestPriceOverall
@Nullable @Deprecated(since="Pricing Service 2.3.0, Release Train 2.3.0", forRemoval=true) protected com.broadleafcommerce.pricing.client.domain.PriceDetail getBestPriceOverall(@Nullable Map<String, com.broadleafcommerce.pricing.client.domain.PriceDetail> prices, @Nullable Currency defaultCurrency) Deprecated, for removal: This API element is subject to removal in a future version.since Pricing Services 2.2.0, Release Train 2.3.0, in favor ofgetBestPriceOverall(Map, PriceableTargetPriceState) -
getBestPriceOverall
@Nullable protected com.broadleafcommerce.pricing.client.domain.PriceDetail getBestPriceOverall(@Nullable Map<String, com.broadleafcommerce.pricing.client.domain.PriceDetail> prices, PriceableTargetPriceState priceState) 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 correspondingPriceDetailpriceState- the currentPriceableTargetPriceState- Returns:
PriceDetailfor the best price found
-
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 com.broadleafcommerce.pricing.client.domain.PriceInfo 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
-
addBackupPriceInfo
protected void addBackupPriceInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, com.broadleafcommerce.pricing.client.domain.PriceDetail backupDetail, PriceableTargetPriceState priceState) -
initPriceInfoFromDetail
protected com.broadleafcommerce.pricing.client.domain.PriceInfo initPriceInfoFromDetail(com.broadleafcommerce.pricing.client.domain.PriceDetail detail, com.broadleafcommerce.pricing.client.domain.PriceableTarget target) -
addPriceAdjustmentInfo
protected void addPriceAdjustmentInfo(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo, com.broadleafcommerce.pricing.client.domain.PriceDetail detail) -
amountOrZero
protected javax.money.MonetaryAmount amountOrZero(javax.money.CurrencyUnit currencyUnit, javax.money.MonetaryAmount amount) -
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) -
getPriceInfoProperties
-
setPriceInfoProperties
-
getCurrencyConversionService
-
setCurrencyConversionService
@Autowired public void setCurrencyConversionService(CurrencyConversionService currencyConversionService)
-
getTargetsBaseDetails(PriceableTarget, ContextInfo)