Class DefaultFulfillmentPricingService

    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void applyFulfillmentPricing​(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Service for calculating and applying fulfillment pricing to a Cart, typically by integrating with Shipping Services.
      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 the FulfillmentGroup.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)
      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 getCartOperationServiceProperties()  
      protected com.fasterxml.jackson.databind.ObjectMapper getMapper()  
      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 getRoundingHelper()  
      protected com.broadleafcommerce.shipping.domain.ShippingAddress getShippingAddress​(com.broadleafcommerce.order.common.domain.Address fgAddress)  
      protected ShippingProvider getShippingProvider()  
      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()  
      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 OfferServices
      void 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 OfferServices
      void setRoundingHelper​(CartPricingRoundingHelper roundingHelper)  
    • Constructor Detail

      • DefaultFulfillmentPricingService

        public DefaultFulfillmentPricingService​(com.fasterxml.jackson.databind.ObjectMapper mapper,
                                                com.broadleafcommerce.common.extension.TypeFactory typeFactory,
                                                CartOperationServiceProperties cartOperationServiceProperties,
                                                ShippingProvider shippingProvider)
    • Method Detail

      • 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: FulfillmentPricingService
        Service for calculating and applying fulfillment pricing to a Cart, typically by integrating with Shipping Services. Options are expected to be unique across all providers, once a provider is found that can handle an option, it will be the one used for calculation.
        Specified by:
        applyFulfillmentPricing in interface FulfillmentPricingService
        Parameters:
        cart - The cart to apply fulfillment pricing against.
        contextInfo - Context information around sandbox and multitenant state.
      • canCalculateFulfillmentPricing

        public boolean canCalculateFulfillmentPricing​(@NonNull
                                                      @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
        Description copied from interface: FulfillmentPricingService
        Whether the cart contains the information required to calculate fulfillment pricing.
        Specified by:
        canCalculateFulfillmentPricing in interface FulfillmentPricingService
        Parameters:
        cart - The cart to determine whether fulfillment pricing can be calculated for.
        Returns:
        Whether the cart contains the information required to calculate fulfillment pricing.
      • 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 interface FulfillmentPricingService
        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 OfferServices
        Prorates the FulfillmentGroup 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 interface FulfillmentPricingService
        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 OfferServices
        Prorates the FulfillmentGroup 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 prorate
        currency - 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.
      • 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 the FulfillmentGroup.getFulfillmentOption() and sets the group's pricing fields based on the response.
        Parameters:
        cart - The Cart that owns the fulfillmentGroup
        fulfillmentGroup - The FulfillmentGroup to be priced
        contextInfo - 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()