Interface CartProvider

  • All Known Implementing Classes:
    ExternalCartProvider

    public interface CartProvider
    Provider for interfacing with operations directly involving a Cart. Typically utilizes WebClient to make requests to an external REST API.
    Author:
    Chad Harchar (charchar)
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      com.broadleafcommerce.cart.client.domain.Cart createCart​(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Create a new cart.
      com.broadleafcommerce.cart.client.domain.Cart createNonRequestCart​(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Create a new cart, without updating the original request cart.
      void deleteCartItem​(String cartId, com.broadleafcommerce.cart.client.domain.CartItem cartItem, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      in favor of updating the entire cart with updateCart(Cart, ContextInfo)
      com.broadleafcommerce.cart.client.domain.Cart patchCart​(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Patch the cart.
      Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartById​(String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieve the cart.
      Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartByOrderNumber​(String customerId, String orderNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find the cart (if it exists) for the provided customer id and order number.
      Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCsrOwnedCart​(String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieve the DefaultCartStatuses.CSR_OWNED cart for the provided customer.
      Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCustomerCartByStatus​(String customerId, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Finds a cart with the given status belonging to the provided customer.
      Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveHistoricalCartForAnonymousCustomer​(String emailAddress, String orderNumber, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Finds a single, historical cart for an anonymous customer.
      SimplePage<com.broadleafcommerce.cart.client.domain.Cart> retrieveHistoricalCartsForCustomer​(String customerId, Date startDate, Date endDate, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Find all carts not DefaultCartStatuses.IN_PROCESS, DefaultCartStatuses.CSR_OWNED, or DefaultCartStatuses.NAMED for the provided customer and dates.
      Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveInProcessCart​(String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Retrieve the DefaultCartStatuses.IN_PROCESS cart for the provided customer.
      com.broadleafcommerce.cart.client.domain.Cart updateCart​(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Update the cart.
      com.broadleafcommerce.cart.client.domain.CartItem updateCartItem​(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem cartItem, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      in favor of updating the entire cart with updateCart(Cart, ContextInfo)
    • Method Detail

      • retrieveInProcessCart

        Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveInProcessCart​(String customerId,
                                                                                      @Nullable
                                                                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Retrieve the DefaultCartStatuses.IN_PROCESS cart for the provided customer.
        Parameters:
        customerId - The id of the customer for which we are attempting to find an DefaultCartStatuses.IN_PROCESS cart.
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        Retrieve the DefaultCartStatuses.IN_PROCESS cart for the provided customer.
      • retrieveCsrOwnedCart

        Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCsrOwnedCart​(String customerId,
                                                                                     @Nullable
                                                                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Retrieve the DefaultCartStatuses.CSR_OWNED cart for the provided customer.
        Parameters:
        customerId - The id of the customer for which we are attempting to find an DefaultCartStatuses.CSR_OWNED cart.
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        Retrieve the DefaultCartStatuses.CSR_OWNED cart for the provided customer.
      • retrieveCustomerCartByStatus

        Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCustomerCartByStatus​(String customerId,
                                                                                             String status,
                                                                                             @Nullable
                                                                                             com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Finds a cart with the given status belonging to the provided customer.
        Parameters:
        customerId - the customer ID
        status - the status
        contextInfo - the context info
        Returns:
        a cart if it exists
      • retrieveCartByOrderNumber

        Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartByOrderNumber​(String customerId,
                                                                                          String orderNumber,
                                                                                          @Nullable
                                                                                          com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Find the cart (if it exists) for the provided customer id and order number.
        Parameters:
        customerId - the id of the customer who owns the cart
        orderNumber - the order number for the cart
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        a cart (if it exists) with the given order number that belongs to the provided customer
      • retrieveHistoricalCartsForCustomer

        SimplePage<com.broadleafcommerce.cart.client.domain.Cart> retrieveHistoricalCartsForCustomer​(String customerId,
                                                                                                     @Nullable
                                                                                                     Date startDate,
                                                                                                     @Nullable
                                                                                                     Date endDate,
                                                                                                     @Nullable
                                                                                                     org.springframework.data.domain.Pageable page,
                                                                                                     @Nullable
                                                                                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Find all carts not DefaultCartStatuses.IN_PROCESS, DefaultCartStatuses.CSR_OWNED, or DefaultCartStatuses.NAMED for the provided customer and dates.
        Parameters:
        customerId - the id of the customer who owns the carts
        startDate - the starting date to filter carts by
        endDate - the ending date to filter carts by
        page - the requested page of results from the database
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        all carts not DefaultCartStatuses.IN_PROCESS or DefaultCartStatuses.NAMED for the provided customer and dates.
      • retrieveHistoricalCartForAnonymousCustomer

        Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveHistoricalCartForAnonymousCustomer​(String emailAddress,
                                                                                                           String orderNumber,
                                                                                                           @Nullable
                                                                                                           com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Finds a single, historical cart for an anonymous customer.
        Parameters:
        emailAddress - The email address associated with the cart
        orderNumber - The historical cart's order number
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        The single, historical cart for an anonymous customer
      • retrieveCartById

        Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartById​(String cartId,
                                                                                 @Nullable
                                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Retrieve the cart.
        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.
      • createNonRequestCart

        com.broadleafcommerce.cart.client.domain.Cart createNonRequestCart​(com.broadleafcommerce.cart.client.domain.Cart cart,
                                                                           @Nullable
                                                                           com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Create a new cart, without updating the original request cart.
        Parameters:
        cart - The cart to create
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        The created cart.
      • createCart

        com.broadleafcommerce.cart.client.domain.Cart createCart​(com.broadleafcommerce.cart.client.domain.Cart cart,
                                                                 @Nullable
                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Create a new cart.
        Parameters:
        cart - The cart to create
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        The created cart.
      • updateCart

        com.broadleafcommerce.cart.client.domain.Cart updateCart​(com.broadleafcommerce.cart.client.domain.Cart cart,
                                                                 @Nullable
                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Update the cart.
        Parameters:
        cart - The cart on which to perform the operation.
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        The updated cart.
      • patchCart

        com.broadleafcommerce.cart.client.domain.Cart patchCart​(@NonNull
                                                                @NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
                                                                @Nullable
                                                                com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Patch the cart. A patch does not replace the cart, but partially updates it using any non-null fields.
        Parameters:
        cart - The cart on which to perform the operation.
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        The patched cart.
      • updateCartItem

        @Deprecated
        com.broadleafcommerce.cart.client.domain.CartItem updateCartItem​(com.broadleafcommerce.cart.client.domain.Cart cart,
                                                                         com.broadleafcommerce.cart.client.domain.CartItem cartItem,
                                                                         @Nullable
                                                                         com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Deprecated.
        in favor of updating the entire cart with updateCart(Cart, ContextInfo)
        Update the cart item.
        Parameters:
        cart - the cart the item belongs to
        cartItem - The cart item on which to perform the operation.
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        The updated cart item.
      • deleteCartItem

        @Deprecated
        void deleteCartItem​(String cartId,
                            com.broadleafcommerce.cart.client.domain.CartItem cartItem,
                            @Nullable
                            com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Deprecated.
        in favor of updating the entire cart with updateCart(Cart, ContextInfo)
        Delete the cart item.
        Parameters:
        cartId - the ID of the card the item belongs to
        cartItem - The cart item on which to perform the operation.
        contextInfo - Context information around sandbox and multitenant state.