public interface PromotionMgrIf
Modifier and Type | Method and Description |
---|---|
int |
checkCoupon(java.lang.String couponCode)
This method is used to verify whether a coupon code actually exists and if it does, whether
the coupon is still active.
|
Promotion[] |
getAllPromotions()
Returns an array of all active promotions
|
Coupon |
getCouponPerId(int couponId,
CouponOptionsIf options)
Returns a coupon for the coupon id passed in as a parameter.
|
Coupon[] |
getCouponsPerCode(java.lang.String couponCode,
CouponOptionsIf options)
Returns an array of coupons for the coupon code passed in as a parameter.
|
PromotionIf |
getPromotion(int promotionId,
java.lang.String promotionName,
int languageId,
FetchPromotionOptionsIf prmOptions,
FetchProductOptionsIf prodOptions)
This API call is used to retrieve a single promotion matching an id or name.
|
int |
getPromotionIdForGiftCertificate(OrderProductIf op)
Get the promotion id for an order product object containing a gift certificate.
|
Promotion[] |
getPromotions(java.lang.String orderTotalCode,
Order order)
We return all active promotions for the orderTotalCode passed in as a parameter.
|
Promotion[] |
getPromotionsPerCoupon(java.lang.String couponCode,
int couponId,
PromotionOptionsIf options)
This method is used to return an array of promotions associated with the coupon(s) identified
by the input parameters.
|
ProductIf[] |
getPromotionsPerProducts(java.lang.String sessionId,
int customerId,
ProductIf[] products,
PromotionIf[] promotions,
java.lang.String[] couponCodes,
PromotionOptionsIf options)
This method is used to calculate a discount on individual products so that the discount can
be displayed without having to add the product to the cart.
The method receives an array of products and returns an array of products with attached PromotionResult objects that contain the results of one or more of the promotions passed in as a parameter. |
int |
getPromotionUsageCountMaxRetries() |
int |
insertCoupon(CouponIf coupon,
int promotionId)
Insert a coupon and associate it with the promotion referenced by promotionId.
|
void |
refreshConfigs()
Refresh the configuration of the Promotion manager
|
void |
setPromotionUsageCountMaxRetries(int promotionUsageCountMaxRetries)
The maximum number of optimistic concurrency retries when setting the promotion usage count
|
void |
updatePromotionUsage(Order order)
If the order has any associated coupons we iterate through the coupons and increment the
timesUsed attribute.
|
Promotion[] getPromotions(java.lang.String orderTotalCode, Order order) throws java.lang.Exception
orderTotalCode
- the orderTotalCodeorder
- the orderjava.lang.Exception
- an unexpected exceptionvoid updatePromotionUsage(Order order) throws java.lang.Exception
order
- the orderjava.lang.Exception
- an unexpected exceptionint getPromotionIdForGiftCertificate(OrderProductIf op) throws com.konakart.app.KKException, org.apache.torque.TorqueException, com.workingdogs.village.DataSetException
op
- the opcom.konakart.app.KKException
- an unexpected KKException exceptionorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)int insertCoupon(CouponIf coupon, int promotionId) throws java.lang.Exception
coupon
- the couponpromotionId
- the promotionIdjava.lang.Exception
- an unexpected exceptionint checkCoupon(java.lang.String couponCode) throws com.workingdogs.village.DataSetException, org.apache.torque.TorqueException
couponCode
- The coupon codecom.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)org.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)Promotion[] getAllPromotions() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionProductIf[] getPromotionsPerProducts(java.lang.String sessionId, int customerId, ProductIf[] products, PromotionIf[] promotions, java.lang.String[] couponCodes, PromotionOptionsIf options) throws java.lang.Exception
sessionId
- Only used if the customer is logged in. Otherwise set to null.customerId
- If the sessionId is set to null then the customerId should contain the id of the
temporary user which is a negative number. The temporary user id can be used for
evaluating expression rules.products
- An array of products to be processedpromotions
- The promotions which will be applied to the products if all rules are matched.couponCodes
- Coupon codes to use. If none of the promotions require coupons, it should be set
to nulloptions
- An object containing information to configure the calculation for applying one or
more promotion results to the product price.java.lang.Exception
- an unexpected exceptionvoid refreshConfigs() throws java.lang.Exception
java.lang.Exception
- an unexpected exceptionCoupon[] getCouponsPerCode(java.lang.String couponCode, CouponOptionsIf options) throws java.lang.Exception
The options object allows you to specify that only active coupons should be returned.
couponCode
- the couponCodeoptions
- Allows you to specify that only active coupons should be returnedjava.lang.Exception
- an unexpected exceptionCoupon getCouponPerId(int couponId, CouponOptionsIf options) throws java.lang.Exception
The options object allows you to specify that only active coupons should be returned.
couponId
- the couponIdoptions
- Allows you to specify that only active coupons should be returnedjava.lang.Exception
- an unexpected exceptionPromotion[] getPromotionsPerCoupon(java.lang.String couponCode, int couponId, PromotionOptionsIf options) throws java.lang.Exception
The PromotionOptions may be used to control whether or not to use expired coupons and whether or not to return expired promotions. The default is to not check whether coupons or promotions have expired.
If no promotions are found, an empty array is returned.
couponCode
- The code of the couponcouponId
- The unique numeric id of the couponoptions
- A PromotionOptions object to control whether or not to use expired coupons and
whether or not to return expired promotionsjava.lang.Exception
- an unexpected exceptionint getPromotionUsageCountMaxRetries()
void setPromotionUsageCountMaxRetries(int promotionUsageCountMaxRetries)
promotionUsageCountMaxRetries
- the promotionUsageCountMaxRetries to setPromotionIf getPromotion(int promotionId, java.lang.String promotionName, int languageId, FetchPromotionOptionsIf prmOptions, FetchProductOptionsIf prodOptions) throws java.lang.Exception
The purpose of this method is mainly to determine what products, manufacturers or categories
are included or excluded from the promotion in order to be able to display this information
on the storefront. However if the FetchPromotionOptions
is configured to only
return the promotion if active, then we check the following:
couponCodes
attribute of the FetchPromotionOptions
object has been populated and the promotion requires a coupon then we check that at least one
coupon will activate the promotion.promotionId
- The numeric id of the promotion used to identify it. It should be set to a
negative number in order to search for the promotion using the promotion name.promotionName
- If not set to null, the promotion name is used to search for the promotion instead
of the numeric id.languageId
- The id for the language that will be used when creating the attached products,
categories and manufacturers. Value of -1 selects the default language.prmOptions
- A FetchPromotionOptions object used to configure the API call. It may be set to
null for default functionality.prodOptions
- A FetchProductOptions used to configure the products (if any) attached to the
promotion. It may be set to null for default functionality.java.lang.Exception
- an unexpected exceptionCopyright © 2018 DS Data Systems UK Ltd.