Class DefaultCsrCartOperationService
java.lang.Object
com.broadleafcommerce.cartoperation.service.csr.DefaultCsrCartOperationService
- All Implemented Interfaces:
CsrCartOperationService
-
Constructor Summary
ConstructorDescriptionDefaultCsrCartOperationService
(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 TypeMethodDescriptionprotected String
buildGroupReferenceNumber
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId) Builds aFulfillmentGroup.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
protected CartOperationService
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 PaymentProvider<PaymentSummary>
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.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) Deprecated.
-
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 interfaceCsrCartOperationService
- 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 updatingcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The cart with the updated item.
-
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 ofcartItemId
- 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 interfaceCsrCartOperationService
- 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 updatingcontextInfo
- 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'sID
and the index of the group inCart.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 groupfulfillmentGroupId
- The ID for the fulfillment group to find. Usually defaults to the index of the group inCart.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 interfaceCsrCartOperationService
- Parameters:
csrCart
- The CSR-owned cart which will be replaced by the cloned cartcontextInfo
- 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 interfaceCsrCartOperationService
- Parameters:
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.- 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 interfaceCsrCartOperationService
- Parameters:
csrCart
- the cart to cancelcontextInfo
- 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 interfaceCsrCartOperationService
- Parameters:
cart
- The original cart which will be clonedstatus
- The new status for the cloned cartcontextInfo
- 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 aFulfillmentGroup.getReferenceNumber()
for the given cart and group ID.- Parameters:
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 inCart.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
-
updatePaymentManagementStatuses
@Deprecated protected void updatePaymentManagementStatuses(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated. -
getCartOperationService
-
getCartProvider
-
getAuthenticationUtils
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils() -
getPaymentProvider
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
PaymentProvider.transferPaymentsToCSR(String, Map, ContextInfo)