Interface PricingProvider
- All Known Implementing Classes:
ExternalPricingProvider
public interface PricingProvider
Provider for interfacing with operations around pricing. Typically utilizes
WebClient to
make requests to an external REST API.
Note that priceable entities such as Product should implement the interface
Priceable to aid in mapping the PriceInfos back onto them.
- Author:
- Nathan Moore (nathandmoore)
-
Method Summary
Modifier and TypeMethodDescriptionpriceProduct(Product product, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates pricing info for the providedProductand its related priceable entities:Variant,IncludedProduct,SpecificItemChoice.priceProducts(Collection<P> products, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates pricing info for the providedProductsand their related priceable entities:Variant,IncludedProduct,SpecificItemChoice.List<com.broadleafcommerce.pricing.client.domain.PriceInfo>priceTargets(@NonNull Map<Object, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget>> targetsMap, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates pricing info for the provided targetsMap
-
Method Details
-
priceProduct
Product priceProduct(Product product, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates pricing info for the providedProductand its related priceable entities:Variant,IncludedProduct,SpecificItemChoice.- Parameters:
product- The product to pricepriceContext-PriceContextfrom the original request containing general pricing infopriceInfoContext-PriceInfoContextfrom the original request containing info specific for gettingPriceInfossuch as prefetchedPriceLists.contextInfo-ContextInfofrom the original request containing tenant info- Returns:
- The product with pricing attached.
- Throws:
ProviderApiException- if the provider encounters an error with the request.
-
priceTargets
List<com.broadleafcommerce.pricing.client.domain.PriceInfo> priceTargets(@NonNull @NonNull Map<Object, Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget>> targetsMap, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates pricing info for the provided targetsMap- Parameters:
targetsMap- The targets to pricepriceContext-PriceContextfrom the original request containing general pricing infopriceInfoContext-PriceInfoContextfrom the original request containing info specific for gettingPriceInfossuch as prefetchedPriceLists.contextInfo-ContextInfofrom the original request containing tenant info- Returns:
- The price infos for the targets
-
priceProducts
<P extends Product> List<P> priceProducts(Collection<P> products, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populates pricing info for the providedProductsand their related priceable entities:Variant,IncludedProduct,SpecificItemChoice.- Parameters:
products- The products to pricepriceContext-PriceContextfrom the original request containing general pricing infopriceInfoContext-PriceInfoContextfrom the original request containing info specific for gettingPriceInfossuch as prefetchedPriceLists.contextInfo-ContextInfofrom the original request containing tenant info- Returns:
- The products with pricing attached.
- Throws:
ProviderApiException- if the provider encounters an error with the request.
-