Interface CartOperationService

  • All Known Implementing Classes:
    DefaultCartOperationService

    public interface CartOperationService
    Service for orchestrating the different workflows on various cart operations. Delegates to external services as needed to process each operation.
    Author:
    Chad Harchar (charchar), Nick Crum (ncrum)
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods 
      Modifier and Type Method Description
      com.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 provided Cart.
      AddCodeToCartResponse addCodeToCart​(com.broadleafcommerce.cart.client.domain.Cart cart, AddCodeRequest codeRequest, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      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 provided Cart based on the provided AddItemRequest.
      BulkAddToCartResponse 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 provided Cart.
      AddCodeToCartResponse 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 provided Cart.
      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)
      BulkAddToCartResponse bulkAddToCart​(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)
      com.broadleafcommerce.cart.client.domain.Cart createCart​(CartCreationRequest cartCreationRequest, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Creates a new, in-progress Cart for the provided CartCreationRequest and CustomerRef.
      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 if saveCart 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 if saveCart 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 provided PriceCartRequest if saveCart 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 provided PriceCartRequest if saveCart 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)
      default com.broadleafcommerce.cart.client.domain.Cart priceCart​(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      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 items
      List<PaymentSummary> reallocateCartTotalAmongstPayments​(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 payments
      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)
      Recalculates the taxes for the provided 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 provided Cart.
      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)
      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 provided Cart 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 provided Cart 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 provided Cart 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 provided Cart 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 provided Cart, if it exists.
      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)
      Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCsrOwnedCartByCustomerIdAndApplicationId​(String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      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.
      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> retrieveInProcessCartByCartId​(String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveInProcessCartByCustomerIdAndApplicationId​(String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      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)
      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 provided Cart 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 provided Cart 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 provided Cart based on the provided flags.
      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)
      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)
      com.broadleafcommerce.cart.client.domain.Cart updateCartStatus​(com.broadleafcommerce.cart.client.domain.Cart cart, UpdateCartStatusRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Updates the cart'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 provided Cart.
      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)
      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 existing FulfillmentGroup for the provided Cart.
      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 provided Cart based on the provided UpdateItemRequest.
    • Method Detail

      • 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 carts
        filters - Additional RSQL filters
        page - Pagination params
        context - Additional sandbox and multitenant info
        Returns:
        All of a customer's carts that have not been locked, archived, or submitted.
      • retrieveImplicitCart

        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.

        Out of the box, a default/implicit cart means an DefaultCartStatuses.IN_PROCESS with null name, and there should only be one default/implicit cart per user.

        Parameters:
        customerId - the customer ID
        accountId - the id of the account that the Cart belong to, null can be passed in to retrieve customer Cart
        contextInfo - the context info
        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.
      • 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.
        Convenient method to retrieve a cart with the provided customer ID and status, if it exists
        Parameters:
        customerId - the customer ID
        status - the status
        contextInfo - 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 given accountId is null.
        Parameters:
        customerId - the customer ID
        accountId - the id of the account that the Cart belong to, null can be passed in to retrieve customer Cart
        status - the status
        contextInfo - 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 given accountId is null.
        Parameters:
        customerId - the customer ID
        status - the status
        name - the name of the cart or null for a cart with no name
        accountId - the id of the account that the Cart belong to, null can be passed in to retrieve customer Cart
        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-progress Cart for the provided CartCreationRequest and CustomerRef. The CartCreationRequest must contain

        For guest customers, this will create a new guest cart

        Parameters:
        cartCreationRequest - the cart creation request
        customer - the customer
        contextInfo - 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 provided Cart 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 of invalidatePrices. 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 updated
        allowPriceCart - whether the cart may be priced
        wasCartModified - whether the cart was actually modified by the caller
        invalidatePrices - whether to invalidate prices on the cart if changes were made
        Returns:
        synced version of the cart with the cart service
      • 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 provided Cart 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 of invalidatePrices. 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 updated
        allowPriceCart - whether the cart may be priced
        wasCartModified - whether the cart was actually modified by the caller
        invalidatePrices - whether to invalidate prices on the cart if changes were made
        paymentLockTokens - 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.
      • updateCartStatus

        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)
        Updates the cart's status.
        Parameters:
        cart - The cart to update
        request - The status request with the status to update to, see DefaultCartStatuses.
        contextInfo - 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 provided Cart 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 are DefaultCartStatuses.IN_PROCESS with null name, and there can be only one per user.

        Parameters:
        cart - the cart to update
        name - the name for the cart
        contextInfo - 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 provided Cart based on the provided AddItemRequest.
        Parameters:
        cart - the cart
        addItemRequest - the request to add an item
        price - whether or not to re-price the cart
        contextInfo - 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 provided Cart based on the provided UpdateItemRequest.
        Parameters:
        cart - the cart
        updateItemRequest - the request to update an item
        price - whether or not to re-price the cart
        contextInfo - 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 provided Cart matching the provided cart item ID.
        Parameters:
        cart - the cart
        cartItemId - the cart item ID
        price - whether or not to re-price the cart
        contextInfo - 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 provided Cart.
        Parameters:
        cart - the cart
        addItemRequests - the add item requests
        price - whether or not to re-price the cart
        contextInfo - 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 provided Cart matching the provided cart item IDs.
        Parameters:
        cart - the cart
        cartItemIds - the cart item IDs
        price - whether or not to re-price the cart
        contextInfo - 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 provided Cart matching the provided cart item IDs.
        Parameters:
        cart - the cart
        cartItemIds - the cart item IDs
        price - whether or not to re-price the cart
        updateCart - whether or not to update Cart pricing and save the cart after the removal
        contextInfo - 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 provided Cart matching the provided cart item IDs.
        Parameters:
        cart - the cart
        cartItemIds - the cart item IDs
        price - whether or not to re-price the cart
        updateCart - whether or not to update Cart pricing and save the cart after the removal
        paymentLockTokens - 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 provided Cart.
        1. Determine if the code is valid as a campaign tracking code
        2. If so, add it to the cart as a CampaignRef
        3. Determine if the code is valid as a shared code
        4. If so, add it to the cart
        Parameters:
        cart - the cart
        addOfferCodeRequest - the add offer code request
        price - whether or not to re-price the cart
        contextInfo - 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's CodeUsabilityInfo.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 provided Cart, if it exists.
        1. Determine if the code exists as a tracking code on the cart
        2. If so, remove the corresponding CampaignRef
        3. Determine if the offer code exists on the cart
        4. If so, remove it
        Parameters:
        cart - cart cart
        offerCode - the offer code to remove
        price - whether or not to re-price the cart
        contextInfo - 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 updating
        contextInfo - 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 if saveCart is true.
        Parameters:
        cart - the cart
        saveCart - determines whether to save cart after pricing
        contextInfo - 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 if saveCart is true.
        Parameters:
        cart - the cart
        saveCart - determines whether to save cart after pricing
        contextInfo - the context info
        paymentLockTokens - 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 provided PriceCartRequest if saveCart is true.
        Parameters:
        cart - the cart
        priceCartRequest - the price cart request
        saveCart - determines whether to save cart after pricing
        contextInfo - 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 provided PriceCartRequest if saveCart is true.
        Parameters:
        cart - the cart
        priceCartRequest - the price cart request
        saveCart - determines whether to save cart after pricing
        contextInfo - the context info
        paymentLockTokens - 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 provided Cart.
        Parameters:
        cart - the cart
        addAttributeRequest - the add attribute request
        price - whether to allow the cart to be priced after updating
        contextInfo - 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 provided Cart.
        Parameters:
        cart - the cart
        key - the attribute key
        price - whether to allow the cart to be priced after updating
        contextInfo - 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 provided Cart.
        Parameters:
        cart - the cart
        contactInfoRequest - the contact info request
        price - whether to allow the cart to be priced after updating
        contextInfo - the context info
        Returns:
        the cart with contact info updated
      • updateFulfillmentGroupInCart

        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 existing FulfillmentGroup for the provided Cart.
        Parameters:
        cart - the cart
        referenceNumber - the reference number of the fulfillment group to update
        updateFulfillmentGroupRequest - the fulfillment group update request
        price - whether to allow the cart to be priced after updating
        contextInfo - 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 pricing
        paymentLockTokens - 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

        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)
        Recalculates the taxes for the provided Cart.
        Parameters:
        cart - the cart
        estimated - whether to calculate estimated taxes
        actual - whether to calculate actual taxes
        contextInfo - 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.
        Prices and saves the cart.
        Parameters:
        cart - the cart
        contextInfo - 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)
        Prices and saves the cart with the provided PriceCartRequest.
        Parameters:
        cart - the cart
        priceCartRequest - the price cart request
        contextInfo - 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)
        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)
        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)
        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)
        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)
        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)
        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 updating
        contextInfo - 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)
        Add an item to the customer's current cart based on the provided untrusted information. By default, this includes the following steps:
        1. Retrieve catalog information for the item
        2. Check inventory
        3. Create item and add it to the cart (un-priced)
        4. Price the item and cart, using offers and price lists (optional)
        5. 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 updating
        contextInfo - 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)
        Add a list of items to the customer's current cart based on the provided untrusted information. By default, this includes the following steps:
        1. Retrieve catalog information for the items
        2. Check inventory
        3. Create item and add it to the cart (un-priced)
        4. Price the item and cart, using offers and price lists (optional)
        5. 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 updating
        contextInfo - 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)
        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 updating
        contextInfo - 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)
        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 updating
        contextInfo - 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)
        1. Retrieve the cart
        2. Determine if the code is valid as a campaign tracking code
        3. If so, add it to the cart as a CampaignRef
        4. Determine if the code is valid as a shared code
        5. If so, add it to the cart
        6. Update the cart
        7. Price the cart, using offers and price lists (optional)
        8. 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 updating
        contextInfo - 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's CodeUsabilityInfo.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)
        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 updating
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        The Cart for which the updated fulfillment group is a part.