public interface CartService<P extends Product,SESSION,REQUEST,USER> extends ChangeGenerator<Object>
Modifier and Type | Field and Description |
---|---|
static String |
CART_TYPE_SHOPPING |
static String |
CART_TYPE_WISHLIST |
Modifier and Type | Method and Description |
---|---|
void |
actionOnUpdateCartType(SESSION session,
REQUEST request,
String cartType,
Cart cart)
Updating cart to Session or Persistence.
|
List<P> |
convertToProductList(Cart cart)
Convert a given Cart to a Product List.
|
Map<P,Number> |
convertToProductQuantityMap(Cart cart)
Convert a given Cart to a Product Quantity Map.
|
Cart |
getCartForSession(SESSION session,
String type)
Some carts like Shopping may exist in Session or persisted.
|
Cart |
getCartForUser(String userId,
String type)
Some carts like a WishList maybe persistent
so allow to retrieve it.
|
String |
getCartSessionId(SESSION session,
String cartType)
A client cart is identified by its user name (primary) and a sessionId (for session based carts like shopping cart).
|
String |
getCartUserId(SESSION session,
USER user,
String cartType)
A client cart is identified by its user name (primary) and a sessionId (for session based carts like shopping cart).
|
Cart |
mergeCarts(SESSION session,
String cartType,
Cart existingCart,
Cart newSubCart)
Some operations require sub-carts to be added/merged with an existing
Cart . |
Cart |
saveCart(String type,
Cart cart,
SESSION session,
REQUEST request)
Save the
Cart to persist so it can be retrieved using getCartForUser(String, String) |
Cart |
subtractCart(SESSION session,
String cartType,
Cart existingCart,
Cart cartToBeSubtracted)
This operation will remove a cart from the existingCart
|
void |
validateCart(Cart cart,
SESSION session)
Validate requested Stock positions in the Cart etc.
|
addChangeListener, getListeners, notifyAllListeners, setListeners
static final String CART_TYPE_SHOPPING
static final String CART_TYPE_WISHLIST
Cart getCartForUser(String userId, String type)
userId
- as Stringtype
- as StringCart
Cart getCartForSession(SESSION session, String type)
Cart
session
- as type extends Object (meant to be a Context or Session Object)Cart saveCart(String type, Cart cart, SESSION session, REQUEST request) throws Exception
Cart
to persist so it can be retrieved using getCartForUser(String, String)
void validateCart(Cart cart, SESSION session) throws Exception
Map<P,Number> convertToProductQuantityMap(Cart cart)
WicketCartService
),
one may write their own implementation to use a more appropriate format if necessary.List<P> convertToProductList(Cart cart)
Cart mergeCarts(SESSION session, String cartType, Cart existingCart, Cart newSubCart)
Cart
. (INTERSECTION) session
- as SESSION impl like EComSession
cartType
- as StringexistingCart
- as Cart
newCart
- as Cart
Cart
Cart subtractCart(SESSION session, String cartType, Cart existingCart, Cart cartToBeSubtracted)
session
- as SESSION impl like EComSession
cartType
- as StringexistingCart
- as Cart
cartToBeSubtracted
- as Cart
Cart
void actionOnUpdateCartType(SESSION session, REQUEST request, String cartType, Cart cart) throws Exception
Cart
session
- as SESSION impl like EComSession
cartType
- as Stringcart
- as Cart
@nullable true. If true it imples we are Clearing the cartException
- - In case of some validation exception etc while accepting the CartString getCartUserId(SESSION session, USER user, String cartType)
session
- as SESSIONuser
- as USERcartType
- as StringString getCartSessionId(SESSION session, String cartType)
session
- as SESSIONcartType
- as StringCopyright © 2018. All rights reserved.