Contract implemented by resources that can be purchased through the shopping cart, such as products. A resource implementing this interface supplies the pricing, description and identification needed to build a ShoppingCartItemBean line item, and the behaviour needed to turn a purchase into a ProductOrder on a Cart. Implementations are looked up by the shopping cart machinery when a purchasable item is added to, or ordered from, a cart.
Group: Resources
Extends: CommonResource
Properties
| Property | Returns | Description |
|---|---|---|
| currency | Currency | Gets the currency for the given resource |
| product | Product | Product the item being purchased is based on. |
| productDescription | String | Description of the item being purchased, for display in the cart. |
| productImageHref | String | URL of an image representing the item being purchased. |
| productItemEntityName | String | Return the hibernate entity name of the item being purchased, eg Product, Auction, etc |
| productItemId | Long | The unique, immutable, physical identifier for the item being purchased. Not name, SKU, etc, should be the Kademi database identifier |
| productLocations | List<ProductInLocation> | Locations the item is available in, for items that are location-specific. |
| productPurchaseCost | BigDecimal | Cost of purchasing the item with its default purchase options. |
| productSku | ProductSku | SKU of the item being purchased. |
| productTitle | String | Title of the item being purchased, for display in the cart. |
| selectedPurchaseOptions | Map<String,String> | Purchase option values previously selected by the customer for this item. |
Methods
getProductItemId() · getProductItemEntityName() · getPurchaseAmount(Map<String,String> purchaseOptions) · getProductDescription() · getProductImageHref() · getProductTitle() · getProductPurchaseCost() · productPurchaseCost(Map<String,String> purchaseOptions) · getProductLocations() · getProductSku() · getProduct() · setSelectedParameterOptions(Map<String,String> purchaseOptions) · getSelectedPurchaseOptions() · getCurrency() · onPurchased(Cart c, ProductOrder po, BigDecimal quantity, Map<String,String> selectedParams, PurchaseAmount purchaseAmount, BigDecimal itemAmount) · unitCost(Map<String,String> selectedParameterOptions) · taxAmount(BigDecimal unitCost)
getProductItemId()
Returns: Long
The unique, immutable, physical identifier for the item being purchased. Not name, SKU, etc, should be the Kademi database identifier
getProductItemEntityName()
Returns: String
Return the hibernate entity name of the item being purchased, eg Product, Auction, etc
getPurchaseAmount(Map<String,String> purchaseOptions)
Returns: PurchaseAmount
Calculates the amount to charge for this item given the customer's selected purchase options, including any per-option price adjustments.
| Parameter | Description |
|---|---|
purchaseOptions | the purchase option values selected by the customer, keyed by option name |
getProductDescription()
Returns: String
Description of the item being purchased, for display in the cart.
getProductImageHref()
Returns: String
URL of an image representing the item being purchased.
getProductTitle()
Returns: String
Title of the item being purchased, for display in the cart.
getProductPurchaseCost()
Returns: BigDecimal
Cost of purchasing the item with its default purchase options.
productPurchaseCost(Map<String,String> purchaseOptions)
Returns: BigDecimal
Calculates the cost of purchasing the item with the given purchase options selected.
| Parameter | Description |
|---|---|
purchaseOptions | the purchase option values selected by the customer, keyed by option name |
getProductLocations()
Returns: List<ProductInLocation>
Locations the item is available in, for items that are location-specific.
getProductSku()
Returns: ProductSku
SKU of the item being purchased.
getProduct()
Returns: Product
Product the item being purchased is based on.
setSelectedParameterOptions(Map<String,String> purchaseOptions)
Returns: void
Sets the purchase option values selected by the customer for this item.
| Parameter | Description |
|---|---|
purchaseOptions | the purchase option values to select, keyed by option name |
getSelectedPurchaseOptions()
Returns: Map<String,String>
Purchase option values previously selected by the customer for this item.
getCurrency()
Returns: Currency
Gets the currency for the given resource
onPurchased(Cart c, ProductOrder po, BigDecimal quantity, Map<String,String> selectedParams, PurchaseAmount purchaseAmount, BigDecimal itemAmount)
Returns: void
Called after the item has been purchased, so the implementation can carry out any follow-up work such as adjusting stock or recording the sale.
| Parameter | Description |
|---|---|
c | the cart the item was purchased through |
po | the product order created for the purchase |
quantity | the quantity purchased |
selectedParams | the purchase option values selected by the customer, keyed by option name |
purchaseAmount | the calculated purchase amount |
itemAmount | the amount charged for this item |
unitCost(Map<String,String> selectedParameterOptions)
Returns: BigDecimal
Calculates the cost of a single unit of the item, before tax, with the given purchase options selected.
| Parameter | Description |
|---|---|
selectedParameterOptions | the purchase option values selected by the customer, keyed by option name |
taxAmount(BigDecimal unitCost)
Returns: BigDecimal
Calculates the tax payable on the given unit cost.
| Parameter | Description |
|---|---|
unitCost | the unit cost to calculate tax on |