P
- as ProductU
- as GenericEcomUserpublic interface OrderStrategy<P extends Product,U extends IGenericEcomUser,O extends Order<? extends I>,I extends OrderItem> extends ChargeStrategy<P,U>
Strategy
for OrderModifier and Type | Method and Description |
---|---|
<CONTEXT> O |
createOrder(Map<P,Number> productQtyMap,
U user,
String currency,
List<PromotionForUser> promotions,
Map<String,Object> itemProperties,
boolean persist,
CONTEXT context) |
<CONTEXT> O |
createOrder(Map<P,Number> productQtyMap,
U user,
String currency,
List<PromotionForUser> promotions,
Map<String,Object> itemProperties,
boolean persist,
org.apache.commons.collections.Transformer transformer,
CONTEXT context)
|
OrderService<O,I> |
getOrderService()
Access to the underlying
OrderService |
void |
onOrderComplete(O order,
String sessionId)
When an Order is successfully Completed; then some actions should be taken.
|
calculate
getVersion
<CONTEXT> O createOrder(Map<P,Number> productQtyMap, U user, String currency, List<PromotionForUser> promotions, Map<String,Object> itemProperties, boolean persist, org.apache.commons.collections.Transformer transformer, CONTEXT context) throws OrderPlacementException
Order
Cart
could be convenient, however most order creation data are also contextual and it would additionally require other services to be part ofthe OrderStrategy
which would not make it clean. For these reasons there is no direct method to accept Cart
.
One can use the following code to support the transition, for example:
Map productQuantityMap = cartService.convertToProductQuantityMap(cart);
order = orderStrategy.createOrder(productQuantityMap, user, null Default Currency, null No promotions, false , orderProcessHelper.deriveContext(user, getRequestCycle()));
or one can use OrderProcessHelper#deriveOrder(Map, IGenericEcomUser, String, Class, Order, String, org.apache.wicket.RequestCycle, org.apache.wicket.Response)
productQtyMap
- as Map
of Product to Number (Quantity)user
- as User
@nullable true (In case of GuestUser
, optional)currency
- as String @nullable true. A null implies default currencypromotions
- as List of Promotion
sitemProperties
- as Map
of additional properties for each product (OrderItem)persist
- as boolean; if true will persist the Order instance and return an Order with Order.getId()
that is also persistedtransformer
- as Transformer (Optional), to perform any additional transformation over the in process Order Object before its persisted @nullable truecontext
- as varargsOrderPlacementException
<CONTEXT> O createOrder(Map<P,Number> productQtyMap, U user, String currency, List<PromotionForUser> promotions, Map<String,Object> itemProperties, boolean persist, CONTEXT context) throws OrderPlacementException
OrderPlacementException
#createOrder(Map, IGenericEcomUser, String, List, Map, boolean, Transformer, Object...)
void onOrderComplete(O order, String sessionId)
ChangeListener
hooked into OrderService
or TransactionService
alsoPromotionForUser
sorder
- as OString
- sessionId @nullable true; if null release or all productsChangeGenerator, {@link ChangeListener}, {@link PostOrderProcessStrategy} as possible implementation aids.
OrderService<O,I> getOrderService()
OrderService
Copyright © 2018. All rights reserved.