Class CartItemPriceableTargetUtils
java.lang.Object
com.broadleafcommerce.cartoperation.service.provider.external.pricing.CartItemPriceableTargetUtils
Collection of utilities for
PriceableTargets related to CartItem.- Author:
- Nathan Moore (nathandmoore), Erin Pennington (epenning)
-
Constructor Summary
ConstructorsConstructorDescriptionCartItemPriceableTargetUtils(com.fasterxml.jackson.databind.ObjectMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.pricing.client.domain.PriceableTargetcreateTarget(@NonNull String targetId, @NonNull String targetType, String vendorRef, Integer quantity, @NonNull Map<String, javax.money.MonetaryAmount> priceableFields) Creates thePriceableTargetwith the specified identifier and type.protected com.broadleafcommerce.pricing.client.domain.PriceableTargetcreateTargetForSku(@NonNull String sku, String vendorRef, Integer quantity, @NonNull Map<String, javax.money.MonetaryAmount> priceableFields) Deprecated.Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget>createTargets(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull String targetType, @NonNull Map<String, Map<String, javax.money.MonetaryAmount>> priceableFields, Map<String, Integer> totalQuantityForTargetId) Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget>createTargets(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, Map<String, Integer> totalQuantityForTargetId) CreatesPriceableTargetsfor aCartItem.protected com.fasterxml.jackson.databind.ObjectMappergetPriceableFields(@NonNull Map<String, com.broadleafcommerce.pricing.client.domain.PriceInfo> priceInfos) getPriceableFields(com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) Builds the map of priceable fields for aPriceInfothat could later be added asPriceableTarget.getPriceableFields().getPriceableFieldsByTargetType(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) getPriceInfos(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) getPriceInfosByTargetType(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) Gets a map of PriceInfo map by the target type.getSkuPriceInfos(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) Deprecated.in favor ofgetPriceInfos(CartItem)protected com.broadleafcommerce.common.extension.TypeFactory
-
Constructor Details
-
CartItemPriceableTargetUtils
public CartItemPriceableTargetUtils(com.fasterxml.jackson.databind.ObjectMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
createTargets
public Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget> createTargets(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, Map<String, Integer> totalQuantityForTargetId) CreatesPriceableTargetsfor aCartItem. This will create as many targets as are defined in thePRICEABLE_FIELDSattribute inCartItem.getInternalAttributes().- Parameters:
cartItem-CartItemfor which to createPriceableTargets.- Returns:
PriceableTargetsfor aCartItem.
-
createTargets
public Set<com.broadleafcommerce.pricing.client.domain.PriceableTarget> createTargets(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull String targetType, @NonNull @NonNull Map<String, Map<String, javax.money.MonetaryAmount>> priceableFields, Map<String, Integer> totalQuantityForTargetId) -
getPriceableFieldsByTargetType
-
getPriceableFields
-
getSkuPriceInfos
@Deprecated protected Map<String,com.broadleafcommerce.pricing.client.domain.PriceInfo> getSkuPriceInfos(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) Deprecated.in favor ofgetPriceInfos(CartItem) -
getPriceInfos
-
getPriceInfosByTargetType
protected Map<String,Map<String, getPriceInfosByTargetTypecom.broadleafcommerce.pricing.client.domain.PriceInfo>> (@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) Gets a map of PriceInfo map by the target type.- Parameters:
cartItem- theCartItemto get the ap from- Returns:
- a map of PriceInfo map by the target type
-
getPriceableFields
protected Map<String,javax.money.MonetaryAmount> getPriceableFields(@Nullable com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) Builds the map of priceable fields for aPriceInfothat could later be added asPriceableTarget.getPriceableFields(). The key is the type of the priceable field and the value is the amount.- Parameters:
priceInfo-PriceInfofor which to determine the priceable fields.- Returns:
- map of priceable fields for a
PriceInfo - See Also:
-
createTargetForSku
@Deprecated protected com.broadleafcommerce.pricing.client.domain.PriceableTarget createTargetForSku(@NonNull @NonNull String sku, @Nullable String vendorRef, Integer quantity, @NonNull @NonNull Map<String, javax.money.MonetaryAmount> priceableFields) Deprecated.Creates thePriceableTargetwithskuasPriceableTarget.getTargetId().- Parameters:
sku- SKU identifier for which to create aPriceableTarget.vendorRef- Soft reference to the vendor to be associated with thisPriceableTarget.priceableFields- Map of the priceable fields for the sku to add asPriceableTarget.getPriceableFields().- Returns:
- the
PriceableTargetwithskuasPriceableTarget.getTargetId().
-
createTarget
protected com.broadleafcommerce.pricing.client.domain.PriceableTarget createTarget(@NonNull @NonNull String targetId, @NonNull @NonNull String targetType, @Nullable String vendorRef, Integer quantity, @NonNull @NonNull Map<String, javax.money.MonetaryAmount> priceableFields) Creates thePriceableTargetwith the specified identifier and type.- Parameters:
targetId- the target identifier for which to create aPriceableTarget.targetType- the target type for which to create aPriceableTarget.vendorRef- Soft reference to the vendor to be associated with thisPriceableTarget.priceableFields- Map of the priceable fields for the sku to add asPriceableTarget.getPriceableFields().- Returns:
- the
PriceableTargetwithskuasPriceableTarget.getTargetId(). - See Also:
-
getMapper
protected com.fasterxml.jackson.databind.ObjectMapper getMapper() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
createTarget(String, String, String, Integer, Map)