Represents a shopping cart, the customer's in-progress or completed order for one or more products. Holds the shipping and billing addresses, the ordered product line items, fulfilment and payment state, and loyalty point redemption details for a single order. A cart moves through ShoppingCartState, starting as PENDING while the customer is still shopping, through to COMPLETED once the order is submitted, or CANCELLED if it is abandoned by an administrator.
Group: Database Entities
Implements: Serializable, Auditable, ISale
Properties
| Property | Returns | Description |
|---|---|---|
| activatedPromotions | Set<Reward> | The promotional rewards that have been activated against this cart. |
| addressLine1 | String | First line of the cart's delivery street address. |
| addressLine2 | String | Second line of the cart's delivery street address, such as a unit or suite number. |
| addressState | String | State or province of the cart's delivery address. |
| adminOrg | Organisation | The Kademi account holder organisation this cart belongs to. |
| auditOrg | Organisation | The organisation that audit entries for changes to this cart are recorded against, per the Auditable interface. |
| billingAddress | Address | The billing address recorded for this order, separate from the delivery address. |
| billingCompany | String | Company name of the billing contact for this order. |
| billingFirstName | String | First name of the billing contact for this order. |
| billingPhone | String | Phone number of the billing contact for this order. |
| billingSurName | String | Surname of the billing contact for this order. |
| cartId | String | A UUID set from the cookie to allow the final cart to be connected to activity prior to the cart being created. |
| cartState | ShoppingCartState | Where this cart is in the checkout lifecycle: PENDING while still being shopped, COMPLETED once submitted, or CANCELLED if abandoned by an administrator. |
| city | String | City or suburb of the cart's delivery address. |
| company | String | Company name of the shipping contact for this order. |
| country | String | Country of the cart's delivery address. |
| customer | BaseEntity | Alias of getProfile, for compatibility with the ISale interface. |
| deliveryNotes | String | Courier or delivery instructions for this order, such as gate codes or drop-off preferences. |
| firstName | String | First name of the shipping contact for this order. |
| fulfilmentComplete | boolean | True if the order's fulfilment state is FULFILMENT_COMPLETE. |
| fulfilmentState | String | The order's fulfilment status code, such as FULFILMENT_NOT_FULFILED, FULFILMENT_COMPLETE or FULFILMENT_DELETED. |
| id | long | The cart's unique database identifier. |
| ipAddress | String | The client IP the order was placed from. Recorded so that fraud rules can ask how many orders have come from one address recently, which is not answerable from anything else on this record. |
| modifiedBy | Profile | The profile who last modified this cart. |
| modifiedDate | Date | Date this cart was last modified. |
| numPoints | BigDecimal | Number of loyalty points being redeemed against this cart. |
| orderedDate | Date | Date the cart was created, ie when the order was placed. |
| orderedForOrg | Organisation | The organisation this order was placed on behalf of, when the ordering profile is buying for an organisation rather than themselves. |
| orderNotes | String | Free text notes attached to the order. |
| paymentMethod | String | Identifies the checkout method used, either "cash" or "points". |
| paymentProviderId | String | Identifier of the PaymentProviderApplication used to process payment for this cart, whether for a standard ecommerce payment or a points-plus-pay payment. |
| paymentStateData | String | Intermediate state data stored by the payment provider handling this cart, such as tokens needed to resume or confirm a payment. |
| pending | boolean | True if this cart has not been submitted yet, ie the customer is still shopping. False once the customer has submitted the order. |
| phone | String | Phone number of the shipping contact for this order. |
| pointsParticipant | BaseEntity | The entity the redeemed points came from. This may be the purchasing profile itself, or an organisation they have permission to redeem points from. |
| poNumber | String | Purchase order number supplied by the customer for this order. |
| postcode | String | Postal or zip code of the cart's delivery address. |
| productOrders | List<ProductOrder> | The line items in this cart, each representing a product and quantity ordered. |
| profile | Profile | The profile who placed this order. |
| promoCodesCsv | String | Comma-separated list of promotional or voucher codes applied to this cart. |
| selectedPointsBucket | Reward | The loyalty points reward bucket selected for this cart, when the order is being paid for with points. |
| shippingAddress | CartShippingAddress | A read-only view of this cart's delivery address, exposed as a plain IReadableAddress for use by payment provider and shipping integrations. |
| shippingProviderId | String | Identifier of the shipping provider used to deliver this order. |
| source | String | Where the customer said they heard about the store, captured at checkout. |
| store | ECommerceStore | The ecommerce store this cart's order was placed through, taken from the first line item that has one. |
| submitted | boolean | True if the shopping cart has been submitted, ie the customer has placed the order. |
| surName | String | Surname of the shipping contact for this order. |
| totalCost | BigDecimal | Sums the grand total of every line item in the cart. Note that this conventionally returns the ex-tax total. |
| totalIncTax | BigDecimal | The cart's total cost including tax, ie the sum of getTotalCost and getTotalTax. |
| totalListPrice | BigDecimal | Alias for getTotalCost, for compatibility with the ISale interface. |
| totalQuantity | BigDecimal | Sums the ordered quantity across every line item in the cart. |
| totalTax | BigDecimal | Sums the tax amount of every line item in the cart. |
| trackingCode | String | Shipment tracking code issued by the shipping provider for this order. |
| vendor | BaseEntity | Alias for getAdminOrg, for compatibility with the ISale interface. |
| website | Website | The website the order was placed on. |
Methods
getId() · getProfile() · setProfile(Profile profile) · getOrderedForOrg() · setOrderedForOrg(Organisation orderedForOrg) · getCartId() · setCartId(String cartId) · getFirstName() · setFirstName(String firstName) · getSurName() · setSurName(String surName) · getCompany() · setCompany(String company) · getPhone() · setPhone(String phone) · getOrderedDate() · setOrderedDate(Date orderedDate) · getProductOrders() · setProductOrders(List<ProductOrder> productOrders) · getAdminOrg() · setAdminOrg(Organisation adminOrg) · getWebsite() · setWebsite(Website website) · getAddressLine1() · setAddressLine1(String addressLine1) · getAddressLine2() · setAddressLine2(String addressLine2) · getCity() · setCity(String city) · getPostcode() · setPostcode(String postcode) · getAddressState() · setAddressState(String state) · getCountry() · setCountry(String country) · getCartState() · setCartState(ShoppingCartState cartState) · getFulfilmentState() · setFulfilmentState(String fulfilmentState) · getModifiedBy() · setModifiedBy(Profile modifiedBy) · getModifiedDate() · setModifiedDate(Date modifiedDate) · getOrderNotes() · setOrderNotes(String orderNotes) · getPromoCodesCsv() · setPromoCodesCsv(String promoCodesCsv) · getShippingProviderId() · setShippingProviderId(String shippingProviderId) · getTrackingCode() · setTrackingCode(String trackingCode) · getIpAddress() · setIpAddress(String ipAddress) · getBillingAddress() · setBillingAddress(Address billingAddress) · getBillingFirstName() · setBillingFirstName(String billingFirstName) · getBillingSurName() · setBillingSurName(String billingSurName) · getBillingCompany() · setBillingCompany(String billingCompany) · getBillingPhone() · setBillingPhone(String billingPhone) · getSelectedPointsBucket() · setSelectedPointsBucket(Reward selectedPointsBucket) · getNumPoints() · setNumPoints(BigDecimal numPoints) · getPointsParticipant() · setPointsParticipant(BaseEntity pointsParticipant) · getDeliveryNotes() · setDeliveryNotes(String deliveryNotes) · getSource() · setSource(String source) · getPaymentProviderId() · setPaymentProviderId(String paymentProviderId) · getPoNumber() · setPoNumber(String poNumber) · getPaymentMethod() · setPaymentMethod(String paymentMethod) · getPaymentStateData() · setPaymentStateData(String paymentStateData) · getTotalCost() · getTotalTax() · getTotalIncTax() · item(Product product) · item(Long orderItemId) · numItems() · getShippingAddress() · isPending() · isSubmitted() · getActivatedPromotions() · getTotalQuantity() · isFulfilmentComplete() · addProductOrder() · getStore() · getAuditOrg() · getCustomer() · getTotalListPrice() · getVendor()
getId()
Returns: long
The cart's unique database identifier.
getProfile()
Returns: Profile
The profile who placed this order.
setProfile(Profile profile)
Returns: void
Sets the profile who placed this order.
| Parameter | Description |
|---|---|
profile | the ordering profile, or null to leave the cart unassigned |
getOrderedForOrg()
Returns: Organisation
The organisation this order was placed on behalf of, when the ordering profile is buying for an organisation rather than themselves.
setOrderedForOrg(Organisation orderedForOrg)
Returns: void
Sets the organisation this order is placed on behalf of, for a buyer purchasing for an organisation rather than for themselves.
| Parameter | Description |
|---|---|
orderedForOrg | the organisation the order is for, or null for a personal order |
getCartId()
Returns: String
A UUID set from the cookie to allow the final cart to be connected to activity prior to the cart being created.
setCartId(String cartId)
Returns: void
Sets the cart's UUID, which is normally taken from the cookie so the cart can be connected to browsing activity from before the cart existed.
| Parameter | Description |
|---|---|
cartId | the UUID to identify this cart by |
getFirstName()
Returns: String
First name of the shipping contact for this order.
setFirstName(String firstName)
Returns: void
Sets the first name of the shipping contact for this order.
| Parameter | Description |
|---|---|
firstName | the shipping contact's first name |
getSurName()
Returns: String
Surname of the shipping contact for this order.
setSurName(String surName)
Returns: void
Sets the surname of the shipping contact for this order.
| Parameter | Description |
|---|---|
surName | the shipping contact's surname |
getCompany()
Returns: String
Company name of the shipping contact for this order.
setCompany(String company)
Returns: void
Sets the company name of the shipping contact for this order.
| Parameter | Description |
|---|---|
company | the shipping contact's company name |
getPhone()
Returns: String
Phone number of the shipping contact for this order.
setPhone(String phone)
Returns: void
Sets the phone number of the shipping contact for this order.
| Parameter | Description |
|---|---|
phone | the shipping contact's phone number |
getOrderedDate()
Returns: Date
Date the cart was created, ie when the order was placed.
setOrderedDate(Date orderedDate)
Returns: void
Sets the date the order was placed. This column is not nullable, so a cart cannot be saved without it.
| Parameter | Description |
|---|---|
orderedDate | the date the order was placed |
getProductOrders()
Returns: List<ProductOrder>
The line items in this cart, each representing a product and quantity ordered.
setProductOrders(List<ProductOrder> productOrders)
Returns: void
Replaces the cart's list of line items. Prefer addLineItem for adding a single product, which also saves the new line item.
| Parameter | Description |
|---|---|
productOrders | the list of line items to hold on this cart |
getAdminOrg()
Returns: Organisation
The Kademi account holder organisation this cart belongs to.
setAdminOrg(Organisation adminOrg)
Returns: void
Sets the Kademi account holder organisation this cart belongs to.
| Parameter | Description |
|---|---|
adminOrg | the owning account organisation |
getWebsite()
Returns: Website
The website the order was placed on.
setWebsite(Website website)
Returns: void
Sets the website the order was placed on.
| Parameter | Description |
|---|---|
website | the website the cart was created on |
getAddressLine1()
Returns: String
First line of the cart's delivery street address.
setAddressLine1(String addressLine1)
Returns: void
Sets the first line of the cart's delivery street address.
| Parameter | Description |
|---|---|
addressLine1 | the first line of the delivery address |
getAddressLine2()
Returns: String
Second line of the cart's delivery street address, such as a unit or suite number.
setAddressLine2(String addressLine2)
Returns: void
Sets the second line of the cart's delivery street address, such as a unit or suite number.
| Parameter | Description |
|---|---|
addressLine2 | the second line of the delivery address |
getCity()
Returns: String
City or suburb of the cart's delivery address.
setCity(String city)
Returns: void
Sets the city or suburb of the cart's delivery address.
| Parameter | Description |
|---|---|
city | the delivery city or suburb |
getPostcode()
Returns: String
Postal or zip code of the cart's delivery address.
setPostcode(String postcode)
Returns: void
Sets the postal or zip code of the cart's delivery address.
| Parameter | Description |
|---|---|
postcode | the delivery postcode |
getAddressState()
Returns: String
State or province of the cart's delivery address.
setAddressState(String state)
Returns: void
Sets the state or province of the cart's delivery address.
| Parameter | Description |
|---|---|
state | the delivery state or province |
getCountry()
Returns: String
Country of the cart's delivery address.
setCountry(String country)
Returns: void
Sets the country of the cart's delivery address.
| Parameter | Description |
|---|---|
country | the delivery country |
getCartState()
Returns: ShoppingCartState
Where this cart is in the checkout lifecycle: PENDING while still being shopped, COMPLETED once submitted, or CANCELLED if abandoned by an administrator.
setCartState(ShoppingCartState cartState)
Returns: void
Moves the cart to a different point in the checkout lifecycle. Setting this directly only changes the stored state, it does not run any checkout or cancellation processing.
| Parameter | Description |
|---|---|
cartState | the state to put the cart in: PENDING, COMPLETED or CANCELLED |
getFulfilmentState()
Returns: String
The order's fulfilment status code, such as FULFILMENT_NOT_FULFILED, FULFILMENT_COMPLETE or FULFILMENT_DELETED.
setFulfilmentState(String fulfilmentState)
Returns: void
Sets the order's fulfilment status code. Use the FULFILMENT_NOT_FULFILED, FULFILMENT_COMPLETE and FULFILMENT_DELETED constants rather than literal strings.
| Parameter | Description |
|---|---|
fulfilmentState | the fulfilment status code to record |
getModifiedBy()
Returns: Profile
The profile who last modified this cart.
setModifiedBy(Profile modifiedBy)
Returns: void
Records the profile who last modified this cart. This is not maintained automatically, so a caller changing the cart is responsible for setting it.
| Parameter | Description |
|---|---|
modifiedBy | the profile that made the change |
getModifiedDate()
Returns: Date
Date this cart was last modified.
setModifiedDate(Date modifiedDate)
Returns: void
Records the date this cart was last modified. This is not maintained automatically, so a caller changing the cart is responsible for setting it.
| Parameter | Description |
|---|---|
modifiedDate | the date of the change |
getOrderNotes()
Returns: String
Free text notes attached to the order.
setOrderNotes(String orderNotes)
Returns: void
Sets the free text notes attached to the order. The column holds up to 10000 characters.
| Parameter | Description |
|---|---|
orderNotes | the notes to attach to the order |
getPromoCodesCsv()
Returns: String
Comma-separated list of promotional or voucher codes applied to this cart.
setPromoCodesCsv(String promoCodesCsv)
Returns: void
Sets the comma-separated list of promotional or voucher codes applied to this cart. Setting this records the codes only, it does not apply any discount.
| Parameter | Description |
|---|---|
promoCodesCsv | the applied promo codes as a comma-separated string |
getShippingProviderId()
Returns: String
Identifier of the shipping provider used to deliver this order.
setShippingProviderId(String shippingProviderId)
Returns: void
Sets the identifier of the shipping provider used to deliver this order. The column holds up to 50 characters.
| Parameter | Description |
|---|---|
shippingProviderId | the shipping provider's ID |
getTrackingCode()
Returns: String
Shipment tracking code issued by the shipping provider for this order.
setTrackingCode(String trackingCode)
Returns: void
Sets the shipment tracking code issued by the shipping provider for this order.
| Parameter | Description |
|---|---|
trackingCode | the tracking code to record against the order |
getIpAddress()
Returns: String
The client IP the order was placed from. Recorded so that fraud rules can ask how many orders have come from one address recently, which is not answerable from anything else on this record.
setIpAddress(String ipAddress)
Returns: void
Records the client IP the order was placed from, which fraud rules use to count recent orders from one address. The column holds up to 60 characters.
| Parameter | Description |
|---|---|
ipAddress | the client IP address, or null for an order placed outside a request |
getBillingAddress()
Returns: Address
The billing address recorded for this order, separate from the delivery address.
setBillingAddress(Address billingAddress)
Returns: void
Sets the billing address recorded for this order, which is held separately from the delivery address on the cart itself.
| Parameter | Description |
|---|---|
billingAddress | the billing address to record |
getBillingFirstName()
Returns: String
First name of the billing contact for this order.
setBillingFirstName(String billingFirstName)
Returns: void
Sets the first name of the billing contact for this order.
| Parameter | Description |
|---|---|
billingFirstName | the billing contact's first name |
getBillingSurName()
Returns: String
Surname of the billing contact for this order.
setBillingSurName(String billingSurName)
Returns: void
Sets the surname of the billing contact for this order.
| Parameter | Description |
|---|---|
billingSurName | the billing contact's surname |
getBillingCompany()
Returns: String
Company name of the billing contact for this order.
setBillingCompany(String billingCompany)
Returns: void
Sets the company name of the billing contact for this order.
| Parameter | Description |
|---|---|
billingCompany | the billing contact's company name |
getBillingPhone()
Returns: String
Phone number of the billing contact for this order.
setBillingPhone(String billingPhone)
Returns: void
Sets the phone number of the billing contact for this order.
| Parameter | Description |
|---|---|
billingPhone | the billing contact's phone number |
getSelectedPointsBucket()
Returns: Reward
The loyalty points reward bucket selected for this cart, when the order is being paid for with points.
setSelectedPointsBucket(Reward selectedPointsBucket)
Returns: void
Sets the loyalty points reward bucket the points for this order are redeemed from.
| Parameter | Description |
|---|---|
selectedPointsBucket | the reward bucket to redeem points from, or null if not using points |
getNumPoints()
Returns: BigDecimal
Number of loyalty points being redeemed against this cart.
setNumPoints(BigDecimal numPoints)
Returns: void
Sets the number of loyalty points being redeemed against this cart. Setting this records the intent only, it does not deduct any points.
| Parameter | Description |
|---|---|
numPoints | the number of points to redeem, or null if points are not being used |
getPointsParticipant()
Returns: BaseEntity
The entity the redeemed points came from. This may be the purchasing profile itself, or an organisation they have permission to redeem points from.
setPointsParticipant(BaseEntity pointsParticipant)
Returns: void
Sets the entity the redeemed points come from, which may be the purchasing profile itself or an organisation they are allowed to redeem points from.
| Parameter | Description |
|---|---|
pointsParticipant | the profile or organisation the points come from, or null if not using points |
getDeliveryNotes()
Returns: String
Courier or delivery instructions for this order, such as gate codes or drop-off preferences.
setDeliveryNotes(String deliveryNotes)
Returns: void
Sets the courier or delivery instructions for this order, such as gate codes or drop-off preferences. The column holds up to 2000 characters.
| Parameter | Description |
|---|---|
deliveryNotes | the delivery instructions to record |
getSource()
Returns: String
Where the customer said they heard about the store, captured at checkout.
setSource(String source)
Returns: void
Records where the customer said they heard about the store. The column holds up to 1000 characters.
| Parameter | Description |
|---|---|
source | the order source to record |
getPaymentProviderId()
Returns: String
Identifier of the PaymentProviderApplication used to process payment for this cart, whether for a standard ecommerce payment or a points-plus-pay payment.
setPaymentProviderId(String paymentProviderId)
Returns: void
Sets the identifier of the PaymentProviderApplication that processes payment for this cart, for either a standard ecommerce payment or a points-plus-pay payment.
| Parameter | Description |
|---|---|
paymentProviderId | the payment provider app's ID |
getPoNumber()
Returns: String
Purchase order number supplied by the customer for this order.
setPoNumber(String poNumber)
Returns: void
Sets the purchase order number supplied by the customer for this order.
| Parameter | Description |
|---|---|
poNumber | the customer's purchase order number |
getPaymentMethod()
Returns: String
Identifies the checkout method used, either "cash" or "points".
setPaymentMethod(String paymentMethod)
Returns: void
Sets the checkout method used for this cart, either "cash" or "points".
| Parameter | Description |
|---|---|
paymentMethod | the payment method to record |
getPaymentStateData()
Returns: String
Intermediate state data stored by the payment provider handling this cart, such as tokens needed to resume or confirm a payment.
setPaymentStateData(String paymentStateData)
Returns: void
Stores intermediate state data for the payment provider handling this cart, such as tokens needed to resume or confirm a payment. The column holds up to 10000 characters.
| Parameter | Description |
|---|---|
paymentStateData | the provider's state data to store |
getTotalCost()
Returns: BigDecimal
Sums the grand total of every line item in the cart. Note that this conventionally returns the ex-tax total.
getTotalTax()
Returns: BigDecimal
Sums the tax amount of every line item in the cart.
getTotalIncTax()
Returns: BigDecimal
The cart's total cost including tax, ie the sum of getTotalCost and getTotalTax.
item(Product product)
Returns: ProductOrder
Finds the line item in this cart for the given product.
| Parameter | Description |
|---|---|
product | the product to look for |
item(Long orderItemId)
Returns: ProductOrder
Returns the line item with the given id.
| Parameter | Description |
|---|---|
orderItemId | the id of the line item to look for |
numItems()
Returns: int
The number of line items in this cart.
getShippingAddress()
Returns: CartShippingAddress
A read-only view of this cart's delivery address, exposed as a plain IReadableAddress for use by payment provider and shipping integrations.
isPending()
Returns: boolean
True if this cart has not been submitted yet, ie the customer is still shopping. False once the customer has submitted the order.
isSubmitted()
Returns: boolean
True if the shopping cart has been submitted, ie the customer has placed the order.
getActivatedPromotions()
Returns: Set<Reward>
The promotional rewards that have been activated against this cart.
getTotalQuantity()
Returns: BigDecimal
Sums the ordered quantity across every line item in the cart.
isFulfilmentComplete()
Returns: boolean
True if the order's fulfilment state is FULFILMENT_COMPLETE.
addProductOrder()
Returns: ProductOrder
Creates a new, empty line item, adds it to this cart's line items and returns it for the caller to populate.
getStore()
Returns: ECommerceStore
The ecommerce store this cart's order was placed through, taken from the first line item that has one.
getAuditOrg()
Returns: Organisation
The organisation that audit entries for changes to this cart are recorded against, per the Auditable interface.
getCustomer()
Returns: BaseEntity
Alias of getProfile, for compatibility with the ISale interface.
getTotalListPrice()
Returns: BigDecimal
Alias for getTotalCost, for compatibility with the ISale interface.
getVendor()
Returns: BaseEntity
Alias for getAdminOrg, for compatibility with the ISale interface.