Interface CartOperationService
- All Known Implementing Classes:
DefaultCartOperationService
- Author:
- Chad Harchar (charchar), Nick Crum (ncrum)
-
Method Summary
Modifier and TypeMethodDescriptioncom.broadleafcommerce.cart.client.domain.Cart
addAttributeToCart
(com.broadleafcommerce.cart.client.domain.Cart cart, AddAttributeRequest addAttributeRequest, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds an attribute to the providedCart
.addCodeToCart
(com.broadleafcommerce.cart.client.domain.Cart cart, AddCodeRequest codeRequest, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.com.broadleafcommerce.cart.client.domain.Cart
addItemToCart
(com.broadleafcommerce.cart.client.domain.Cart cart, AddItemRequest addItemRequest, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds a single item to the providedCart
based on the providedAddItemRequest
.addManyItemsToCart
(com.broadleafcommerce.cart.client.domain.Cart cart, Collection<AddItemRequest> addItemRequests, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds one or more items to the providedCart
.addOfferCodeToCart
(com.broadleafcommerce.cart.client.domain.Cart cart, AddCodeRequest addOfferCodeRequest, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds an offer code to the providedCart
.com.broadleafcommerce.cart.client.domain.Cart
addToCart
(AddItemRequest addItemRequest, com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.order.common.domain.CustomerRef customerRef, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.useaddItemToCart(Cart, AddItemRequest, boolean, ContextInfo)
for updates andcreateCart(CartCreationRequest, CustomerRef, ContextInfo)
for createsbulkAddToCart
(Collection<AddItemRequest> addItemRequests, com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.order.common.domain.CustomerRef customerRef, boolean shouldPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.com.broadleafcommerce.cart.client.domain.Cart
bulkUpdateFulfillmentGroupsInCart
(com.broadleafcommerce.cart.client.domain.Cart cart, List<UpdateFulfillmentGroupRequest> updateFulfillmentGroupsRequests, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates an existingFulfillmentGroups
for the providedCart
.com.broadleafcommerce.cart.client.domain.Cart
createCart
(CartCreationRequest cartCreationRequest, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) default com.broadleafcommerce.cart.client.domain.Cart
priceCart
(com.broadleafcommerce.cart.client.domain.Cart cart, boolean saveCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Prices cart, processes free gift offers, and saves cart ifsaveCart
is true.default com.broadleafcommerce.cart.client.domain.Cart
priceCart
(com.broadleafcommerce.cart.client.domain.Cart cart, boolean saveCart, Map<String, String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Prices cart, processes free gift offers, and saves cart ifsaveCart
is true.default com.broadleafcommerce.cart.client.domain.Cart
priceCart
(com.broadleafcommerce.cart.client.domain.Cart cart, PriceCartRequest priceCartRequest, boolean saveCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Prices cart, processes free gift offers, and saves cart with the providedPriceCartRequest
ifsaveCart
is true.com.broadleafcommerce.cart.client.domain.Cart
priceCart
(com.broadleafcommerce.cart.client.domain.Cart cart, PriceCartRequest priceCartRequest, boolean saveCart, Map<String, String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Prices cart, processes free gift offers, and saves cart with the providedPriceCartRequest
ifsaveCart
is true.com.broadleafcommerce.cart.client.domain.Cart
priceCart
(com.broadleafcommerce.cart.client.domain.Cart cart, PriceCartRequest priceCartRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.since 1.6, in favor ofpriceCart(Cart, PriceCartRequest, boolean, ContextInfo)
default com.broadleafcommerce.cart.client.domain.Cart
priceCart
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.since 1.6, in favor ofpriceCart(Cart, boolean, ContextInfo)
com.broadleafcommerce.cart.client.domain.Cart
priceCartWithCatalogPriceUpdates
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reprice the cart, including applying the latest catalog-based prices for each of its itemsreallocateCartTotalAmongstPayments
(javax.money.MonetaryAmount newCartTotal, List<PaymentSummary> paymentSummaries, Map<String, String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reallocate the cart total among the cart's paymentscom.broadleafcommerce.cart.client.domain.Cart
recalculateTaxesForCart
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, boolean estimated, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Recalculates the taxes for the providedCart
.com.broadleafcommerce.cart.client.domain.Cart
recalculateTaxesForCart
(com.broadleafcommerce.cart.client.domain.Cart cart, boolean estimated, boolean actual, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.com.broadleafcommerce.cart.client.domain.Cart
releasePaymentFinalizationLock
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) For carts in theDefaultCartStatuses.AWAITING_PAYMENT_FINALIZATION
status, this method updates the cart status toDefaultCartStatuses.IN_PROCESS
allowing the customer to once again edit the cart.com.broadleafcommerce.cart.client.domain.Cart
removeAttributeFromCart
(com.broadleafcommerce.cart.client.domain.Cart cart, String key, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes an attribute to the providedCart
.com.broadleafcommerce.cart.client.domain.Cart
removeCartItems
(com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.com.broadleafcommerce.cart.client.domain.Cart
removeItemFromCart
(com.broadleafcommerce.cart.client.domain.Cart cart, String cartItemId, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes a single item from the providedCart
matching the provided cart item ID.default com.broadleafcommerce.cart.client.domain.Cart
removeManyItemsFromCart
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean price, boolean updateCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes one or more items from the providedCart
matching the provided cart item IDs.com.broadleafcommerce.cart.client.domain.Cart
removeManyItemsFromCart
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean price, boolean updateCart, Map<String, String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes one or more items from the providedCart
matching the provided cart item IDs.default com.broadleafcommerce.cart.client.domain.Cart
removeManyItemsFromCart
(com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes one or more items from the providedCart
matching the provided cart item IDs.com.broadleafcommerce.cart.client.domain.Cart
removeOfferAndCampaignCodesFromCart
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, List<String> codes, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes the provided offer and campaign codes from the cart and then updates the cart.com.broadleafcommerce.cart.client.domain.Cart
removeOfferCodeFromCart
(com.broadleafcommerce.cart.client.domain.Cart cart, String offerCode, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes an offer code from the providedCart
, if it exists.Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveCartByCartId
(ResolveCartRequest resolveCartRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve the cart for the provided id, using the given request data.Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveCartByCartId
(String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve the cart for the provided id.Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveCartByStatus
(String customerId, String accountId, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves a customer or account cart with the provided customer ID, account ID, and status, if it exists.Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveCartByStatusAndName
(String customerId, String status, String name, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves a customer or account cart with the provided customer ID, account ID, and status, if it exists.Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveCsrCartByCartId
(String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveCsrOwnedCartByCustomerIdAndApplicationId
(String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.default Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveCustomerCartByStatus
(String customerId, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.since 1.8.0, in favor ofretrieveCartByStatus(String, String, String, ContextInfo)
default Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveImplicitCart
(String customerId, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Resolves the implicit cart for the given customer id and account id.Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveImplicitCart
(String customerId, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, boolean allowRepriceDueToStaleCartPrices) Resolves the implicit cart for the given customer id and account id.Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveInProcessCartByCartId
(String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.in favor ofretrieveCartByCartId(String, ContextInfo)
Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveInProcessCartByCustomerIdAndApplicationId
(String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.org.springframework.data.domain.Page<com.broadleafcommerce.cart.client.domain.Cart>
retrieveMyCarts
(com.broadleafcommerce.order.common.domain.CustomerRef customer, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieves all of a customer's carts that have not been locked, archived, or submitted.Optional<com.broadleafcommerce.cart.client.domain.Cart>
retrieveTestCartByCartId
(String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.in favor ofretrieveCartByCartId(String, ContextInfo)
com.broadleafcommerce.cart.client.domain.Cart
updateAsNamedCart
(com.broadleafcommerce.cart.client.domain.Cart cart, String name, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates the providedCart
with the given name.default com.broadleafcommerce.cart.client.domain.Cart
updateCart
(com.broadleafcommerce.cart.client.domain.Cart cart, boolean allowPriceCart, boolean wasCartModified, boolean invalidatePrices, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates the providedCart
based on the provided flags.com.broadleafcommerce.cart.client.domain.Cart
updateCart
(com.broadleafcommerce.cart.client.domain.Cart cart, boolean allowPriceCart, boolean wasCartModified, boolean invalidatePrices, Map<String, String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates the providedCart
based on the provided flags.com.broadleafcommerce.cart.client.domain.Cart
updateCart
(UpdateCartRequest updateCartRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates the providedCart
based on the providedUpdateCartRequest
.com.broadleafcommerce.cart.client.domain.Cart
updateCartContactInfo
(com.broadleafcommerce.cart.client.domain.Cart cart, ContactInfoRequest contactInfoRequest, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.com.broadleafcommerce.cart.client.domain.Cart
updateCartInfo
(com.broadleafcommerce.cart.client.domain.Cart cart, UpdateCartInfoRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates basic info on the cart like its name or, if a quote, its expiration date.com.broadleafcommerce.cart.client.domain.Cart
updateCartItem
(com.broadleafcommerce.cart.client.domain.Cart cart, UpdateItemRequest updateItemRequest, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.com.broadleafcommerce.cart.client.domain.Cart
updateCartStatus
(com.broadleafcommerce.cart.client.domain.Cart cart, UpdateCartStatusRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.com.broadleafcommerce.cart.client.domain.Cart
updateCartStatus
(com.broadleafcommerce.cart.client.domain.Cart cart, UpdateCartStatusRequest request, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates thecart's status
.com.broadleafcommerce.cart.client.domain.Cart
updateContactInfoInCart
(com.broadleafcommerce.cart.client.domain.Cart cart, ContactInfoRequest contactInfoRequest, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates the contact info for the providedCart
.com.broadleafcommerce.cart.client.domain.Cart
updateFulfillmentGroup
(com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId, UpdateFulfillmentGroupRequest fulfillmentGroupRequest, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.default com.broadleafcommerce.cart.client.domain.Cart
updateFulfillmentGroupInCart
(com.broadleafcommerce.cart.client.domain.Cart cart, String referenceNumber, UpdateFulfillmentGroupRequest updateFulfillmentGroupRequest, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates an existingFulfillmentGroup
for the providedCart
.com.broadleafcommerce.cart.client.domain.Cart
updateItemInCart
(com.broadleafcommerce.cart.client.domain.Cart cart, UpdateItemRequest updateItemRequest, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates a single item in the providedCart
based on the providedUpdateItemRequest
.
-
Method Details
-
retrieveMyCarts
org.springframework.data.domain.Page<com.broadleafcommerce.cart.client.domain.Cart> retrieveMyCarts(com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieves all of a customer's carts that have not been locked, archived, or submitted.- Parameters:
customer
- The customer who owns the cartsfilters
- Additional RSQL filterspage
- Pagination paramscontext
- Additional sandbox and multitenant info- Returns:
- All of a customer's carts that have not been locked, archived, or submitted.
-
retrieveImplicitCart
default Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveImplicitCart(String customerId, @Nullable String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Resolves the implicit cart for the given customer id and account id. This method will always reprice the cart to avoid stale prices. To avoid repricing the cart, useretrieveImplicitCart(String, String, ContextInfo, boolean)
Out of the box, a default/implicit cart means an
DefaultCartStatuses.IN_PROCESS
withnull
name, and there should only be one default/implicit cart per user.- Parameters:
customerId
- the customer IDaccountId
- the id of the account that theCart
belong to, null can be passed in to retrieve customerCart
contextInfo
- the context info- Returns:
- the registered customer's implicit cart
-
retrieveImplicitCart
Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveImplicitCart(String customerId, @Nullable String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, boolean allowRepriceDueToStaleCartPrices) Resolves the implicit cart for the given customer id and account id.Out of the box, a default/implicit cart means an
DefaultCartStatuses.IN_PROCESS
withnull
name, and there should only be one default/implicit cart per user. By default,allowRepriceDueToStaleCartPrices
is true since we want to reprice the cart. Only for the creation of a net new cart, it is set asfalse
- Parameters:
customerId
- the customer IDaccountId
- the id of the account that theCart
belong to, null can be passed in to retrieve customerCart
contextInfo
- the context infoallowRepriceDueToStaleCartPrices
- declares if repricing due to stale cart prices should be considered or skipped entirely- Returns:
- the registered customer's implicit cart
-
retrieveCartByCartId
Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartByCartId(String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve the cart for the provided id.- Parameters:
cartId
- The id of the cart on which to perform the operation.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- The cart for the provided id.
-
retrieveCartByCartId
Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartByCartId(ResolveCartRequest resolveCartRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve the cart for the provided id, using the given request data.- Parameters:
resolveCartRequest
- The request specifying the id of the cart as well as additional data to perform the operation.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- The cart for the provided id.
-
retrieveCustomerCartByStatus
@Deprecated(since="1.8.0", forRemoval=true) default Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCustomerCartByStatus(String customerId, String status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.since 1.8.0, in favor ofretrieveCartByStatus(String, String, String, ContextInfo)
Convenient method to retrieve a cart with the provided customer ID and status, if it exists- Parameters:
customerId
- the customer IDstatus
- the statuscontextInfo
- the context info- Returns:
- the cart, if it exists
-
retrieveCartByStatus
Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartByStatus(String customerId, @Nullable String accountId, String status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves a customer or account cart with the provided customer ID, account ID, and status, if it exists. Customer cart will automatically be retrieved if the givenaccountId
is null.- Parameters:
customerId
- the customer IDaccountId
- the id of the account that theCart
belong to, null can be passed in to retrieve customerCart
status
- the statuscontextInfo
- the context info- Returns:
- the cart, if it exists
-
retrieveCartByStatusAndName
Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartByStatusAndName(String customerId, String status, @Nullable String name, @Nullable String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves a customer or account cart with the provided customer ID, account ID, and status, if it exists. Customer cart will automatically be retrieved if the givenaccountId
is null.- Parameters:
customerId
- the customer IDstatus
- the statusname
- the name of the cart or null for a cart with no nameaccountId
- the id of the account that theCart
belong to, null can be passed in to retrieve customerCart
contextInfo
- the context info- Returns:
- the cart, if it exists
-
createCart
com.broadleafcommerce.cart.client.domain.Cart createCart(CartCreationRequest cartCreationRequest, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates a new, in-progressCart
for the providedCartCreationRequest
andCustomerRef
. TheCartCreationRequest
must containFor guest customers, this will create a new guest cart
- Parameters:
cartCreationRequest
- the cart creation requestcustomer
- the customercontextInfo
- the context info- Returns:
- the newly created cart
-
updateCart
default com.broadleafcommerce.cart.client.domain.Cart updateCart(com.broadleafcommerce.cart.client.domain.Cart cart, boolean allowPriceCart, boolean wasCartModified, boolean invalidatePrices, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates the providedCart
based on the provided flags.
If the cart was not modified (wasCartModified
), this will price and update the cart when the cart is not already priced (Cart.isPriced()
), regardless ofinvalidatePrices
. If the cart was not modified and the cart is already priced, this does nothing.
If the cart was modified, the cart will be priced if allowed (allowPriceCart
) and if not already already priced or if prices should be invalidated.
Note: It is intentional that no overloaded methods are provided with default values for these parameters. Callers must consider carefully whether their operation modifies the cart or requires price invalidation.- Parameters:
cart
- the cart to be updatedallowPriceCart
- whether the cart may be pricedwasCartModified
- whether the cart was actually modified by the callerinvalidatePrices
- whether to invalidate prices on the cart if changes were made- Returns:
- synced version of the cart with the cart service
-
updateCartInfo
com.broadleafcommerce.cart.client.domain.Cart updateCartInfo(com.broadleafcommerce.cart.client.domain.Cart cart, UpdateCartInfoRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates basic info on the cart like its name or, if a quote, its expiration date.- Parameters:
cart
- The cart to updaterequest
- Request datacontextInfo
- Additional sandbox and multitenant info- Returns:
- The updated cart.
- Throws:
CartValidationException
- when the user is not allowed to update the expiration date, only CSRs can.
-
updateCart
com.broadleafcommerce.cart.client.domain.Cart updateCart(com.broadleafcommerce.cart.client.domain.Cart cart, boolean allowPriceCart, boolean wasCartModified, boolean invalidatePrices, Map<String, String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates the providedCart
based on the provided flags.If the cart was not modified (
wasCartModified
), this will price and update the cart when the cart is not already priced (Cart.isPriced()
), regardless ofinvalidatePrices
. If the cart was not modified and the cart is already priced, this does nothing.If the cart was modified, the cart will be priced if allowed (
allowPriceCart
) and if not already already priced or if prices should be invalidated.Note: It is intentional that no overloaded methods are provided with default values for these parameters. Callers must consider carefully whether their operation modifies the cart or requires price invalidation.
- Parameters:
cart
- the cart to be updatedallowPriceCart
- whether the cart may be pricedwasCartModified
- whether the cart was actually modified by the callerinvalidatePrices
- whether to invalidate prices on the cart if changes were madepaymentLockTokens
- Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.- Returns:
- synced version of the cart with the cart service
- Throws:
CODPaymentMethodNotApplicableException
- When COD is selected but the update to be performed on the cart would invalidate its usage. This allows the user to change be alerted and change their mind before losing COD.
-
updateCart
com.broadleafcommerce.cart.client.domain.Cart updateCart(UpdateCartRequest updateCartRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates the providedCart
based on the providedUpdateCartRequest
.The update cart logic is the same as
updateCart(Cart, boolean, boolean, boolean, Map, ContextInfo)
under the hood.- Parameters:
updateCartRequest
- theUpdateCartRequest
containing the details about the cart update- Returns:
- synced version of the cart with the cart service
-
updateCartStatus
@Deprecated(since="2.1.0", forRemoval=true) com.broadleafcommerce.cart.client.domain.Cart updateCartStatus(com.broadleafcommerce.cart.client.domain.Cart cart, UpdateCartStatusRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.Updates thecart's status
.- Parameters:
cart
- The cart to updaterequest
- The status request with the status to update to, seeDefaultCartStatuses
.contextInfo
- Additional multitenant and sandbox info- Returns:
- The updated cart.
-
updateCartStatus
com.broadleafcommerce.cart.client.domain.Cart updateCartStatus(com.broadleafcommerce.cart.client.domain.Cart cart, UpdateCartStatusRequest request, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates thecart's status
.- Parameters:
cart
- The cart to updaterequest
- The status request with the status to update to, seeDefaultCartStatuses
customer
- TheCustomerRef
representing the currently authenticated usercontextInfo
- Additional multitenant and sandbox info- Returns:
- The updated cart.
-
updateAsNamedCart
com.broadleafcommerce.cart.client.domain.Cart updateAsNamedCart(com.broadleafcommerce.cart.client.domain.Cart cart, String name, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates the providedCart
with the given name. This method is often used when transferring or creating new carts for a registered customer who already has an implicit/default cart.Prior to 1.8.0, named carts are represented by the
DefaultCartStatuses.NAMED
. After 1.8.0, named carts simply mean a cart with a name. Named carts are different from the implicit/default cart, implicit/default cart areDefaultCartStatuses.IN_PROCESS
withnull
name, and there can be only one per user.- Parameters:
cart
- the cart to updatename
- the name for the cartcontextInfo
- the context info- Returns:
- the newly named cart
-
addItemToCart
com.broadleafcommerce.cart.client.domain.Cart addItemToCart(com.broadleafcommerce.cart.client.domain.Cart cart, AddItemRequest addItemRequest, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds a single item to the providedCart
based on the providedAddItemRequest
.- Parameters:
cart
- the cartaddItemRequest
- the request to add an itemprice
- whether or not to re-price the cartcontextInfo
- the context info- Returns:
- the cart with item added
-
updateItemInCart
com.broadleafcommerce.cart.client.domain.Cart updateItemInCart(com.broadleafcommerce.cart.client.domain.Cart cart, UpdateItemRequest updateItemRequest, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates a single item in the providedCart
based on the providedUpdateItemRequest
.- Parameters:
cart
- the cartupdateItemRequest
- the request to update an itemprice
- whether or not to re-price the cartcontextInfo
- the context info- Returns:
- the cart with item updated
-
removeItemFromCart
com.broadleafcommerce.cart.client.domain.Cart removeItemFromCart(com.broadleafcommerce.cart.client.domain.Cart cart, String cartItemId, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes a single item from the providedCart
matching the provided cart item ID.- Parameters:
cart
- the cartcartItemId
- the cart item IDprice
- whether or not to re-price the cartcontextInfo
- the context info- Returns:
- the cart without the provided item
-
addManyItemsToCart
BulkAddToCartResponse addManyItemsToCart(com.broadleafcommerce.cart.client.domain.Cart cart, Collection<AddItemRequest> addItemRequests, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds one or more items to the providedCart
.- Parameters:
cart
- the cartaddItemRequests
- the add item requestsprice
- whether or not to re-price the cartcontextInfo
- the context info- Returns:
- a response with the cart and any item failures
-
removeManyItemsFromCart
default com.broadleafcommerce.cart.client.domain.Cart removeManyItemsFromCart(com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes one or more items from the providedCart
matching the provided cart item IDs.- Parameters:
cart
- the cartcartItemIds
- the cart item IDsprice
- whether or not to re-price the cartcontextInfo
- the context info- Returns:
- the cart without the provided item
-
removeManyItemsFromCart
default com.broadleafcommerce.cart.client.domain.Cart removeManyItemsFromCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean price, boolean updateCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes one or more items from the providedCart
matching the provided cart item IDs.- Parameters:
cart
- the cartcartItemIds
- the cart item IDsprice
- whether or not to re-price the cartupdateCart
- whether or not to updateCart
pricing and save the cart after the removalcontextInfo
- the context info- Returns:
- the cart without the provided item
-
removeManyItemsFromCart
com.broadleafcommerce.cart.client.domain.Cart removeManyItemsFromCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean price, boolean updateCart, Map<String, String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes one or more items from the providedCart
matching the provided cart item IDs.- Parameters:
cart
- the cartcartItemIds
- the cart item IDsprice
- whether or not to re-price the cartupdateCart
- whether or not to updateCart
pricing and save the cart after the removalpaymentLockTokens
- Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.contextInfo
- the context info- Returns:
- the cart without the provided item
-
addOfferCodeToCart
AddCodeToCartResponse addOfferCodeToCart(com.broadleafcommerce.cart.client.domain.Cart cart, AddCodeRequest addOfferCodeRequest, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds an offer code to the providedCart
.- Determine if the code is valid as a campaign tracking code
- If so, add it to the cart as a
CampaignRef
- Determine if the code is valid as a shared code
- If so, add it to the cart
- Parameters:
cart
- the cartaddOfferCodeRequest
- the add offer code requestprice
- whether or not to re-price the cartcontextInfo
- the context info- Returns:
- An AddCodeToCartResponse describing the results of adding the offer code to the cart
- Throws:
AddCodeException
- if the code cannot be added for any reason. This is usually because the code is invalid or has already been used the maximum number of times.AddCodeException.getReasonType()
will typically match the code'sCodeUsabilityInfo.getCodeUsabilityType()
and can be used on the frontend to determine messaging.
-
removeOfferCodeFromCart
com.broadleafcommerce.cart.client.domain.Cart removeOfferCodeFromCart(com.broadleafcommerce.cart.client.domain.Cart cart, String offerCode, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes an offer code from the providedCart
, if it exists.- Determine if the code exists as a tracking code on the cart
- If so, remove the corresponding
CampaignRef
- Determine if the offer code exists on the cart
- If so, remove it
- Parameters:
cart
- cart cartofferCode
- the offer code to removeprice
- whether or not to re-price the cartcontextInfo
- the context info- Returns:
- the cart without the offer code
-
removeOfferAndCampaignCodesFromCart
com.broadleafcommerce.cart.client.domain.Cart removeOfferAndCampaignCodesFromCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, List<String> codes, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes the provided offer and campaign codes from the cart and then updates the cart.- Parameters:
cart
- The id of the cart on which to perform the operation.codes
- The codes to remove from the cart.allowPriceCart
- Whether to allow the cart to be priced after updatingcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The cart with the codes removed.
-
priceCart
default com.broadleafcommerce.cart.client.domain.Cart priceCart(com.broadleafcommerce.cart.client.domain.Cart cart, boolean saveCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Prices cart, processes free gift offers, and saves cart ifsaveCart
is true.- Parameters:
cart
- the cartsaveCart
- determines whether to save cart after pricingcontextInfo
- the context info- Returns:
- the priced cart
-
priceCart
default com.broadleafcommerce.cart.client.domain.Cart priceCart(com.broadleafcommerce.cart.client.domain.Cart cart, boolean saveCart, Map<String, String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Prices cart, processes free gift offers, and saves cart ifsaveCart
is true.- Parameters:
cart
- the cartsaveCart
- determines whether to save cart after pricingcontextInfo
- the context infopaymentLockTokens
- Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.- Returns:
- the priced cart
-
priceCart
default com.broadleafcommerce.cart.client.domain.Cart priceCart(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable PriceCartRequest priceCartRequest, boolean saveCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Prices cart, processes free gift offers, and saves cart with the providedPriceCartRequest
ifsaveCart
is true.- Parameters:
cart
- the cartpriceCartRequest
- the price cart requestsaveCart
- determines whether to save cart after pricingcontextInfo
- the context info- Returns:
- the priced cart
-
priceCart
com.broadleafcommerce.cart.client.domain.Cart priceCart(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable PriceCartRequest priceCartRequest, boolean saveCart, Map<String, String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Prices cart, processes free gift offers, and saves cart with the providedPriceCartRequest
ifsaveCart
is true.- Parameters:
cart
- the cartpriceCartRequest
- the price cart requestsaveCart
- determines whether to save cart after pricingcontextInfo
- the context infopaymentLockTokens
- Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.- Returns:
- the priced cart
-
priceCartWithCatalogPriceUpdates
com.broadleafcommerce.cart.client.domain.Cart priceCartWithCatalogPriceUpdates(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reprice the cart, including applying the latest catalog-based prices for each of its items- Parameters:
cart
- The cart on which to perform the operation.contextInfo
- the context info- Returns:
- the priced cart
-
addAttributeToCart
com.broadleafcommerce.cart.client.domain.Cart addAttributeToCart(com.broadleafcommerce.cart.client.domain.Cart cart, AddAttributeRequest addAttributeRequest, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds an attribute to the providedCart
.- Parameters:
cart
- the cartaddAttributeRequest
- the add attribute requestprice
- whether to allow the cart to be priced after updatingcontextInfo
- the context info- Returns:
- the cart with the attribute added
-
removeAttributeFromCart
com.broadleafcommerce.cart.client.domain.Cart removeAttributeFromCart(com.broadleafcommerce.cart.client.domain.Cart cart, String key, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Removes an attribute to the providedCart
.- Parameters:
cart
- the cartkey
- the attribute keyprice
- whether to allow the cart to be priced after updatingcontextInfo
- the context info- Returns:
- the cart without the attribute
-
updateContactInfoInCart
com.broadleafcommerce.cart.client.domain.Cart updateContactInfoInCart(com.broadleafcommerce.cart.client.domain.Cart cart, ContactInfoRequest contactInfoRequest, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates the contact info for the providedCart
.- Parameters:
cart
- the cartcontactInfoRequest
- the contact info requestprice
- whether to allow the cart to be priced after updatingcontextInfo
- the context info- Returns:
- the cart with contact info updated
-
updateFulfillmentGroupInCart
default com.broadleafcommerce.cart.client.domain.Cart updateFulfillmentGroupInCart(com.broadleafcommerce.cart.client.domain.Cart cart, String referenceNumber, UpdateFulfillmentGroupRequest updateFulfillmentGroupRequest, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates an existingFulfillmentGroup
for the providedCart
.- Parameters:
cart
- the cartreferenceNumber
- the reference number of the fulfillment group to updateupdateFulfillmentGroupRequest
- the fulfillment group update requestprice
- whether to allow the cart to be priced after updatingcontextInfo
- the context info- Returns:
- the cart with an updated fulfillment group
-
bulkUpdateFulfillmentGroupsInCart
com.broadleafcommerce.cart.client.domain.Cart bulkUpdateFulfillmentGroupsInCart(com.broadleafcommerce.cart.client.domain.Cart cart, List<UpdateFulfillmentGroupRequest> updateFulfillmentGroupsRequests, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates an existingFulfillmentGroups
for the providedCart
.- Parameters:
cart
- the cartupdateFulfillmentGroupsRequests
- the fulfillment group update requestsprice
- whether to allow the cart to be priced after updatingcontextInfo
- the context info- Returns:
- the cart with an updated fulfillment group
-
reallocateCartTotalAmongstPayments
List<PaymentSummary> reallocateCartTotalAmongstPayments(javax.money.MonetaryAmount newCartTotal, List<PaymentSummary> paymentSummaries, Map<String, String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reallocate the cart total among the cart's payments- Parameters:
cartWithLatestPricing
- the cart with the latest pricingpaymentLockTokens
- Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.contextInfo
- the context info
-
recalculateTaxesForCart
@Deprecated com.broadleafcommerce.cart.client.domain.Cart recalculateTaxesForCart(com.broadleafcommerce.cart.client.domain.Cart cart, boolean estimated, boolean actual, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Recalculates the taxes for the providedCart
.- Parameters:
cart
- the cartestimated
- whether to calculate estimated taxesactual
- whether to calculate actual taxescontextInfo
- the context info- Returns:
- the cart with taxes updated
- See Also:
-
recalculateTaxesForCart
com.broadleafcommerce.cart.client.domain.Cart recalculateTaxesForCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, boolean estimated, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Recalculates the taxes for the providedCart
.- Parameters:
cart
- the cartestimated
- hint as to whether taxes should be estimatedcontextInfo
- the context info- Returns:
- the cart with taxes updated
-
priceCart
@Deprecated default com.broadleafcommerce.cart.client.domain.Cart priceCart(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.since 1.6, in favor ofpriceCart(Cart, boolean, ContextInfo)
Prices and saves the cart.- Parameters:
cart
- the cartcontextInfo
- the context info- Returns:
- the priced cart
-
priceCart
@Deprecated com.broadleafcommerce.cart.client.domain.Cart priceCart(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable PriceCartRequest priceCartRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.since 1.6, in favor ofpriceCart(Cart, PriceCartRequest, boolean, ContextInfo)
Prices and saves the cart with the providedPriceCartRequest
.- Parameters:
cart
- the cartpriceCartRequest
- the price cart requestcontextInfo
- the context info- Returns:
- the priced cart
-
retrieveInProcessCartByCustomerIdAndApplicationId
@Deprecated Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveInProcessCartByCustomerIdAndApplicationId(String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Retrieve the in-process cart for the provided customer.- Parameters:
customerId
- The id of the customer for which to perform the operation.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- The in-process cart for the provided customer.
-
retrieveInProcessCartByCartId
@Deprecated Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveInProcessCartByCartId(String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.in favor ofretrieveCartByCartId(String, ContextInfo)
Retrieve the cart for the provided id, as long as it is in-process.- Parameters:
cartId
- The id of the cart on which to perform the operation.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- The in-process cart for the provided id.
-
retrieveCsrCartByCartId
@Deprecated Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCsrCartByCartId(String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Retrieve the cart for the provided id, as long as it is CSR-owned.- Parameters:
cartId
- The id of the cart on which to perform the operation.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- The CSR-owned cart for the provided id.
-
retrieveTestCartByCartId
@Deprecated Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveTestCartByCartId(String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.in favor ofretrieveCartByCartId(String, ContextInfo)
Retrieve the cart for the provided id, as long as it is a test cart.- Parameters:
cartId
- The id of the cart on which to perform the operation.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- The test cart for the provided id.
-
retrieveCsrOwnedCartByCustomerIdAndApplicationId
@Deprecated Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCsrOwnedCartByCustomerIdAndApplicationId(String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Retrieve the CSR-owned cart for the provided customer.- Parameters:
customerId
- The id of the customer for which to perform the operation.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- The CSR-owned cart for the provided customer.
-
updateCartContactInfo
@Deprecated com.broadleafcommerce.cart.client.domain.Cart updateCartContactInfo(com.broadleafcommerce.cart.client.domain.Cart cart, ContactInfoRequest contactInfoRequest, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Update contact information to allow business users to contact the customer if needed.- Parameters:
cart
- The cart that hold the contact info.contactInfoRequest
- The contact info that is to be added to the cart.allowPriceCart
- Whether to allow the cart to be priced after updatingcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The cart with updated contact info.
-
addToCart
@Deprecated com.broadleafcommerce.cart.client.domain.Cart addToCart(AddItemRequest addItemRequest, @Nullable com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customerRef, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.useaddItemToCart(Cart, AddItemRequest, boolean, ContextInfo)
for updates andcreateCart(CartCreationRequest, CustomerRef, ContextInfo)
for createsAdd an item to the customer's current cart based on the provided untrusted information. By default, this includes the following steps:- Retrieve catalog information for the item
- Check inventory
- Create item and add it to the cart (un-priced)
- Price the item and cart, using offers and price lists (optional)
- Update the cart and it's items (optional)
- Parameters:
addItemRequest
- Add an item to the customer's current cart based on the provided untrusted information.cart
- The cart to be added to. If not provided, then a new cart will be produced.customerRef
- The cart's owning customer. Can be null if anonymous.allowPriceCart
- Whether to allow the cart to be priced after updatingcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The cart with the item added.
- Throws:
CartItemValidationException
- Thrown if the cart item is misconfigured based on the related product's included products and product options.
-
bulkAddToCart
@Deprecated BulkAddToCartResponse bulkAddToCart(Collection<AddItemRequest> addItemRequests, @Nullable com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customerRef, boolean shouldPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Add a list of items to the customer's current cart based on the provided untrusted information. By default, this includes the following steps:- Retrieve catalog information for the items
- Check inventory
- Create item and add it to the cart (un-priced)
- Price the item and cart, using offers and price lists (optional)
- Update the cart and it's items (optional)
- Parameters:
addItemRequests
- Add a list of items to the customer's current cart based on the provided untrusted information.cart
- The id of the cart to be added to. If not provided, then a new cart will be produced.customerRef
- The cart's owning customer. Can be null if anonymous.shouldPriceCart
- Whether the cart should be priced after updatingcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The cart with the items added.
- Throws:
CartItemValidationException
- Thrown if the cart item is misconfigured based on the related product's included products and product options.
-
updateCartItem
@Deprecated com.broadleafcommerce.cart.client.domain.Cart updateCartItem(com.broadleafcommerce.cart.client.domain.Cart cart, UpdateItemRequest updateItemRequest, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Update the cart item.- Parameters:
cart
- The id of the cart on which to perform the operation.updateItemRequest
- The cart item to use to update the details of the current 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.
-
removeCartItems
@Deprecated com.broadleafcommerce.cart.client.domain.Cart removeCartItems(com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Remove items from the cart.- Parameters:
cart
- The id of the cart on which to perform the operation.cartItemIds
- The ids of the cart items on which to perform the operation.allowPriceCart
- Whether to allow the cart to be priced after updatingcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The cart with the item removed.
-
addCodeToCart
@Deprecated AddCodeToCartResponse addCodeToCart(com.broadleafcommerce.cart.client.domain.Cart cart, AddCodeRequest codeRequest, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.- Retrieve the cart
- Determine if the code is valid as a campaign tracking code
- If so, add it to the cart as a
CampaignRef
- Determine if the code is valid as a shared code
- If so, add it to the cart
- Update the cart
- Price the cart, using offers and price lists (optional)
- Update the cart and its items (optional)
- Parameters:
cart
- The id of the cart on which to perform the operation.codeRequest
- The payload of the request to add a code to the cart.allowPriceCart
- Whether to allow the cart to be priced after updatingcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- An AddCodeToCartResponse describing the results of adding the offer code to the cart
- Throws:
AddCodeException
- if the code cannot be added for any reason. This is usually because the code is invalid or has already been used the maximum number of times.AddCodeException.getReasonType()
will typically match the code'sCodeUsabilityInfo.getCodeUsabilityType()
and can be used on the frontend to determine messaging.
-
updateFulfillmentGroup
@Deprecated com.broadleafcommerce.cart.client.domain.Cart updateFulfillmentGroup(com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId, UpdateFulfillmentGroupRequest fulfillmentGroupRequest, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Update the fulfillment group.- 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.fulfillmentGroupRequest
- The fulfillment group updates to be applied to the existing fulfillment group.allowPriceCart
- Whether to allow the cart to be priced after updatingcontextInfo
- Context information around sandbox and multitenant state.- Returns:
- The Cart for which the updated fulfillment group is a part.
-
releasePaymentFinalizationLock
com.broadleafcommerce.cart.client.domain.Cart releasePaymentFinalizationLock(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) For carts in theDefaultCartStatuses.AWAITING_PAYMENT_FINALIZATION
status, this method updates the cart status toDefaultCartStatuses.IN_PROCESS
allowing the customer to once again edit the cart. Additionally, it should make the cart's related entities, like the cart's payments, editable once again.- Parameters:
cart
- the cart to be unlockedcontextInfo
- Context information around sandbox and multitenant state- Returns:
- the unlocked cart
-
addOfferCodeToCart(Cart, AddCodeRequest, boolean, ContextInfo)