public class DefaultCsrCartOperationService extends Object implements CsrCartOperationService
Constructor and Description |
---|
DefaultCsrCartOperationService(CartOperationService cartOperationService,
CartProvider cartProvider,
com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils,
com.broadleafcommerce.common.extension.TypeFactory typeFactory) |
Modifier and Type | Method and Description |
---|---|
protected String |
buildGroupReferenceNumber(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
String fulfillmentGroupId)
Builds a
FulfillmentGroup.getReferenceNumber() for the given cart and group ID. |
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 |
getAuthenticationUtils() |
protected CartOperationService |
getCartOperationService() |
protected CartProvider |
getCartProvider() |
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 |
getTypeFactory() |
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) |
public DefaultCsrCartOperationService(CartOperationService cartOperationService, CartProvider cartProvider, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
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)
CsrCartOperationService
overrideCartItemPrice
in interface CsrCartOperationService
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 updatingcontextInfo
- Context information around sandbox and multitenant state.protected com.broadleafcommerce.cart.client.domain.CartItem getRequiredCartItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String cartItemId)
cart
- the cart to search the items ofcartItemId
- the item ID to look forcom.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- when no item with the ID exists in the cartpublic 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)
CsrCartOperationService
overrideFulfillmentGroupPrice
in interface CsrCartOperationService
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 updatingcontextInfo
- Context information around sandbox and multitenant state.protected Supplier<com.broadleafcommerce.cart.client.domain.FulfillmentGroup> getFulfillmentGroupById(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId)
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.
cart
- The cart on which to find the fulfillment groupfulfillmentGroupId
- The ID for the fulfillment group to find. Usually defaults to the
index of the group in Cart.getFulfillmentGroups()
.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)
CsrCartOperationService
cloneCsrCartFromInProcess
in interface CsrCartOperationService
csrCart
- The CSR-owned cart which will be replaced by the cloned cartcontextInfo
- Context information around sandbox and multitenant state.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)
CsrCartOperationService
cloneCsrCartFromInProcess
in interface CsrCartOperationService
cartToClone
- the in-process cart to clonecsrCart
- the CSR-owned cart which will be replaced by the cloned cartcontextInfo
- Context information around sandbox and multitenant state.public void cancelCSRCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart csrCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CsrCartOperationService
cancelCSRCart
in interface CsrCartOperationService
csrCart
- the cart to cancelcontextInfo
- the contxt infopublic 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)
CsrCartOperationService
cloneCartIntoStatus
in interface CsrCartOperationService
cart
- The original cart which will be clonedstatus
- The new status for the cloned cartcontextInfo
- Context information around sandbox and multitenant state.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)
protected void setupCartForClone(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart, com.broadleafcommerce.cart.client.domain.enums.CartStatus cartStatus)
protected void updateCloneCartFulfillmentGroupRefs(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart)
protected String buildGroupReferenceNumber(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId)
FulfillmentGroup.getReferenceNumber()
for the given cart and group ID.cart
- Cart that owns the groupfulfillmentGroupId
- ID of the fulfillment group for which to build a reference number.
Usually defaults to the index of the group in Cart.getFulfillmentGroups()
.protected void updateCloneCartFulfillmentItemReferenceNumbers(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart)
protected void updateClonedCartItemIdsInFulfillmentGroupItems(com.broadleafcommerce.cart.client.domain.Cart cloneCart)
protected Map<String,String> retrieveClonedItemIdsMap(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cloneCart)
protected CartOperationService getCartOperationService()
protected CartProvider getCartProvider()
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
Copyright © 2021. All rights reserved.