Represents a discount applied to an existing shopping cart line item by a promotion or reward. It carries the discount amount and description and, when added to the cart, sets those directly on the item being discounted rather than adding a new line item of its own.
Implements: IPromotionItem
Properties
| Property | Returns | Description |
|---|---|---|
| amount | BigDecimal | The discount amount. A positive value represents an added cost, a negative value represents a discount off the item's price. |
| currency | Currency | The currency the discount amount is denominated in. |
| description | String | Human readable reason for the discount, shown against the discounted line item. |
| discountOn | ShoppingCartItemBean | The existing cart line item that this discount is applied to. |
| promotion | RewardFolder | The reward or promotion folder that granted this discount. |
Methods
getAmount()
Returns: BigDecimal
The discount amount. A positive value represents an added cost, a negative value represents a discount off the item's price.
getDescription()
Returns: String
Human readable reason for the discount, shown against the discounted line item.
getPromotion()
Returns: RewardFolder
The reward or promotion folder that granted this discount.
getDiscountOn()
Returns: ShoppingCartItemBean
The existing cart line item that this discount is applied to.
getCurrency()
Returns: Currency
The currency the discount amount is denominated in.
addToCart(List<ShoppingCartItemBean> scib)
Returns: void
Applies the discount by setting the discount amount and reason directly on the target line item, rather than adding a new item to the given list.
| Parameter | Description |
|---|---|
scib | the current list of shopping cart items, not modified by this implementation |
addToDebits(List<DebitItem> debitList)
Returns: void
Does nothing, because the discount has already been applied to the target item's own discount fields by addToCart rather than contributing a separate debit.
| Parameter | Description |
|---|---|
debitList | the current list of debit items, not modified by this implementation |