public class ExternalPricingProvider extends AbstractExternalProvider implements PricingProvider
Constructor and Description |
---|
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) |
Modifier and Type | Method and Description |
---|---|
protected void |
addUserTargets(@NonNull com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext)
Add customer and customer segment user targets to
PriceContext.getUserTargets() . |
protected <P extends com.broadleafcommerce.pricing.client.domain.PriceInfo> |
attachPricingToCartItem(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem,
@NonNull Collection<P> priceInfos) |
protected String |
buildPriceContextHeader(@NonNull com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext) |
protected CartItemPricingUtils |
getCartItemPricingUtils() |
protected com.broadleafcommerce.pricing.client.domain.context.PriceContext |
getPriceContext(Locale locale,
javax.money.CurrencyUnit currency) |
protected com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext |
getPriceInfoContext(Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget> priceableTargets) |
protected ExternalPricingProperties |
getProperties() |
protected <C extends com.broadleafcommerce.cart.client.domain.CartItem> |
getTotalQuantityForTargetIdMap(@NonNull Collection<C> cartItems) |
protected UserTargetGenerationService |
getUserTargetGenerationService() |
protected boolean |
isDependentItem(com.broadleafcommerce.cart.client.domain.CartItem cartItem) |
<C extends com.broadleafcommerce.cart.client.domain.CartItem> |
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.
|
executeRequest, getHeaders, getObjectMapper, getTypeFactory, getWebClient, pageableToParams, uriVars
public 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)
public <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)
PricingProvider
retrievePrices
in interface PricingProvider
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.protected <C extends com.broadleafcommerce.cart.client.domain.CartItem> Map<String,Integer> getTotalQuantityForTargetIdMap(@NonNull @NonNull Collection<C> cartItems)
protected String buildPriceContextHeader(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext)
protected com.broadleafcommerce.pricing.client.domain.context.PriceContext getPriceContext(Locale locale, javax.money.CurrencyUnit currency)
protected com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext getPriceInfoContext(Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget> priceableTargets)
protected <P extends com.broadleafcommerce.pricing.client.domain.PriceInfo> void attachPricingToCartItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull Collection<P> priceInfos)
protected boolean isDependentItem(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
protected void addUserTargets(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext)
PriceContext.getUserTargets()
. Uses
the current authentication token to determine principal and details.priceContext
- The priceContext to add user targets toprotected CartItemPricingUtils getCartItemPricingUtils()
protected ExternalPricingProperties getProperties()
protected UserTargetGenerationService getUserTargetGenerationService()
Copyright © 2021. All rights reserved.