Fired at points in the shopping cart and checkout lifecycle: item added, payment pending, checkout completed, or checkout about to happen. It has event id "shoppingCart", and which point in the lifecycle fired is reported by getAction, one of ADDED_TO_CART, PAYMENT_PENDING, CHECKOUT_COMPLETE or BEFORE_CHECKOUT. The BEFORE_CHECKOUT event, created with createBeforeCheckoutEvent, is raised before the checkout is attempted so a listener that objects can call addErrorMessage; a non-empty list of error messages aborts the checkout and is shown to the user. It is a trigger event, keyed on the website id as trigger item 1 and the action name as trigger item 2, and the cart, checkout items and ordering profile are also available from the attributes map.

Implements: TriggerEvent


Properties

PropertyReturnsDescription
actionShoppingCartActionWhich point in the shopping cart lifecycle this event represents.
attributesMap<String,Object>The mutable attribute map for this event. Typically contains orderedBy, a profile bean for who ordered; shoppingAction, the action name; shoppingCart and cart, the Cart; profile, the ordering profile; and, depending on how the event was constructed, checkoutItems, items or paymentTransaction. Listeners may add their own entries.
cartCartThe cart that generated this event, read from the attributes map. Null if the event was created with the no-argument constructor.
emailAttachmentsList<EmailAttachmentBean>Attachments to include on any email sent for this event. Populated only for CHECKOUT_COMPLETE, from the ordered products' order attachments; empty for every other action. Computed once and cached for the life of the event.
errorMessagesList<String>The reasons this checkout should be aborted, accumulated by calls to addErrorMessage. Only meaningful for the BEFORE_CHECKOUT action.
eventIdStringThe persistent identifier for this event type, always "shoppingCart". Used by the trigger system to select handlers.
grandTotalBigDecimalThe grand total of the reward store checkout, as supplied to the constructor. Null unless this event was constructed with reward store line items and a grand total.
itemsList<ShoppingCartItemBean>The line items of the reward store checkout that produced this event. Null for a standard ecommerce checkout, where the cart's product orders carry the line items instead.
profileProfileThe profile of the user who generated this event, read from the attributes map.
shoppingCartItemsTotalBigDecimalThe sum of the grand total amounts of the reward store checkout line items. Only valid when getItems is populated - throws a null pointer exception if this event was not constructed with reward store line items.
sourceProfileProfileThe profile who owns the cart, as supplied to the constructor.
storeTypeShoppingCartStoreTypeThe type of store this event was raised from. Always ECOMMERCE - kept only for historical reasons.
triggerItem1StringThe id of the website the event was fired from, as a string, for trigger matching.
triggerItem2StringThe name of the shopping cart action, for trigger matching.
triggerItem3StringNot used by this event, always null.
triggerItem4StringNot used by this event, always null.
triggerItem5StringNot used by this event, always null.
websiteWebsiteThe website the checkout or cart activity occurred on. May be null for events not raised from a website context.

Inherited from TriggerEvent

Properties

PropertyReturnsDescription
serialisablebooleanWhether this event's attributes were built to survive being persisted, ie every value is a plain serialisable value rather than a persistent entity or some other object that only makes sense inside the firing transaction. Only the firing app can know this, so it declares it - see EventBuilder. An agent that subscribes to an event does not run when it fires. The event is written to storage as JSON, buffered with others, and read back minutes later in a different session, so a value that cannot be written and read back is not merely awkward, it breaks the whole delivery. The agent framework therefore ignores any event which does not say yes here.

Methods

isSerialisable()

Returns: boolean

Whether this event's attributes were built to survive being persisted, ie every value is a plain serialisable value rather than a persistent entity or some other object that only makes sense inside the firing transaction. Only the firing app can know this, so it declares it - see EventBuilder. An agent that subscribes to an event does not run when it fires. The event is written to storage as JSON, buffered with others, and read back minutes later in a different session, so a value that cannot be written and read back is not merely awkward, it breaks the whole delivery. The agent framework therefore ignores any event which does not say yes here.


Methods

getItems() · getCart() · getStoreType() · getAction() · getProfile() · getEventId() · getWebsite() · getSourceProfile() · getEmailAttachments() · getTriggerItem1() · getTriggerItem2() · getTriggerItem3() · getTriggerItem4() · getTriggerItem5() · getAttributes() · getShoppingCartItemsTotal() · getGrandTotal() · getErrorMessages() · addErrorMessage(String s)

getItems()

Returns: List<ShoppingCartItemBean>

The line items of the reward store checkout that produced this event. Null for a standard ecommerce checkout, where the cart's product orders carry the line items instead.

getCart()

Returns: Cart

The cart that generated this event, read from the attributes map. Null if the event was created with the no-argument constructor.

getStoreType()

Returns: ShoppingCartStoreType

The type of store this event was raised from. Always ECOMMERCE - kept only for historical reasons.

getAction()

Returns: ShoppingCartAction

Which point in the shopping cart lifecycle this event represents.

getProfile()

Returns: Profile

The profile of the user who generated this event, read from the attributes map.

getEventId()

Returns: String

The persistent identifier for this event type, always "shoppingCart". Used by the trigger system to select handlers.

getWebsite()

Returns: Website

The website the checkout or cart activity occurred on. May be null for events not raised from a website context.

getSourceProfile()

Returns: Profile

The profile who owns the cart, as supplied to the constructor.

getEmailAttachments()

Returns: List<EmailAttachmentBean>

Attachments to include on any email sent for this event. Populated only for CHECKOUT_COMPLETE, from the ordered products' order attachments; empty for every other action. Computed once and cached for the life of the event.

getTriggerItem1()

Returns: String

The id of the website the event was fired from, as a string, for trigger matching.

getTriggerItem2()

Returns: String

The name of the shopping cart action, for trigger matching.

getTriggerItem3()

Returns: String

Not used by this event, always null.

getTriggerItem4()

Returns: String

Not used by this event, always null.

getTriggerItem5()

Returns: String

Not used by this event, always null.

getAttributes()

Returns: Map<String,Object>

The mutable attribute map for this event. Typically contains orderedBy, a profile bean for who ordered; shoppingAction, the action name; shoppingCart and cart, the Cart; profile, the ordering profile; and, depending on how the event was constructed, checkoutItems, items or paymentTransaction. Listeners may add their own entries.

getShoppingCartItemsTotal()

Returns: BigDecimal

The sum of the grand total amounts of the reward store checkout line items. Only valid when getItems is populated - throws a null pointer exception if this event was not constructed with reward store line items.

getGrandTotal()

Returns: BigDecimal

The grand total of the reward store checkout, as supplied to the constructor. Null unless this event was constructed with reward store line items and a grand total.

getErrorMessages()

Returns: List<String>

The reasons this checkout should be aborted, accumulated by calls to addErrorMessage. Only meaningful for the BEFORE_CHECKOUT action.

addErrorMessage(String s)

Returns: void

Refuse this checkout. Only meaningful for the BEFORE_CHECKOUT action - any message added here aborts the checkout and is shown to the user, so it must be safe to show them.

ParameterDescription
sthe reason, shown to the user
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.