Class ExternalPricingProvider
java.lang.Object
com.broadleafcommerce.cartoperation.service.provider.external.AbstractExternalProvider
com.broadleafcommerce.cartoperation.service.provider.external.ExternalPricingProvider
- All Implemented Interfaces:
- PricingProvider
- Author:
- Chad Harchar (charchar), Nathan Moore (nathandmoore)
- 
Field SummaryFields inherited from class com.broadleafcommerce.cartoperation.service.provider.external.AbstractExternalProviderENTITY_NOT_FOUND
- 
Constructor SummaryConstructorsConstructorDescriptionExternalPricingProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, CartItemPricingUtils cartItemPricingUtils, ExternalPricingProperties properties, UserTargetGenerationService userTargetGenerationService) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidaddUserTargets(@NonNull com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext) Add customer and customer segment user targets toPriceContext.getUserTargets().protected <P extends com.broadleafcommerce.pricing.client.domain.PriceInfo>
 voidattachPricingToCartItem(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull Collection<P> priceInfos) protected <P extends com.broadleafcommerce.pricing.client.domain.PriceInfo>
 voidattachPricingToCartItem(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull Collection<P> priceInfos, String variantId) protected StringbuildPriceContextHeader(@NonNull com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext) protected CartItemPricingUtilsprotected com.broadleafcommerce.pricing.client.domain.context.PriceContextgetPriceContext(Locale locale, javax.money.CurrencyUnit currency) protected com.broadleafcommerce.pricing.client.domain.context.PriceInfoContextgetPriceInfoContext(Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget> priceableTargets) protected ExternalPricingPropertiesprotected StringgetTotalQuantityForTargetIdMap(@NonNull Collection<C> cartItems) Creates a map of the SKU or pricing key of an underlying item from a cart item to the total quantity of that item across all cart items.protected UserTargetGenerationServiceprotected booleanisDependentItem(com.broadleafcommerce.cart.client.domain.CartItem cartItem) <C extends com.broadleafcommerce.cart.client.domain.CartItem>
 List<C>retrievePrices(@NonNull Collection<C> cartItems, @NonNull Locale locale, @NonNull javax.money.CurrencyUnit currency, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve and attach prices for the provided cart items.Methods inherited from class com.broadleafcommerce.cartoperation.service.provider.external.AbstractExternalProviderbuildNotFoundException, executeRequest, getHeaders, getObjectMapper, getTypeFactory, getWebClient, isEntityNotFound, pageableToParams, uriVars
- 
Constructor Details- 
ExternalPricingProviderpublic ExternalPricingProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, CartItemPricingUtils cartItemPricingUtils, ExternalPricingProperties properties, UserTargetGenerationService userTargetGenerationService) 
 
- 
- 
Method Details- 
retrievePricespublic <C extends com.broadleafcommerce.cart.client.domain.CartItem> List<C> retrievePrices(@NonNull @NonNull Collection<C> cartItems, @NonNull @NonNull Locale locale, @NonNull @NonNull javax.money.CurrencyUnit currency, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PricingProviderRetrieve and attach prices for the provided cart items.- Specified by:
- retrievePricesin interface- PricingProvider
- Parameters:
- cartItems- The cart items that we are pricing.
- locale- The locale to use to match prices.
- currency- The currency to use to match prices.
- contextInfo- Context information around sandbox and multitenant state.
- Returns:
- The cart items with prices attached.
 
- 
getServiceClient
- 
getTotalQuantityForTargetIdMapprotected <C extends com.broadleafcommerce.cart.client.domain.CartItem> Map<String,Integer> getTotalQuantityForTargetIdMap(@NonNull @NonNull Collection<C> cartItems) Creates a map of the SKU or pricing key of an underlying item from a cart item to the total quantity of that item across all cart items. That is to say, if multiple of the same product are in the cart as separate line items, this method will return the combined quantity for that product as if it had only one line item.- Type Parameters:
- C- Type of the CartItem in case of extensions
- Parameters:
- cartItems- Items in the cart
- Returns:
- A map of the SKU or pricing key of an underlying item from a cart item to the total quantity of that item across all cart items.
 
- 
buildPriceContextHeaderprotected String buildPriceContextHeader(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext) 
- 
getPriceContextprotected com.broadleafcommerce.pricing.client.domain.context.PriceContext getPriceContext(Locale locale, javax.money.CurrencyUnit currency) 
- 
getPriceInfoContextprotected com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext getPriceInfoContext(Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget> priceableTargets) 
- 
attachPricingToCartItemprotected <P extends com.broadleafcommerce.pricing.client.domain.PriceInfo> void attachPricingToCartItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull Collection<P> priceInfos, @Nullable String variantId) 
- 
attachPricingToCartItemprotected <P extends com.broadleafcommerce.pricing.client.domain.PriceInfo> void attachPricingToCartItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull Collection<P> priceInfos) 
- 
isDependentItemprotected boolean isDependentItem(com.broadleafcommerce.cart.client.domain.CartItem cartItem) 
- 
addUserTargetsprotected void addUserTargets(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext) Add customer and customer segment user targets toPriceContext.getUserTargets(). Uses the current authentication token to determine principal and details.- Parameters:
- priceContext- The priceContext to add user targets to
 
- 
getCartItemPricingUtils
- 
getProperties
- 
getUserTargetGenerationService
 
-