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

PropertyReturnsDescription
currencyCurrencyGets the currency for the given resource
productProductProduct the item being purchased is based on.
productDescriptionStringDescription of the item being purchased, for display in the cart.
productImageHrefStringURL of an image representing the item being purchased.
productItemEntityNameStringReturn the hibernate entity name of the item being purchased, eg Product, Auction, etc
productItemIdLongThe unique, immutable, physical identifier for the item being purchased. Not name, SKU, etc, should be the Kademi database identifier
productLocationsList<ProductInLocation>Locations the item is available in, for items that are location-specific.
productPurchaseCostBigDecimalCost of purchasing the item with its default purchase options.
productSkuProductSkuSKU of the item being purchased.
productTitleStringTitle of the item being purchased, for display in the cart.
selectedPurchaseOptionsMap<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.

ParameterDescription
purchaseOptionsthe 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.

ParameterDescription
purchaseOptionsthe 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.

ParameterDescription
purchaseOptionsthe 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.

ParameterDescription
cthe cart the item was purchased through
pothe product order created for the purchase
quantitythe quantity purchased
selectedParamsthe purchase option values selected by the customer, keyed by option name
purchaseAmountthe calculated purchase amount
itemAmountthe 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.

ParameterDescription
selectedParameterOptionsthe 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.

ParameterDescription
unitCostthe unit cost to calculate tax on
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.