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 BigDecimalcalculateDiscount(PromotionDetails promotionDetails, PromotionBreakUpType type, BigDecimal quantity) This method is used for calculating promotionstatic voidcheckEmail(String email, String locale) This method is used to email checkingstatic voidcheckPhone(String phone, String locale) This method is used to phone number checkingstatic StringcheckValueOrUpdateDefault(String checkAttribute, String defaultValue) The function checks null and returns valuestatic booleanisCartGiftItem(SFItem sfItem) This method is to check whether the items present in cart is gift item or notstatic booleanThe 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 aPromotionDetailsinstance, contains all promotion details of the item or the carttype- Indicates aPromotionBreakUpTypeinstance, 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 aSkuOrchestrationto 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:
BooleanisGiftItem returns true if the item is a gift item
-