Interface PromotionActionService
- All Known Implementing Classes:
DefaultPromotionActionService
public interface PromotionActionService
Encapsulates logic for taking actions to apply promotions.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcreateDiscountValue(DiscountRAO discountRao, String code, AbstractOrderEntryModel orderEntry) Creates aDiscountValuefrom the givendiscountRaoand adds it to the givenorderEntry.voidcreateDiscountValue(DiscountRAO discountRao, String code, AbstractOrderModel order) Creates aDiscountValuefrom the givendiscountRaoand adds it to the givenorder.Creates aPromotionResultModelobject for the givenAbstractRuleActionRAO.getOrder(AbstractRuleActionRAO action) Returns the order for the givenaction.getOrderEntry(AbstractRuleActionRAO action) Looks up theAbstractOrderEntryModelbased on the given AbstractRuleActionRAO.getRule(AbstractRuleActionRAO action) Returns the rule for the givenaction.voidrecalculateFiredPromotionMessage(PromotionResultModel promoResult) Recalculates promotion fired message and stores it in providedPromotionResultModel.voidRecalculates totals for the givenorder.removeDiscountValue(String code, AbstractOrderModel order) Removes theDiscountValuewith the given code from the givenorderand its order entries.
-
Method Details
-
recalculateFiredPromotionMessage
Recalculates promotion fired message and stores it in providedPromotionResultModel. This method should be used for potential promotion only to update computed values displayed in the message- Parameters:
promoResult- a promotion result that holds fired promotion message which needs to be updated
-
createPromotionResult
Creates aPromotionResultModelobject for the givenAbstractRuleActionRAO.- Parameters:
action- the action rao to use for the promotion result creation- Returns:
- the newly created (not persisted!)
PromotionResultModel.
-
createDiscountValue
Creates aDiscountValuefrom the givendiscountRaoand adds it to the givenorder. Note: The order is not saved!- Parameters:
discountRao- the discountRao to take the values fromcode- the code for the new DiscountValue (e.g. UUID from the respectiveAbstractPromotionActionModelthat creates this discount)order- the order to apply the discount value to
-
removeDiscountValue
Removes theDiscountValuewith the given code from the givenorderand its order entries. Returns the list of all modified items (order, order entries). Note: The returned items are not saved!- Parameters:
code- the code for the DiscountValue to be removedorder- the order to remove the discount value from- Returns:
- all items (order, order entries) that have been modified and need saving
-
createDiscountValue
Creates aDiscountValuefrom the givendiscountRaoand adds it to the givenorderEntry. Note: The orderEntry is not saved!- Parameters:
discountRao- the discountRao to take the values fromcode- the code for the new DiscountValue (e.g. UUID from the respectiveAbstractPromotionActionModelthat creates this discount)orderEntry- the orderEntry to apply the discount value to
-
getOrderEntry
Looks up theAbstractOrderEntryModelbased on the given AbstractRuleActionRAO.- Parameters:
action- the action to use for the look-up- Returns:
- the AbstractOrderEntryModel
-
getOrder
Returns the order for the givenaction.- Parameters:
action- the orderRao- Returns:
- the order or null if no order is found
-
getRule
Returns the rule for the givenaction.- Parameters:
action- the action rao- Returns:
- the rule or null if no rule is found
-
recalculateTotals
Recalculates totals for the givenorder.- Parameters:
order- the order to recalculate its totals
-