Class ProductPromoWorker
- java.lang.Object
-
- org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker
-
public final class ProductPromoWorker extends java.lang.Object
ProductPromoWorker - Worker class for catalog/product promotion related functionality
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProductPromoWorker.ActionResultInfo
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
module
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
checkCanUsePromoCode(java.lang.String productPromoCodeId, java.lang.String partyId, Delegator delegator, java.util.Locale locale)
static java.lang.String
checkCanUsePromoCode(java.lang.String productPromoCodeId, java.lang.String partyId, Delegator delegator, ShoppingCart cart, java.util.Locale locale)
static boolean
checkConditionForItem(GenericValue productPromoCond, ShoppingCart cart, ShoppingCartItem cartItem, Delegator delegator, LocalDispatcher dispatcher, java.sql.Timestamp nowTimestamp)
static int
checkConditionPartyHierarchy(Delegator delegator, java.sql.Timestamp nowTimestamp, java.lang.String groupPartyId, java.lang.String partyId)
static boolean
checkConditionsForItem(GenericValue productPromoActionOrCond, ShoppingCart cart, ShoppingCartItem cartItem, Delegator delegator, LocalDispatcher dispatcher, java.sql.Timestamp nowTimestamp)
static void
distributeDiscountAmount(java.math.BigDecimal discountAmountTotal, java.math.BigDecimal totalAmount, java.util.List<ShoppingCartItem> cartItemsUsed, GenericValue productPromoAction, Delegator delegator)
static void
doOrderItemPromoAction(GenericValue productPromoAction, ShoppingCartItem cartItem, java.math.BigDecimal amount, java.lang.String amountField, Delegator delegator)
static void
doOrderPromoAction(GenericValue productPromoAction, ShoppingCart cart, java.math.BigDecimal amount, java.lang.String amountField, Delegator delegator)
static void
doPromotions(ShoppingCart cart, java.util.List<GenericValue> productPromoList, LocalDispatcher dispatcher)
static void
doPromotions(ShoppingCart cart, LocalDispatcher dispatcher)
static java.lang.Integer
findPromoItem(GenericValue productPromoAction, ShoppingCart cart)
static java.util.List<GenericValue>
getAgreementPromotions(ShoppingCart cart, java.sql.Timestamp nowTimestamp, LocalDispatcher dispatcher)
static java.util.List<ShoppingCartItem>
getCartItemsUsed(ShoppingCart cart, GenericValue productPromoAction)
static java.math.BigDecimal
getCartItemsUsedTotalAmount(ShoppingCart cart, GenericValue productPromoAction)
static java.lang.Long
getProductPromoCodeUseLimit(GenericValue productPromoCode, java.lang.String partyId, Delegator delegator)
static java.lang.Long
getProductPromoUseLimit(GenericValue productPromo, java.lang.String partyId, Delegator delegator)
calculate low use limit for this promo for the current "order", check per order, customer, promostatic java.util.List<GenericValue>
getProductStorePromotions(ShoppingCart cart, java.sql.Timestamp nowTimestamp, LocalDispatcher dispatcher)
static java.util.Set<java.lang.String>
getPromoRuleActionProductIds(GenericValue productPromoAction, Delegator delegator, java.sql.Timestamp nowTimestamp)
static java.util.Set<java.lang.String>
getPromoRuleCondProductIds(GenericValue productPromoCond, Delegator delegator, java.sql.Timestamp nowTimestamp)
static java.util.Set<java.lang.String>
getStoreProductPromoCodes(ShoppingCart cart)
static java.util.List<GenericValue>
getStoreProductPromos(Delegator delegator, LocalDispatcher dispatcher, javax.servlet.ServletRequest request)
static java.lang.String
makeAutoDescription(GenericValue productPromo, Delegator delegator, java.util.Locale locale, LocalDispatcher dispatcher)
static void
makeProductPromoCondActionIdSets(java.lang.String productPromoId, java.util.Set<java.lang.String> productIdsCond, java.util.Set<java.lang.String> productIdsAction, Delegator delegator, java.sql.Timestamp nowTimestamp)
static void
makeProductPromoCondActionIdSets(java.lang.String productPromoId, java.util.Set<java.lang.String> productIdsCond, java.util.Set<java.lang.String> productIdsAction, Delegator delegator, java.sql.Timestamp nowTimestamp, boolean filterOldProducts)
static void
makeProductPromoIdSet(java.util.Set<java.lang.String> productIds, java.util.List<GenericValue> productPromoCategories, java.util.List<GenericValue> productPromoProducts, Delegator delegator, java.sql.Timestamp nowTimestamp, boolean filterOldProducts)
static void
performAction(ProductPromoWorker.ActionResultInfo actionResultInfo, GenericValue productPromoAction, ShoppingCart cart, Delegator delegator, LocalDispatcher dispatcher, java.sql.Timestamp nowTimestamp)
-
-
-
Method Detail
-
getStoreProductPromos
public static java.util.List<GenericValue> getStoreProductPromos(Delegator delegator, LocalDispatcher dispatcher, javax.servlet.ServletRequest request)
-
getStoreProductPromoCodes
public static java.util.Set<java.lang.String> getStoreProductPromoCodes(ShoppingCart cart)
-
getProductStorePromotions
public static java.util.List<GenericValue> getProductStorePromotions(ShoppingCart cart, java.sql.Timestamp nowTimestamp, LocalDispatcher dispatcher)
-
getAgreementPromotions
public static java.util.List<GenericValue> getAgreementPromotions(ShoppingCart cart, java.sql.Timestamp nowTimestamp, LocalDispatcher dispatcher)
-
doPromotions
public static void doPromotions(ShoppingCart cart, LocalDispatcher dispatcher)
-
doPromotions
public static void doPromotions(ShoppingCart cart, java.util.List<GenericValue> productPromoList, LocalDispatcher dispatcher)
-
getProductPromoUseLimit
public static java.lang.Long getProductPromoUseLimit(GenericValue productPromo, java.lang.String partyId, Delegator delegator) throws GenericEntityException
calculate low use limit for this promo for the current "order", check per order, customer, promo- Throws:
GenericEntityException
-
getProductPromoCodeUseLimit
public static java.lang.Long getProductPromoCodeUseLimit(GenericValue productPromoCode, java.lang.String partyId, Delegator delegator) throws GenericEntityException
- Throws:
GenericEntityException
-
checkCanUsePromoCode
public static java.lang.String checkCanUsePromoCode(java.lang.String productPromoCodeId, java.lang.String partyId, Delegator delegator, java.util.Locale locale)
-
checkCanUsePromoCode
public static java.lang.String checkCanUsePromoCode(java.lang.String productPromoCodeId, java.lang.String partyId, Delegator delegator, ShoppingCart cart, java.util.Locale locale)
-
makeAutoDescription
public static java.lang.String makeAutoDescription(GenericValue productPromo, Delegator delegator, java.util.Locale locale, LocalDispatcher dispatcher) throws GenericEntityException
- Throws:
GenericEntityException
-
checkConditionsForItem
public static boolean checkConditionsForItem(GenericValue productPromoActionOrCond, ShoppingCart cart, ShoppingCartItem cartItem, Delegator delegator, LocalDispatcher dispatcher, java.sql.Timestamp nowTimestamp) throws GenericEntityException
- Throws:
GenericEntityException
-
checkConditionForItem
public static boolean checkConditionForItem(GenericValue productPromoCond, ShoppingCart cart, ShoppingCartItem cartItem, Delegator delegator, LocalDispatcher dispatcher, java.sql.Timestamp nowTimestamp) throws GenericEntityException
- Throws:
GenericEntityException
-
checkConditionPartyHierarchy
public static int checkConditionPartyHierarchy(Delegator delegator, java.sql.Timestamp nowTimestamp, java.lang.String groupPartyId, java.lang.String partyId) throws GenericEntityException
- Throws:
GenericEntityException
-
performAction
public static void performAction(ProductPromoWorker.ActionResultInfo actionResultInfo, GenericValue productPromoAction, ShoppingCart cart, Delegator delegator, LocalDispatcher dispatcher, java.sql.Timestamp nowTimestamp) throws GenericEntityException, CartItemModifyException
-
getCartItemsUsed
public static java.util.List<ShoppingCartItem> getCartItemsUsed(ShoppingCart cart, GenericValue productPromoAction)
-
getCartItemsUsedTotalAmount
public static java.math.BigDecimal getCartItemsUsedTotalAmount(ShoppingCart cart, GenericValue productPromoAction)
-
distributeDiscountAmount
public static void distributeDiscountAmount(java.math.BigDecimal discountAmountTotal, java.math.BigDecimal totalAmount, java.util.List<ShoppingCartItem> cartItemsUsed, GenericValue productPromoAction, Delegator delegator)
-
findPromoItem
public static java.lang.Integer findPromoItem(GenericValue productPromoAction, ShoppingCart cart)
-
doOrderItemPromoAction
public static void doOrderItemPromoAction(GenericValue productPromoAction, ShoppingCartItem cartItem, java.math.BigDecimal amount, java.lang.String amountField, Delegator delegator)
-
doOrderPromoAction
public static void doOrderPromoAction(GenericValue productPromoAction, ShoppingCart cart, java.math.BigDecimal amount, java.lang.String amountField, Delegator delegator)
-
getPromoRuleCondProductIds
public static java.util.Set<java.lang.String> getPromoRuleCondProductIds(GenericValue productPromoCond, Delegator delegator, java.sql.Timestamp nowTimestamp) throws GenericEntityException
- Throws:
GenericEntityException
-
getPromoRuleActionProductIds
public static java.util.Set<java.lang.String> getPromoRuleActionProductIds(GenericValue productPromoAction, Delegator delegator, java.sql.Timestamp nowTimestamp) throws GenericEntityException
- Throws:
GenericEntityException
-
makeProductPromoIdSet
public static void makeProductPromoIdSet(java.util.Set<java.lang.String> productIds, java.util.List<GenericValue> productPromoCategories, java.util.List<GenericValue> productPromoProducts, Delegator delegator, java.sql.Timestamp nowTimestamp, boolean filterOldProducts) throws GenericEntityException
- Throws:
GenericEntityException
-
makeProductPromoCondActionIdSets
public static void makeProductPromoCondActionIdSets(java.lang.String productPromoId, java.util.Set<java.lang.String> productIdsCond, java.util.Set<java.lang.String> productIdsAction, Delegator delegator, java.sql.Timestamp nowTimestamp) throws GenericEntityException
- Throws:
GenericEntityException
-
makeProductPromoCondActionIdSets
public static void makeProductPromoCondActionIdSets(java.lang.String productPromoId, java.util.Set<java.lang.String> productIdsCond, java.util.Set<java.lang.String> productIdsAction, Delegator delegator, java.sql.Timestamp nowTimestamp, boolean filterOldProducts) throws GenericEntityException
- Throws:
GenericEntityException
-
-