Interface CartResolverService
-
- All Known Implementing Classes:
DefaultCartResolverService
public interface CartResolverServiceThe interface used for resolving in-progressCarts.- Author:
- Nick Crum (ncrum)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Optional<com.broadleafcommerce.cart.client.domain.Cart>resolveCartById(String cartId, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Resolves aCartgiven the cart ID, customer, and context.default Optional<com.broadleafcommerce.cart.client.domain.Cart>resolveCartByStatus(@NonNull String status, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Resolves theCartwith the first matching status for the given customer and context.Optional<com.broadleafcommerce.cart.client.domain.Cart>resolveCartByStatus(@NonNull Collection<String> status, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Resolves theCartwith the first matching status for the given customer and context.default Optional<com.broadleafcommerce.cart.client.domain.Cart>resolveInProcessCart(com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Resolves the current in-progressCartgiven the customer and context.
-
-
-
Method Detail
-
resolveCartById
Optional<com.broadleafcommerce.cart.client.domain.Cart> resolveCartById(String cartId, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Resolves aCartgiven the cart ID, customer, and context.If the provided
CustomerRefis not registered, this will resolve a guest cart for the given ID and context. If the cart is found to be a customer cart, this will return as empty, because an anonymous customer can only access guest carts.If the provided
CustomerRefis registered, this will resolve a customer cart for the given customer, ID, and context. If the cart is found to be a guest cart, this will return as empty.If no cart is found, this will return an empty optional.
- Parameters:
cartId- the cart IDcustomer- the customercontextInfo- the context info- Returns:
- an optional with a cart, or empty
-
resolveCartByStatus
Optional<com.broadleafcommerce.cart.client.domain.Cart> resolveCartByStatus(@NonNull @NonNull Collection<String> status, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Resolves theCartwith the first matching status for the given customer and context.This method will iterate through each status, in given order, and attempt to retrieve a cart for that status. The first accessible cart retrieved for a status will be returned.
If no cart is found, this will return an empty optional.
- Parameters:
status- the statuses to checkcustomer- the customercontextInfo- the context info- Returns:
- an optional with a cart, or empty
-
resolveCartByStatus
default Optional<com.broadleafcommerce.cart.client.domain.Cart> resolveCartByStatus(@NonNull @NonNull String status, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Resolves theCartwith the first matching status for the given customer and context.This method will iterate through each status, in given order, and attempt to retrieve a cart for that status. The first accessible cart retrieved for a status will be returned.
If no cart is found, this will return an empty optional.
- Parameters:
status- the status to checkcustomer- the customercontextInfo- the context info- Returns:
- an optional with a cart, or empty
-
resolveInProcessCart
default Optional<com.broadleafcommerce.cart.client.domain.Cart> resolveInProcessCart(com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Resolves the current in-progressCartgiven the customer and context.If no cart is found, this will return an empty optional.
- Parameters:
customer- the customercontextInfo- the context info- Returns:
- an optional with a cart, or empty
-
-