Class DefaultCsrCartOperationService

java.lang.Object
com.broadleafcommerce.cartoperation.service.csr.DefaultCsrCartOperationService
All Implemented Interfaces:
CsrCartOperationService

public class DefaultCsrCartOperationService extends Object implements CsrCartOperationService
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultCsrCartOperationService(CartOperationService cartOperationService, CartProvider cartProvider, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, PaymentProvider<PaymentSummary> paymentProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.broadleafcommerce.cart.client.domain.CartActionAudit
    buildActionAuditForQuote(@NonNull com.broadleafcommerce.cart.client.domain.Cart quote, @NonNull com.broadleafcommerce.order.common.domain.OverrideDetail overrideDetail)
    Builds a CartActionAudit for DefaultCartTypes.QUOTE cart.
    protected String
    buildGroupReferenceNumber(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId)
    Builds a FulfillmentGroup.getReferenceNumber() for the given cart and group ID.
    buildUpdateCartRequest(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.OverrideDetail overrideDetail, boolean allowPriceCart, boolean wasCartModified, boolean invalidatePrices)
    Builds a UpdateCartRequest for the given price override.
    void
    cancelCSRCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart csrCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Cancels the provided CSR cart.
    com.broadleafcommerce.cart.client.domain.Cart
    cloneCartIntoStatus(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.enums.CartStatus status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Clone the given cart into a new cart with the given status.
    com.broadleafcommerce.cart.client.domain.Cart
    cloneCsrCartFromInProcess(@NonNull com.broadleafcommerce.cart.client.domain.Cart cartToClone, com.broadleafcommerce.cart.client.domain.Cart csrCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Clone the customer's in-process cart into a new csr-owned cart.
    com.broadleafcommerce.cart.client.domain.Cart
    cloneCsrCartFromInProcess(com.broadleafcommerce.cart.client.domain.Cart csrCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Clone the customer's in-process cart into a new csr-owned cart.
    protected com.broadleafcommerce.cart.client.domain.Cart
    createCloneCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart originalCart, com.broadleafcommerce.cart.client.domain.enums.CartStatus status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils
     
     
    protected CartProvider
     
    protected Supplier<com.broadleafcommerce.cart.client.domain.FulfillmentGroup>
    getFulfillmentGroupById(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId)
    Gets the fulfillment group by the provided ID.
     
    protected com.broadleafcommerce.cart.client.domain.CartItem
    getRequiredCartItem(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String cartItemId)
    Gets a cart item from the cart by its ID.
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    com.broadleafcommerce.cart.client.domain.Cart
    overrideCartItemPrice(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String cartItemId, @NonNull OverridePriceRequest overridePrice, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Override the unit price on the cart item.
    com.broadleafcommerce.cart.client.domain.Cart
    overrideFulfillmentGroupPrice(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId, @NonNull OverridePriceRequest overridePrice, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Override the total fulfillment price on the fulfillment group.
    protected Map<String,String>
    retrieveClonedItemIdsMap(@NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart)
     
    protected void
    setupCartForClone(@NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart, com.broadleafcommerce.cart.client.domain.enums.CartStatus cartStatus)
     
    protected void
    updateCloneCartFulfillmentGroupRefs(@NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart)
     
    protected void
    updateCloneCartFulfillmentItemReferenceNumbers(@NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart)
     
    protected void
    updateClonedCartItemIdsInFulfillmentGroupItems(com.broadleafcommerce.cart.client.domain.Cart cloneCart)
     
    protected void
    updatePaymentManagementStatuses(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultCsrCartOperationService

      public DefaultCsrCartOperationService(CartOperationService cartOperationService, CartProvider cartProvider, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, PaymentProvider<PaymentSummary> paymentProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • overrideCartItemPrice

      public com.broadleafcommerce.cart.client.domain.Cart overrideCartItemPrice(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String cartItemId, @NonNull @NonNull OverridePriceRequest overridePrice, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CsrCartOperationService
      Override the unit price on the cart item.
      Specified by:
      overrideCartItemPrice in interface CsrCartOperationService
      Parameters:
      cart - The id of the cart on which to perform the operation.
      cartItemId - The id of the cart item on which to perform the operation.
      overridePrice - The override price to set as the unit price on the cart item.
      allowPriceCart - Whether to allow the cart to be priced after updating
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart with the updated item.
    • buildUpdateCartRequest

      protected UpdateCartRequest buildUpdateCartRequest(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.OverrideDetail overrideDetail, boolean allowPriceCart, boolean wasCartModified, boolean invalidatePrices)
      Builds a UpdateCartRequest for the given price override.
      Parameters:
      cart - the Cart that was updated
      overrideDetail - the OverrideDetail for the price override
      allowPriceCart - whether to allow the cart to be priced after updating
      wasCartModified - whether the cart was modified
      invalidatePrices - whether to invalidate prices on the cart if changes were made
      Returns:
      a UpdateCartRequest for the given price override
    • buildActionAuditForQuote

      protected com.broadleafcommerce.cart.client.domain.CartActionAudit buildActionAuditForQuote(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart quote, @NonNull @NonNull com.broadleafcommerce.order.common.domain.OverrideDetail overrideDetail)
      Builds a CartActionAudit for DefaultCartTypes.QUOTE cart.
      Parameters:
      quote - the quote to build the audit for
      overrideDetail - the OverrideDetail for the price override
      Returns:
      a CartActionAudit for DefaultCartTypes.QUOTE cart
    • getRequiredCartItem

      protected com.broadleafcommerce.cart.client.domain.CartItem getRequiredCartItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String cartItemId)
      Gets a cart item from the cart by its ID. Throws an error if the item could not be found.
      Parameters:
      cart - the cart to search the items of
      cartItemId - the item ID to look for
      Returns:
      the item with the given cart ID
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - when no item with the ID exists in the cart
    • overrideFulfillmentGroupPrice

      public com.broadleafcommerce.cart.client.domain.Cart overrideFulfillmentGroupPrice(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId, @NonNull @NonNull OverridePriceRequest overridePrice, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CsrCartOperationService
      Override the total fulfillment price on the fulfillment group.
      Specified by:
      overrideFulfillmentGroupPrice in interface CsrCartOperationService
      Parameters:
      cart - The id of the cart on which to perform the operation.
      fulfillmentGroupId - The id of the fulfillment group on which to perform the operation.
      overridePrice - The override price to set as the total fulfillment price.
      allowPriceCart - Whether to allow the cart to be priced after updating
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart with the updated fulfillment group.
    • getFulfillmentGroupById

      protected Supplier<com.broadleafcommerce.cart.client.domain.FulfillmentGroup> getFulfillmentGroupById(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId)
      Gets the fulfillment group by the provided ID. By default this will be the owning Cart's ID and the index of the group in Cart.getFulfillmentGroups(). You can simply provide the index for the fulfillment group to perform the operation.

      Example: Cart has id "12345", so the first fulfillment group has id "12345-0". If you want to find the fulfillment group, you can provide "0" to this method along with the cart to get it.

      Parameters:
      cart - The cart on which to find the fulfillment group
      fulfillmentGroupId - The ID for the fulfillment group to find. Usually defaults to the index of the group in Cart.getFulfillmentGroups().
      Returns:
      The corresponding FulfillmentGroup for the given cart and relative number.
    • cloneCsrCartFromInProcess

      public com.broadleafcommerce.cart.client.domain.Cart cloneCsrCartFromInProcess(@Nullable com.broadleafcommerce.cart.client.domain.Cart csrCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CsrCartOperationService
      Clone the customer's in-process cart into a new csr-owned cart.
      Specified by:
      cloneCsrCartFromInProcess in interface CsrCartOperationService
      Parameters:
      csrCart - The CSR-owned cart which will be replaced by the cloned cart
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The CSR-owned clone of the customer's in-process cart
    • cloneCsrCartFromInProcess

      public com.broadleafcommerce.cart.client.domain.Cart cloneCsrCartFromInProcess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cartToClone, @Nullable com.broadleafcommerce.cart.client.domain.Cart csrCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CsrCartOperationService
      Clone the customer's in-process cart into a new csr-owned cart.
      Specified by:
      cloneCsrCartFromInProcess in interface CsrCartOperationService
      Parameters:
      cartToClone - the in-process cart to clone
      csrCart - the CSR-owned cart which will be replaced by the cloned cart
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The CSR-owned clone of the customer's in-process cart
    • cancelCSRCart

      public void cancelCSRCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart csrCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CsrCartOperationService
      Cancels the provided CSR cart.
      Specified by:
      cancelCSRCart in interface CsrCartOperationService
      Parameters:
      csrCart - the cart to cancel
      contextInfo - the contxt info
    • cloneCartIntoStatus

      public com.broadleafcommerce.cart.client.domain.Cart cloneCartIntoStatus(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.enums.CartStatus status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CsrCartOperationService
      Clone the given cart into a new cart with the given status.
      Specified by:
      cloneCartIntoStatus in interface CsrCartOperationService
      Parameters:
      cart - The original cart which will be cloned
      status - The new status for the cloned cart
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The newly cloned cart
    • createCloneCart

      protected com.broadleafcommerce.cart.client.domain.Cart createCloneCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart originalCart, com.broadleafcommerce.cart.client.domain.enums.CartStatus status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • setupCartForClone

      protected void setupCartForClone(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart, com.broadleafcommerce.cart.client.domain.enums.CartStatus cartStatus)
    • updateCloneCartFulfillmentGroupRefs

      protected void updateCloneCartFulfillmentGroupRefs(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart)
    • buildGroupReferenceNumber

      protected String buildGroupReferenceNumber(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId)
      Builds a FulfillmentGroup.getReferenceNumber() for the given cart and group ID.
      Parameters:
      cart - Cart that owns the group
      fulfillmentGroupId - ID of the fulfillment group for which to build a reference number. Usually defaults to the index of the group in Cart.getFulfillmentGroups().
      Returns:
      The new reference number
    • updateCloneCartFulfillmentItemReferenceNumbers

      protected void updateCloneCartFulfillmentItemReferenceNumbers(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart)
    • updateClonedCartItemIdsInFulfillmentGroupItems

      protected void updateClonedCartItemIdsInFulfillmentGroupItems(com.broadleafcommerce.cart.client.domain.Cart cloneCart)
    • retrieveClonedItemIdsMap

      protected Map<String,String> retrieveClonedItemIdsMap(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart)
    • updatePaymentManagementStatuses

      @Deprecated protected void updatePaymentManagementStatuses(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getCartOperationService

      protected CartOperationService getCartOperationService()
    • getCartProvider

      protected CartProvider getCartProvider()
    • getAuthenticationUtils

      protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()
    • getPaymentProvider

      protected PaymentProvider<PaymentSummary> getPaymentProvider()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()