Class DefaultFulfillmentPricingService
java.lang.Object
com.broadleafcommerce.cartoperation.service.pricing.DefaultFulfillmentPricingService
- All Implemented Interfaces:
CommonFulfillmentPricingService
,FulfillmentPricingService
- Author:
- Chad Harchar (charchar)
-
Constructor Summary
ConstructorDescriptionDefaultFulfillmentPricingService
(com.fasterxml.jackson.databind.ObjectMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, CartOperationServiceProperties cartOperationServiceProperties, ShippingProvider shippingProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyFulfillmentPricing
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Applies fulfillment pricing to the appropriate cart objects and fields.protected void
applyFulfillmentPricingForGroup
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) Deprecated, for removal: This API element is subject to removal in a future version.protected void
applyFulfillmentPricingForGroup
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Sends a pricing request to the ShippingService that can calculate the cost for theFulfillmentGroup.getFulfillmentOption()
and sets the group's pricing fields based on the response.protected void
applyProductVariantAttributes
(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, @NonNull com.broadleafcommerce.shipping.domain.FulfillmentPricingItem fulfillmentPricingItem, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) protected com.broadleafcommerce.shipping.domain.FulfillmentPricingItem
buildFulfillmentPricingItem
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem) protected com.broadleafcommerce.shipping.domain.FulfillmentPricingRequest
buildFulfillmentPricingRequest
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String fulfillmentGroupId) boolean
canCalculateFulfillmentPricing
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Indicate whether the cart contains the information required to calculate fulfillment pricing.protected com.broadleafcommerce.cart.client.domain.CartItem
getCartItemForFulfillmentItem
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentItem fi) protected CartOperationServiceProperties
protected com.fasterxml.jackson.databind.ObjectMapper
List<com.broadleafcommerce.shipping.domain.FulfillmentOptionPricedResponse>
getOptions
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String referenceNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) A list of all potential fulfillment options for the specified cart and fulfillment group.protected CartPricingRoundingHelper
protected com.broadleafcommerce.shipping.domain.ShippingAddress
getShippingAddress
(com.broadleafcommerce.order.common.domain.Address fgAddress) protected ShippingProvider
protected com.broadleafcommerce.common.extension.TypeFactory
protected void
prorateFulfillmentGroupAdjustments
(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull javax.money.CurrencyUnit currency) Deprecated, for removal: This API element is subject to removal in a future version.since 1.7.2, adjustment prorations are now done in OfferServicesvoid
prorateFulfillmentGroupsAdjustments
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Deprecated, for removal: This API element is subject to removal in a future version.since 1.7.2, adjustment prorations are now done in OfferServicesvoid
setRoundingHelper
(CartPricingRoundingHelper roundingHelper) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.cartoperation.service.pricing.FulfillmentPricingService
applyFulfillmentPricing, getOptions
-
Constructor Details
-
DefaultFulfillmentPricingService
public DefaultFulfillmentPricingService(com.fasterxml.jackson.databind.ObjectMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, CartOperationServiceProperties cartOperationServiceProperties, ShippingProvider shippingProvider)
-
-
Method Details
-
setRoundingHelper
-
applyFulfillmentPricing
public void applyFulfillmentPricing(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CommonFulfillmentPricingService
Applies fulfillment pricing to the appropriate cart objects and fields.- Specified by:
applyFulfillmentPricing
in interfaceCommonFulfillmentPricingService
- Parameters:
cart
- The cart to apply fulfillment pricing against.contextInfo
- Context information for sandbox and multitenant state.
-
canCalculateFulfillmentPricing
public boolean canCalculateFulfillmentPricing(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Description copied from interface:CommonFulfillmentPricingService
Indicate whether the cart contains the information required to calculate fulfillment pricing.- Specified by:
canCalculateFulfillmentPricing
in interfaceCommonFulfillmentPricingService
- Parameters:
cart
- The cart to evaluate whether it contains the necessary information to calculate fulfillment pricing.- Returns:
- True if this instance can calculate fulfillment pricing for the given cart. False otherwise.
-
getOptions
public List<com.broadleafcommerce.shipping.domain.FulfillmentOptionPricedResponse> getOptions(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String referenceNumber, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FulfillmentPricingService
A list of all potential fulfillment options for the specified cart and fulfillment group.- Specified by:
getOptions
in interfaceFulfillmentPricingService
- Parameters:
cart
- The cart to determine which fulfillment options can be chosen.referenceNumber
- The id of the fulfillment group we are retrieving options for.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- A list of all potential fulfillment options for the specified cart and fulfillment group.
-
prorateFulfillmentGroupsAdjustments
@Deprecated(since="1.7.2", forRemoval=true) public void prorateFulfillmentGroupsAdjustments(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart) Deprecated, for removal: This API element is subject to removal in a future version.since 1.7.2, adjustment prorations are now done in OfferServicesProrates theFulfillmentGroup
level adjustments down to the items for the entire cart. This is useful for downstream services for calculating partial captures and refunds.- Specified by:
prorateFulfillmentGroupsAdjustments
in interfaceFulfillmentPricingService
- Parameters:
cart
- The parent cart
-
prorateFulfillmentGroupAdjustments
@Deprecated(since="1.7.2", forRemoval=true) protected void prorateFulfillmentGroupAdjustments(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup group, @NonNull @NonNull javax.money.CurrencyUnit currency) Deprecated, for removal: This API element is subject to removal in a future version.since 1.7.2, adjustment prorations are now done in OfferServicesProrates theFulfillmentGroup
level adjustments down to the items. This is useful for downstream services for calculating partial captures and refunds.- Parameters:
group
- The group with adjustments to proratecurrency
- The cart's currency
-
applyFulfillmentPricingForGroup
@Deprecated(since="1.8.0", forRemoval=true) protected void applyFulfillmentPricingForGroup(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) Deprecated, for removal: This API element is subject to removal in a future version.since 1.8.0, in favor ofapplyFulfillmentPricingForGroup(Cart, FulfillmentGroup, ContextInfo)
-
applyFulfillmentPricingForGroup
protected void applyFulfillmentPricingForGroup(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Sends a pricing request to the ShippingService that can calculate the cost for theFulfillmentGroup.getFulfillmentOption()
and sets the group's pricing fields based on the response.- Parameters:
cart
- TheCart
that owns thefulfillmentGroup
fulfillmentGroup
- TheFulfillmentGroup
to be pricedcontextInfo
- Context information around sandbox and multitenant state.
-
buildFulfillmentPricingRequest
protected com.broadleafcommerce.shipping.domain.FulfillmentPricingRequest buildFulfillmentPricingRequest(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String fulfillmentGroupId) -
buildFulfillmentPricingItem
protected com.broadleafcommerce.shipping.domain.FulfillmentPricingItem buildFulfillmentPricingItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem) -
applyProductVariantAttributes
protected void applyProductVariantAttributes(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, @NonNull @NonNull com.broadleafcommerce.shipping.domain.FulfillmentPricingItem fulfillmentPricingItem, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) -
getCartItemForFulfillmentItem
protected com.broadleafcommerce.cart.client.domain.CartItem getCartItemForFulfillmentItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentItem fi) -
getShippingAddress
@Nullable protected com.broadleafcommerce.shipping.domain.ShippingAddress getShippingAddress(@Nullable com.broadleafcommerce.order.common.domain.Address fgAddress) -
getMapper
protected com.fasterxml.jackson.databind.ObjectMapper getMapper() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getCartOperationServiceProperties
-
getShippingProvider
-
getRoundingHelper
-
applyFulfillmentPricingForGroup(Cart, FulfillmentGroup, ContextInfo)