Class CartUtils
java.lang.Object
com.skava.cart.orchestration.utils.CartUtils
The Class CartUtils.
This class is used for handling common cart related functionality- Author:
- Infosys Equinox
-
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimal
calculateDiscount
(PromotionDetails promotionDetails, PromotionBreakUpType type, BigDecimal quantity) This method is used for calculating promotionstatic void
checkEmail
(String email, String locale) This method is used to email checkingstatic void
checkPhone
(String phone, String locale) This method is used to phone number checkingstatic String
checkValueOrUpdateDefault
(String checkAttribute, String defaultValue) The function checks null and returns valuestatic boolean
isCartGiftItem
(SFItem sfItem) This method is to check whether the items present in cart is gift item or notstatic boolean
The function checks whether sku is preOrder or not
-
Method Details
-
checkEmail
This method is used to email checking- Parameters:
email
- Indicates an email which is used for validatinglocale
- Indicates the locale based on which the validation exception can be thrown when the email is not valid
-
checkPhone
This method is used to phone number checking- Parameters:
phone
- Indicates the phone number which is used for validatinglocale
- Indicates the locale based on which the validation exception can be thrown when the phone number is not valid
-
calculateDiscount
public static BigDecimal calculateDiscount(PromotionDetails promotionDetails, PromotionBreakUpType type, BigDecimal quantity) This method is used for calculating promotion- Parameters:
promotionDetails
- Indicates aPromotionDetails
instance, contains all promotion details of the item or the carttype
- Indicates aPromotionBreakUpType
instance, which contains promotion breakUp type detailsquantity
- Indicates the quantity of the cart items- Returns:
- Returns the calculated discount.
-
checkValueOrUpdateDefault
The function checks null and returns value -
isPreOrderSku
The function checks whether sku is preOrder or not- Parameters:
sku
- Indicates aSkuOrchestration
to be checked- Returns:
- boolean - true if provided sku is preorder
-
isCartGiftItem
This method is to check whether the items present in cart is gift item or not- Parameters:
sfItem
- cart item object- Returns:
Boolean
isGiftItem returns true if the item is a gift item
-