|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface PromotionRuleDelegate
This interface provides helper methods that can be invoked from Drools code to make queries on the system. The intent of this interface/implementation is to move as much logic as possible out of the rule code so that the drools code is as simple as possible. Note: If rules require a helper method that would be useful to other domain objects, move the helper/convenience method to the domain model rather than implementing it here.
| Method Summary | |
|---|---|
void |
applyCartSkuDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
java.lang.String skuCode,
java.lang.String amount,
int maxItems,
java.lang.String exceptionStr)
Apply a discount amount to a product in the cart. |
void |
applyCartSkuDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
java.lang.String skuCode,
java.lang.String percent,
int maxItems,
java.lang.String exceptionStr)
Apply a discount amount to a product in the cart. |
void |
applyCatalogProductDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
Product product,
java.util.Currency currency,
java.lang.String amount,
java.lang.String exceptionStr)
Reduces the price of a product by the specified amount. |
void |
applyCatalogSkuDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
Product product,
java.lang.String skuCode,
java.util.Currency currency,
java.lang.String amount)
Reduces the price of a sku by the specified amount. |
void |
applyCatalogSkuDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
Product product,
java.lang.String skuCode,
java.util.Currency currency,
java.lang.String percent)
Reduces the price of a sku by the specified amount. |
void |
applyNFreeSkus(ShoppingCart shoppingCart,
long ruleId,
java.lang.String skuCode,
int numSkus)
Add N items of a product to the cart at a zero price. |
void |
applyNthProductDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
long productId,
java.lang.String percent,
int nthItem,
java.lang.String exceptionStr)
Apply a percentage discount to the Nth item of a given product in the cart. |
void |
applyOrderCategoryDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
long categoryId,
java.lang.String amount,
int maxItems,
java.lang.String exceptionStr)
Apply a discount amount to all items in a particular category in the cart. |
void |
applyOrderCategoryDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
long categoryId,
java.lang.String percent,
int maxItems,
java.lang.String exceptionStr)
Apply a percentage discount to all items in a particular category in the cart. |
void |
applyOrderDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
java.lang.String amount)
Reduces the subtotal of the shopping cart by the specified amount. |
void |
applyOrderDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
java.lang.String percent)
Reduces the subtotal of the shopping cart by the specified percent. |
void |
applyProductDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
long productId,
java.lang.String amount,
int maxItems,
java.lang.String exceptionStr)
Apply a discount amount to a product in the cart. |
void |
applyProductDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
long productId,
java.lang.String percent,
int maxItems,
java.lang.String exceptionStr)
Apply a percentage discount to a product in the cart. |
void |
applyProductDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
Product product,
java.util.Currency currency,
java.lang.String percent,
java.lang.String exceptionStr)
Reduces the price of a product by the specified amount. |
void |
applyShippingDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
java.lang.String amount,
long shippingMethodId)
Reduces the shipping cost of the shopping cart by the specified amount. |
void |
applyShippingDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
java.lang.String percent,
long shippingMethodId)
Reduces the shipping cost of the shopping cart by the specified percent. |
boolean |
cartContainsItemsOfCategory(ShoppingCart shoppingCart,
long categoryId,
int numItems,
java.lang.String exceptionStr)
Checks if the shopping cart contains the specified quantity of items of the given product. |
boolean |
cartContainsProduct(ShoppingCart shoppingCart,
long productId,
int quantity,
java.lang.String exceptionStr)
Checks if the shopping cart contains the specified quantity of items of the given product. |
boolean |
cartContainsSku(ShoppingCart shoppingCart,
java.lang.String skuCode,
int quantity)
Checks if the shopping cart contains the specified quantity of items with the specified sku code. |
boolean |
cartCurrencyMatches(ShoppingCart shoppingCart,
java.lang.String currencyCode)
Checks if the currency of a shopping cart matches the specified currency code. |
boolean |
cartHasPromoCode(ShoppingCart shoppingCart,
java.lang.String promoCode)
Checks if the shopping cart has the specified promo code entered by the user. |
boolean |
cartSubtotalExceeds(ShoppingCart shoppingCart,
java.lang.String amount,
java.lang.String exceptionStr)
Checks if the shopping cart subtotal exceeds the specified amount. |
boolean |
catalogBrandIs(Product product,
boolean isBrand,
java.lang.String brandCode,
java.lang.String exceptionStr)
Returns true if the given product is/is not of the specified brand. |
boolean |
catalogProductInCategory(Product product,
boolean isIn,
long categoryUid,
java.lang.String exceptionStr)
Checks if the given product is in the category with the specified categoryID. |
boolean |
catalogProductIs(Product product,
boolean isProduct,
long productUid,
java.lang.String exceptionStr)
Returns true if the given product is/is not the product with the specified Id. |
boolean |
checkDateRange(java.lang.String startDateString,
java.lang.String endDateString)
Checks that the current date is between the specified dates. |
boolean |
customerInGroup(ShoppingCart shoppingCart,
long customerGroup)
Checks if the customer is in the specified customer group. |
boolean |
isExistingCustomer(ShoppingCart shoppingCart)
Checks if the customer already has an account in the system. |
boolean |
isFirstTimeBuyer(ShoppingCart shoppingCart)
Checks if the customer is a first time buyer. |
| Methods inherited from interface com.elasticpath.domain.Persistence |
|---|
executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk |
| Methods inherited from interface com.elasticpath.domain.EpDomain |
|---|
getElasticPath, setElasticPath |
| Method Detail |
|---|
void applyCartSkuDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
java.lang.String skuCode,
java.lang.String amount,
int maxItems,
java.lang.String exceptionStr)
shoppingCart - the shopping cart to have a discountedruleId - the id of the rule executing this actionskuCode - the sku code of the sku to be discountedamount - the amount of the discountmaxItems - the maximum number of items to apply the promotion to. Set to zero for unlimited.exceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
void applyCartSkuDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
java.lang.String skuCode,
java.lang.String percent,
int maxItems,
java.lang.String exceptionStr)
shoppingCart - the shopping cart to have a discountedruleId - the id of the rule executing this actionskuCode - the sku code of the sku to be discountedpercent - the percentage of the promotion X 100 (e.g. 50 means 50% off).maxItems - the maximum number of items to apply the promotion to. Set to zero for unlimited.exceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
void applyCatalogProductDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
Product product,
java.util.Currency currency,
java.lang.String amount,
java.lang.String exceptionStr)
shoppingCart - the customer's shopping cartruleId - the id of the rule executing this actionproduct - the product to be discountedcurrency - the Currency of the price to be reducedamount - the percentage of the promotion X 100 (e.g. 50 means 50% off).exceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
void applyCatalogSkuDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
Product product,
java.lang.String skuCode,
java.util.Currency currency,
java.lang.String amount)
shoppingCart - the customer's shopping cartruleId - the id of the rule executing this actionproduct - the product containing the SKU to be discountedskuCode - the SKU code for the sku to be discountedcurrency - the Currency of the price to be reducedamount - the percentage of the promotion X 100 (e.g. 50 means 50% off).
void applyCatalogSkuDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
Product product,
java.lang.String skuCode,
java.util.Currency currency,
java.lang.String percent)
shoppingCart - the customer's shopping cartruleId - the id of the rule executing this actionproduct - the product containing the SKU to be discountedskuCode - the SKU code for the sku to be discountedcurrency - the Currency of the price to be reducedpercent - the percentage of the promotion X 100 (e.g. 50 means 50% off).
void applyNFreeSkus(ShoppingCart shoppingCart,
long ruleId,
java.lang.String skuCode,
int numSkus)
shoppingCart - the shopping cart to have products discountedruleId - the id of the rule executing this actionskuCode - the sku code of the sku to be added to the cartnumSkus - the number of items to give for free
void applyNthProductDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
long productId,
java.lang.String percent,
int nthItem,
java.lang.String exceptionStr)
shoppingCart - the shopping cart to have products discountedruleId - the id of the rule executing this actionproductId - the id of the product to be discountedpercent - the percentage of the promotion X 100 (e.g. 50 means 50% off, 100 means free).nthItem - the number of items that must be present before one is discountedexceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
void applyOrderCategoryDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
long categoryId,
java.lang.String amount,
int maxItems,
java.lang.String exceptionStr)
shoppingCart - the shopping cart to have items in a category discountedruleId - the id of the rule executing this actioncategoryId - the id of the category that the promotion applies toamount - the amount by which the price is to be reducedmaxItems - the maximum number of items to apply the promotion to. Set to zero for unlimited.exceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
void applyOrderCategoryDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
long categoryId,
java.lang.String percent,
int maxItems,
java.lang.String exceptionStr)
shoppingCart - the shopping cart to have items in a category discountedruleId - the id of the rule executing this actioncategoryId - the id of the category that the promotion applies topercent - the percentage of the promotion X 100 (e.g. 50 means 50% off).maxItems - the maximum number of items to apply the promotion to. Set to zero for unlimited.exceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
void applyOrderDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
java.lang.String amount)
shoppingCart - the shopping cart that the discount is to be applied toruleId - the id of the rule executing this actionamount - the amount by which to reduce the subtotal
void applyOrderDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
java.lang.String percent)
shoppingCart - the shopping cart that the discount is to be applied toruleId - the id of the rule executing this actionpercent - the percent by which to reduce the subtotal
void applyProductDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
long productId,
java.lang.String amount,
int maxItems,
java.lang.String exceptionStr)
shoppingCart - the shopping cart to have a discountedruleId - the id of the rule executing this actionproductId - the id of the product to be discountedamount - the amount of the discountmaxItems - the maximum number of items to apply the promotion to. Set to zero for unlimited.exceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
void applyProductDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
long productId,
java.lang.String percent,
int maxItems,
java.lang.String exceptionStr)
shoppingCart - the shopping cart to have a discountedruleId - the id of the rule executing this actionproductId - the id of the product to be discountedpercent - the percentage of the promotion X 100 (e.g. 50 means 50% off, 100 means free).maxItems - the maximum number of items to apply the promotion to. Set to zero for unlimited.exceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
void applyProductDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
Product product,
java.util.Currency currency,
java.lang.String percent,
java.lang.String exceptionStr)
shoppingCart - the customer's shopping cartruleId - the id of the rule executing this actionproduct - the product to be discountedcurrency - the Currency of the price to be reducedpercent - the amount that the price should be reducedexceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
void applyShippingDiscountAmount(ShoppingCart shoppingCart,
long ruleId,
java.lang.String amount,
long shippingMethodId)
shoppingCart - the shopping cart that the shipping discount is to be applied toruleId - the id of the rule executing this actionamount - the amount by which to reduce the shipping costshippingMethodId - the shipping method that this discount applies to
void applyShippingDiscountPercent(ShoppingCart shoppingCart,
long ruleId,
java.lang.String percent,
long shippingMethodId)
shoppingCart - the shopping cart that the shipping discount is to be applied toruleId - the id of the rule executing this actionpercent - the percent by which to reduce the shipping cost (String value from 1 to 100)shippingMethodId - the shipping method that this discount applies to
boolean cartContainsItemsOfCategory(ShoppingCart shoppingCart,
long categoryId,
int numItems,
java.lang.String exceptionStr)
shoppingCart - the shopping cart to checkcategoryId - the category id that must be in the cartnumItems - the minimum quantity of items of the category that must be presentexceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
quantity items with productId in the cart
boolean cartContainsProduct(ShoppingCart shoppingCart,
long productId,
int quantity,
java.lang.String exceptionStr)
shoppingCart - the shopping cart to checkproductId - the sku code that must be in the cartquantity - the minimum quantity of the product that must be presentexceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
quantity items with productId in the cart
boolean cartContainsSku(ShoppingCart shoppingCart,
java.lang.String skuCode,
int quantity)
shoppingCart - the shopping cart to checkskuCode - the sku code that must be in the cartquantity - the minimum quantity of the sku that must be present
quantity items with skuCode in the cart
boolean cartCurrencyMatches(ShoppingCart shoppingCart,
java.lang.String currencyCode)
shoppingCart - The shopping cart to checkcurrencyCode - The currency code, e.g. CAD
boolean cartHasPromoCode(ShoppingCart shoppingCart,
java.lang.String promoCode)
shoppingCart - the shopping cart to check for the promo codepromoCode - the promo code to check for.
boolean cartSubtotalExceeds(ShoppingCart shoppingCart,
java.lang.String amount,
java.lang.String exceptionStr)
shoppingCart - the shopping cart to checkamount - the amount the shopping cart must exceedexceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
boolean catalogBrandIs(Product product,
boolean isBrand,
java.lang.String brandCode,
java.lang.String exceptionStr)
product - the product whose condition is to be checkedisBrand - set to true to check that the brand is the one with the specified Id, or false to check that it is
not the brand with the specified id.brandCode - the code of the brand to check forexceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
boolean catalogProductInCategory(Product product,
boolean isIn,
long categoryUid,
java.lang.String exceptionStr)
product - the productisIn - set to true to specify that the product is in the category, false to require that it isn't in the categorycategoryUid - the id of the category to check if the product is in itexceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
boolean catalogProductIs(Product product,
boolean isProduct,
long productUid,
java.lang.String exceptionStr)
product - the product whose condition is to be checkedisProduct - set to true to check that the product is the one with the specified Id, or false to check that it is
not the product with the specified id.productUid - the id of the product to check forexceptionStr - exceptions to this rule element; to be used to populate the PromotionRuleExceptions.
boolean checkDateRange(java.lang.String startDateString,
java.lang.String endDateString)
startDateString - the start date represented as a long (milliseconds) in a string. 0 means no start date restriction on the date range.endDateString - the end date represented as a long (milliseconds) in a string. 0 means no end date. Longs are not supported by Drools so
the dates are passed as strings.
boolean customerInGroup(ShoppingCart shoppingCart,
long customerGroup)
shoppingCart - the shopping cart containing a reference to the customercustomerGroup - the customer group that the customer must belong to
boolean isExistingCustomer(ShoppingCart shoppingCart)
shoppingCart - the shopping cart containing a reference to the customer
boolean isFirstTimeBuyer(ShoppingCart shoppingCart)
shoppingCart - the shopping cart containing a reference to the customer
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||