public class DefaultBasketController extends AbstractCallContextDependantController implements BasketController
BasketController interface.| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultBasketController.DefaultCartSummary |
BasketController.CartSummaryCONTROLLER_CONTEXT| Constructor and Description |
|---|
DefaultBasketController() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
activateAnonymousCartByCode(java.lang.String cartCode)
Find and load a cart owned by the anonymous customer for the given cart code.
|
void |
addToCart(TypedObject product,
long quantity)
Add product to the cart
|
protected void |
calculateCartInContext(CartModel cartModel) |
void |
cleanupAnonymousCart()
Clear the agent's anonymous cart
|
void |
clearCart()
Clear the current cart
|
protected ImpersonationContext |
createImpersonationContext(CartModel cartModel) |
void |
dispatchEvent(java.lang.String context,
java.lang.Object source,
java.util.Map<java.lang.String,java.lang.Object> data)
Notifies all event acceptors which are registered for events with the context code context.
|
protected CustomerModel |
getAnonymousCustomer() |
java.util.List<TypedObject> |
getAppliedOrderPromotions()
Get the applied order level promotion results
|
java.util.List<TypedObject> |
getAvailableDeliveryAddresses()
Get the available delivery addresses for the current cart
|
java.util.List<TypedObject> |
getAvailableDeliveryModes()
Get the available delivery modes for the current cart
|
protected BasketStrategy |
getBasketStrategy() |
TypedObject |
getCart()
Get the current cart
|
TypedObject |
getCartCurrency()
Get the current cart's currency
|
protected CartModel |
getCartModel() |
BasketController.CartSummary |
getCartSummary()
Get summary and totals information for the current cart
|
WidgetBrowserModel |
getCheckoutBrowser()
Get the checkout browser
|
protected java.lang.String |
getCheckoutBrowserDefaultWidgetCode() |
CheckoutController |
getCheckoutController()
Get the checkout controller
|
protected CommerceCartService |
getCommerceCartService() |
protected CommerceCheckoutService |
getCommerceCheckoutService() |
protected CommonI18NService |
getCommonI18NService() |
protected CsCheckoutService |
getCsCheckoutService() |
protected CsPromotionService |
getCsPromotionService() |
protected CustomerAccountService |
getCustomerAccountService() |
TypedObject |
getDefaultDeliveryMode()
Get the default delivery mode.
|
protected DeliveryService |
getDeliveryService() |
java.util.List<TypedObject> |
getEntries()
Get the cart entries
|
protected FormatFactory |
getFormatFactory() |
protected ImpersonationService |
getImpersonationService() |
java.util.List<TypedObject> |
getPotentialOrderPromotions()
Get potential order level promotion results
|
java.util.List<CartLineItem> |
getPromotionalCartLineItems()
Get the cart lines as cart line item wrappers.
|
protected SessionService |
getSessionService() |
protected UserService |
getUserService() |
protected WidgetHelper |
getWidgetHelper() |
protected WidgetBrowserModel |
lookupCheckoutBrowser()
Must be overwritten! Use <lookup-method> in spring.
|
protected CheckoutController |
lookupCheckoutController()
Must be overridden! Use <lookup-method> in spring.
|
void |
setBasketStrategy(BasketStrategy basketStrategy) |
boolean |
setCartCurrency(TypedObject currency)
Change the cart's currency.
|
boolean |
setCartDeliveryMode(TypedObject cart,
TypedObject deliveryMode)
Set the delivery mode for the whole cart.
|
boolean |
setCartEntryDeliveryAddress(TypedObject cartEntry,
TypedObject deliveryAddress)
Set the delivery address for a cart entry
|
boolean |
setCartEntryDeliveryMode(TypedObject cartEntry,
TypedObject deliveryMode)
Set the delivery mode for a cart entry
|
void |
setCheckoutBrowserDefaultWidgetCode(java.lang.String checkoutBrowserDefaultWidgetCode) |
void |
setCommerceCartService(CommerceCartService commerceCartService) |
void |
setCommerceCheckoutService(CommerceCheckoutService commerceCheckoutService) |
void |
setCommonI18NService(CommonI18NService commonI18NService) |
void |
setCsCheckoutService(CsCheckoutService csCheckoutService) |
void |
setCsPromotionService(CsPromotionService csPromotionService) |
void |
setCustomerAccountService(CustomerAccountService customerAccountService) |
void |
setDeliveryAddress(TypedObject address)
Set the delivery address for the cart
|
protected boolean |
setDeliveryAddressIfAvailable(CartModel cart) |
protected boolean |
setDeliveryModeIfAvailable(CartModel cart) |
void |
setDeliveryService(DeliveryService deliveryService) |
void |
setFormatFactory(FormatFactory formatFactory) |
void |
setImpersonationService(ImpersonationService impersonationService) |
void |
setPaymentAddress(TypedObject address)
Set the payment address for the cart
|
protected boolean |
setPaymentAddressIfAvailable(CartModel cart) |
void |
setQuantity(TypedObject cartEntry,
long quantity)
Change the quantity for a cart entry
|
void |
setSessionService(SessionService sessionService) |
void |
setUserService(UserService userService) |
void |
setWidgetHelper(WidgetHelper widgetHelper) |
boolean |
transferAnonymousCartToCustomer(java.lang.String cartCode,
TypedObject customer)
Transfer the current anonymous cart to the specified customer.
|
void |
triggerCheckout()
Begins the checkout flow for the current cart.
|
protected void |
validateBasketReadyForCheckout(CartModel cart) |
bindToCallContextController, getCallContextController, handleCallContextControllerEvent, setCallContextControllergetCockpitTypeService, getModelService, setCockpitTypeService, setModelServiceaddCockpitEventAcceptor, dispatchEvent, getAcceptors, removeCockpitEventAcceptor, setCockpitEventAcceptorsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddCockpitEventAcceptor, removeCockpitEventAcceptor, setCockpitEventAcceptorsprotected WidgetHelper getWidgetHelper()
public void setWidgetHelper(WidgetHelper widgetHelper)
protected CsCheckoutService getCsCheckoutService()
public void setCsCheckoutService(CsCheckoutService csCheckoutService)
protected java.lang.String getCheckoutBrowserDefaultWidgetCode()
public void setCheckoutBrowserDefaultWidgetCode(java.lang.String checkoutBrowserDefaultWidgetCode)
protected CsPromotionService getCsPromotionService()
public void setCsPromotionService(CsPromotionService csPromotionService)
public WidgetBrowserModel getCheckoutBrowser()
BasketControllergetCheckoutBrowser in interface BasketControllerprotected WidgetBrowserModel lookupCheckoutBrowser()
protected CommerceCartService getCommerceCartService()
public void setCommerceCartService(CommerceCartService commerceCartService)
protected CustomerAccountService getCustomerAccountService()
public void setCustomerAccountService(CustomerAccountService customerAccountService)
protected BasketStrategy getBasketStrategy()
public void setBasketStrategy(BasketStrategy basketStrategy)
protected CommonI18NService getCommonI18NService()
public void setCommonI18NService(CommonI18NService commonI18NService)
protected SessionService getSessionService()
public void setSessionService(SessionService sessionService)
protected UserService getUserService()
public void setUserService(UserService userService)
protected FormatFactory getFormatFactory()
public void setFormatFactory(FormatFactory formatFactory)
protected DeliveryService getDeliveryService()
public void setDeliveryService(DeliveryService deliveryService)
protected CommerceCheckoutService getCommerceCheckoutService()
public void setCommerceCheckoutService(CommerceCheckoutService commerceCheckoutService)
protected ImpersonationService getImpersonationService()
public void setImpersonationService(ImpersonationService impersonationService)
public CheckoutController getCheckoutController()
BasketControllergetCheckoutController in interface BasketControllerprotected CheckoutController lookupCheckoutController()
public void dispatchEvent(java.lang.String context,
java.lang.Object source,
java.util.Map<java.lang.String,java.lang.Object> data)
WidgetControllerdispatchEvent in interface WidgetControllerdispatchEvent in class AbstractWidgetControllercontext - event contextsource - event sourcedata - parameters to be be passed to registered listenerspublic void addToCart(TypedObject product, long quantity)
BasketControlleraddToCart in interface BasketControllerproduct - the product to addquantity - the quantity of the product to addpublic java.util.List<TypedObject> getEntries()
BasketControllergetEntries in interface BasketControllerpublic java.util.List<CartLineItem> getPromotionalCartLineItems()
BasketControllergetPromotionalCartLineItems in interface BasketControllerpublic java.util.List<TypedObject> getPotentialOrderPromotions()
BasketControllergetPotentialOrderPromotions in interface BasketControllerpublic java.util.List<TypedObject> getAppliedOrderPromotions()
BasketControllergetAppliedOrderPromotions in interface BasketControllerpublic TypedObject getCart()
BasketControllergetCart in interface BasketControllerpublic void cleanupAnonymousCart()
BasketControllercleanupAnonymousCart in interface BasketControllerpublic boolean transferAnonymousCartToCustomer(java.lang.String cartCode,
TypedObject customer)
BasketControllertransferAnonymousCartToCustomer in interface BasketControllercartCode - the code of the anonymous cart to transfercustomer - the customer that the cart is transferred toprotected CartModel getCartModel()
public void setQuantity(TypedObject cartEntry, long quantity)
BasketControllersetQuantity in interface BasketControllercartEntry - the cart entryquantity - the new quantity for the cart entrypublic void setDeliveryAddress(TypedObject address)
BasketControllersetDeliveryAddress in interface BasketControlleraddress - the delivery addresspublic void setPaymentAddress(TypedObject address)
BasketControllersetPaymentAddress in interface BasketControlleraddress - the payment addresspublic BasketController.CartSummary getCartSummary()
BasketControllergetCartSummary in interface BasketControllerpublic TypedObject getCartCurrency()
BasketControllergetCartCurrency in interface BasketControllerpublic boolean setCartCurrency(TypedObject currency)
BasketControllersetCartCurrency in interface BasketControllercurrency - the new currencypublic void triggerCheckout()
throws ValidationException
BasketControllertriggerCheckout in interface BasketControllerValidationException - thrown on validation errorprotected void validateBasketReadyForCheckout(CartModel cart) throws ValidationException
ValidationExceptionprotected boolean setDeliveryAddressIfAvailable(CartModel cart)
protected boolean setDeliveryModeIfAvailable(CartModel cart)
protected boolean setPaymentAddressIfAvailable(CartModel cart)
protected CustomerModel getAnonymousCustomer()
public boolean setCartEntryDeliveryMode(TypedObject cartEntry, TypedObject deliveryMode)
BasketControllersetCartEntryDeliveryMode in interface BasketControllercartEntry - the cart entrydeliveryMode - the delivery mode to set, set to null to clearpublic boolean setCartEntryDeliveryAddress(TypedObject cartEntry, TypedObject deliveryAddress)
BasketControllersetCartEntryDeliveryAddress in interface BasketControllercartEntry - the cart entrydeliveryAddress - the delivery address to set, set to null to clear.public boolean setCartDeliveryMode(TypedObject cart, TypedObject deliveryMode)
BasketControllersetCartDeliveryMode in interface BasketControllercart - the cartdeliveryMode - the delivery mode for the cartpublic TypedObject getDefaultDeliveryMode()
BasketControllergetDefaultDeliveryMode in interface BasketControllerpublic java.util.List<TypedObject> getAvailableDeliveryModes()
BasketControllergetAvailableDeliveryModes in interface BasketControllerpublic java.util.List<TypedObject> getAvailableDeliveryAddresses()
BasketControllergetAvailableDeliveryAddresses in interface BasketControllerprotected void calculateCartInContext(CartModel cartModel)
protected ImpersonationContext createImpersonationContext(CartModel cartModel)
public void clearCart()
BasketControllerclearCart in interface BasketControllerpublic boolean activateAnonymousCartByCode(java.lang.String cartCode)
BasketControlleractivateAnonymousCartByCode in interface BasketControllercartCode - the cart code used to lookup the cartCopyright © 2018 SAP SE. All Rights Reserved.