Class PromotionUtils
java.lang.Object
com.skava.promotion.orchestration.utils.PromotionUtils
The Class PromotionUtils
This class defines the promotion related methods.- Author:
- Infosys Equinox
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcalculatePriceFacets(Map<String, Object> priceFacets, Map<String, Object> priceFacet, String key, Map.Entry<String, Object> value) This method is used to calculate PriceFacets.static voidconstructInvalidPromoCode(List<PromotionCode> promoCodes, String locale) This method is used to construct invalid promo code.createPromotionAccount(org.apache.camel.Exchange exchange) This process method is used to create the promotion request for account.createPromotionCoupon(SFCart cart) This method is used to create promotion discount coupon information for the promotion request from the orchestration cart response.createPromotionUser(org.apache.camel.Exchange exchange) This process method is used to create the promotion request for account.static doublegetDiscount(PromotionOffer offer) This method is used to get discount from the promotion offer.static List<PromotionGiftResponse>getGiftPromotion(PromotionOfferResponse promotionOffer) This method is used to get promotion mapping with sku details from the promotion offer response.This method is used to get PriceFacetsDiscount from the promotion offer.static Map<String,PromotionSku> getPromotion(PromotionOfferResponse promotionOffer, String type) This method is used to get promotion mapping with sku details from the promotion offer response.static PromotionCodegetPromotionCodesFromCoupons(PromotionCoupon promoCoupon, PromotionDetails promoDetails, PromotionDetails itemPromoDetails, String locale) This method is used to get promo codes from the given coupons.static voidgetUserProperties(Users usersResponse, Map<String, String> properties) This process method is used to get and set the userResponse properties.static booleanisEmpty(Collection<?> collection) This method returns true if the collection is null or is empty.static booleanisValidPromoCode(String code) This method is used validate the promo code.static BigDecimalsetBundlePrice(SpecialProdPromotionRequest catalogPromoRequest, List<SkuOrchestration> searchSkuResponse, String type) This method is used to calculate total item pricesetBundlePriceFacets(SpecialProdPromotionRequest catalogPromoRequest, List<SkuOrchestration> searchSkuResponse, List<String> allowedPromotionPriceFacets) This method is used to calculate setBundlePriceFacetssetItemPriceFacets(SFItem item) This method is used to calculate total item priceFacetssetItemProperties(Map<String, String> properties, String productPropertiesForPromotion, SFItem item, Boolean isSubscriptionIncludedInPromotion, Map<String, String> productproperties) This process method is used to set the setItemProperties.static voidsetLoyaltyDetails(org.apache.camel.Exchange exchange, Map<String, String> properties) This process method is used to create the promotion request for account.static voidsetPriceFacets(Map<String, Object> priceFacets, BigDecimal quantity, List<String> allowedPromotionPriceFacets, Map<String, Object> priceFacet) This process method is used to check for skuID.static voidsetProductProperties(Map<String, String> properties, String productPropertiesForPromotion, Map<String, String> productProperties, SFItem item, Boolean isSubscriptionIncludedInPromotion, Map<String, String> productproperties) static voidsetPromoCodesFromCoupons(List<PromotionCoupon> promoCouponList, PromotionDetails promoDetails, PromotionDetails itemPromoDetails, String locale) This method is used to set promo codes from the given coupons.static voidsetPromoCodeValue(PromotionDetails promoDetails, PromotionCode promoCode) This method is used to set promo code value.static voidsetSkuPriceFacets(SkuOrchestration sku, String allowedPromotionPriceFacets, Map<String, Object> priceFacets) This method is used set SKU PriceFacets for promotion request.static doublesetSpecialProductPrices(SFProduct product, double bundlePrice, Map<String, Object> priceFacets, List<String> allowedPromotionPriceFacet, String type) This method is used to set fixedPriceBundlePrices.static voidsetSubscriptionProperty(SFItem item, Map<String, String> properties) This method is used to set the subscription property in promotion request properties.
-
Method Details
-
isEmpty
This method returns true if the collection is null or is empty.- Parameters:
collection- Indicates theCollection- Returns:
- true | false
-
setPromoCodesFromCoupons
public static void setPromoCodesFromCoupons(List<PromotionCoupon> promoCouponList, PromotionDetails promoDetails, PromotionDetails itemPromoDetails, String locale) This method is used to set promo codes from the given coupons.- Parameters:
promoCouponList- Indicates the list of (@link PromotionCoupon} object which contains the list of the promotion coupons details.promoDetails- Indicates the list ofPromotionDetailswhich contains the list of promotion details.itemPromoDetails- IndicatesPromotionDetailsobject which contains the promotion details.locale- Indicates the locale which holds string value.
-
isValidPromoCode
This method is used validate the promo code.- Parameters:
code- Indicates the promo code which holds string value.- Returns:
- Returns boolean value whether the promo code is valid or not.
-
getPromotionCodesFromCoupons
public static PromotionCode getPromotionCodesFromCoupons(PromotionCoupon promoCoupon, PromotionDetails promoDetails, PromotionDetails itemPromoDetails, String locale) This method is used to get promo codes from the given coupons.- Parameters:
promoCoupon- Indicates (@link PromotionCoupon} object which contains the promotion coupons details.promoDetails- IndicatesPromotionDetailswhich contains the promotion details.itemPromoDetails- IndicatesPromotionDetailsobject which contains the item promotion details.locale- Indicates the locale which holds string value.- Returns:
- Returns the
PromotionCode, contains all promotion details of the promotion codes.
-
constructInvalidPromoCode
This method is used to construct invalid promo code.- Parameters:
promoCodes- Indicates the list ofPromotionCodewhich contains all promotion details of the promotion codes.locale- Indicates the locale which holds string value.
-
setPromoCodeValue
This method is used to set promo code value.- Parameters:
promoDetails- IndicatesPromotionDetailswhich contains all promotion details of the item or the cart.promoCode- IndicatesPromotionCodewhich contains all promotion details of the promotion codes.
-
createPromotionCoupon
This method is used to create promotion discount coupon information for the promotion request from the orchestration cart response. -
createPromotionUser
This process method is used to create the promotion request for account.- Parameters:
exchange- Indicates aExchangeinstance, which holds the information during the entire routing of a Message received by a Consumer.- Returns:
- usersList.
-
createPromotionAccount
This process method is used to create the promotion request for account.- Parameters:
exchange- Indicates aExchangeinstance, which holds the information during the entire routing of a Message received by a Consumer.- Returns:
- accountsList.
-
getGiftPromotion
This method is used to get promotion mapping with sku details from the promotion offer response.- Parameters:
promotionOffer- Indicates aPromotionOfferResponse, contains the offers for the items that matches the specified criteria, response is rendered with the same data as in the request.- Returns:
- Returns the
List, mapping where promotion sku contains the sku information.
-
getPromotion
public static Map<String,PromotionSku> getPromotion(PromotionOfferResponse promotionOffer, String type) This method is used to get promotion mapping with sku details from the promotion offer response.- Parameters:
promotionOffer- Indicates aPromotionOfferResponse, contains the offers for the items that matches the specified criteria, response is rendered with the same data as in the request.type- is String.- Returns:
- Returns the
Map, mapping where promotion sku contains the sku information.
-
getPriceFacetsDiscount
This method is used to get PriceFacetsDiscount from the promotion offer.- Parameters:
offer- Indicates aPromotionOffer, contains attributes to hold the promotion quantity based discount information.- Returns:
- Returns the priceFacetsDiscount.
-
getDiscount
This method is used to get discount from the promotion offer.- Parameters:
offer- Indicates aPromotionOffer, contains attributes to hold the promotion quantity based discount information.- Returns:
- Returns the discount amount.
-
calculatePriceFacets
public static void calculatePriceFacets(Map<String, Object> priceFacets, Map<String, Object> priceFacet, String key, Map.Entry<String, Object> value) This method is used to calculate PriceFacets. -
setItemPriceFacets
This method is used to calculate total item priceFacets- Parameters:
item- Indicates aSFItem, contains the item- Returns:
- priceFacets.
-
setSpecialProductPrices
public static double setSpecialProductPrices(SFProduct product, double bundlePrice, Map<String, Object> priceFacets, List<String> allowedPromotionPriceFacet, String type) This method is used to set fixedPriceBundlePrices. -
setBundlePrice
public static BigDecimal setBundlePrice(SpecialProdPromotionRequest catalogPromoRequest, List<SkuOrchestration> searchSkuResponse, String type) This method is used to calculate total item price- Parameters:
catalogPromoRequest- Indicates aSpecialProdPromotionRequest.searchSkuResponse- Indicates aList.type- Indicates a string value for type- Returns:
- bundlePrice.
-
setBundlePriceFacets
public static Map<String,Object> setBundlePriceFacets(SpecialProdPromotionRequest catalogPromoRequest, List<SkuOrchestration> searchSkuResponse, List<String> allowedPromotionPriceFacets) This method is used to calculate setBundlePriceFacets- Parameters:
catalogPromoRequest- Indicates aSpecialProdPromotionRequest.searchSkuResponse- Indicates aList.allowedPromotionPriceFacets- Indicates aList.- Returns:
- priceFacets.
-
setPriceFacets
public static void setPriceFacets(Map<String, Object> priceFacets, BigDecimal quantity, List<String> allowedPromotionPriceFacets, Map<String, Object> priceFacet) This process method is used to check for skuID.- Parameters:
priceFacets- indicates aMap.quantity- indicates aBigDecimal.allowedPromotionPriceFacets- indicates aList.priceFacet- indicates aMap
-
setLoyaltyDetails
public static void setLoyaltyDetails(org.apache.camel.Exchange exchange, Map<String, String> properties) This process method is used to create the promotion request for account.- Parameters:
exchange- Indicates aExchangeinstance, which holds the information during the entire routing of a Message received by a Consumer.properties- Contains loyalty properties
-
getUserProperties
This process method is used to get and set the userResponse properties.- Parameters:
usersResponse- contains userDetails.properties- Contains user properties
-
setItemProperties
public static Map<String,String> setItemProperties(Map<String, String> properties, String productPropertiesForPromotion, SFItem item, Boolean isSubscriptionIncludedInPromotion, Map<String, String> productproperties) This process method is used to set the setItemProperties.- Parameters:
properties- Contains the item/product/sku Properties.productPropertiesForPromotion- Indicates a string value for productPropertiesForPromotionitem- Indicates a cart item data.isSubscriptionIncludedInPromotion- holds Boolean value isSubscriptionIncludedInPromotion- Returns:
- the corresponding map
-
setProductProperties
-
setSkuPriceFacets
public static void setSkuPriceFacets(SkuOrchestration sku, String allowedPromotionPriceFacets, Map<String, Object> priceFacets) This method is used set SKU PriceFacets for promotion request.- Parameters:
sku-SkuOrchestration, which contains information about an SKU response.allowedPromotionPriceFacets- Indicates a string value for allowedPromotionPriceFacetspriceFacets- Indicates the map of price facet details
-
setSubscriptionProperty
This method is used to set the subscription property in promotion request properties.- Parameters:
item-SFItemindicates the item in the cart.properties- contains the promotion request properties.
-