Package com.skava.shipping.util
Class ShippingUtils
java.lang.Object
com.skava.shipping.util.ShippingUtils
- All Implemented Interfaces:
Serializable
This is a Utility class for shipping calculation which contains validate of shipping delivery type and method.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<ShippingClassDomain>
buildShippingClasses
(org.json.JSONObject obj) Builds the shipping classes.static ShippingMethodDomain
buildShippingMethod
(DeliveryType deliveryType, String shippingMethodName, String shippingMethodProperties) Builds the shipping method.static void
calculateItemShippingCost
(Map<String, CollectionPropertyDomain> properties, ItemsDomain domainItem, ItemShippingDetailsDomain domainModel, List<ShippingMethodDomain> shippingMethodDomains) Calculate item shipping cost.static boolean
checkItemAddressChange
(boolean doCalculate, long cacheCalculationTime, ItemsDomain domainModel, ItemsDomain fromDtoModel) static boolean
checkItemlevelChange
(ShippingDomain shippingDO, ShippingDomain cachedCalculatedShipping, boolean doCalculate, long cacheCalculationTime) static boolean
checkValidOnDeliveryType
(ShippingAddress dtoModel, DeliveryType type) Check valid on delivery type.static String
Data stored in database table will be converted to domain attribute.static String
domain attribute will be converted to the data representation that can be stored in a cache.getShippingClasses
(Map<String, CollectionPropertyDomain> properties) Gets the shipping class domain.static boolean
tocheckReCalculateShippingOrNot
(ShippingDomain shippingDO, ShippingDomain cachedCalculatedShipping, String expireTime) Tocheck re calculate shipping or not.static List<ShippingMethodDomain>
validateShippingClass
(String shippingClass, List<ShippingMethodDomain> shippingDomains, Map<String, CollectionPropertyDomain> properties, String type, BigDecimal price, BigDecimal skuPriceInclBundleForQuantity, BigDecimal quantity) Validate shipping class.
-
Constructor Details
-
ShippingUtils
public ShippingUtils()
-
-
Method Details
-
checkValidOnDeliveryType
Check valid on delivery type.- Parameters:
dtoModel
- the dto modeltype
- the type- Returns:
- true, if successful
-
encrypt
domain attribute will be converted to the data representation that can be stored in a cache.- Parameters:
valueToEncrypt
- the entity attribute to be converted- Returns:
- converted data to be stored in database
-
decrypt
Data stored in database table will be converted to domain attribute.- Parameters:
valueToDecrypt
- the data from the database column to be converted- Returns:
- converted entity attribute
-
tocheckReCalculateShippingOrNot
public static boolean tocheckReCalculateShippingOrNot(ShippingDomain shippingDO, ShippingDomain cachedCalculatedShipping, String expireTime) Tocheck re calculate shipping or not. This has various criteria to calculate or not to calculate- Parameters:
shippingDO
- the shipping DOcachedCalculatedShipping
- the cached calculated shippingexpireTime
- the expire time- Returns:
- true, if successful
-
checkItemlevelChange
public static boolean checkItemlevelChange(ShippingDomain shippingDO, ShippingDomain cachedCalculatedShipping, boolean doCalculate, long cacheCalculationTime) -
checkItemAddressChange
public static boolean checkItemAddressChange(boolean doCalculate, long cacheCalculationTime, ItemsDomain domainModel, ItemsDomain fromDtoModel) -
buildShippingMethod
public static ShippingMethodDomain buildShippingMethod(DeliveryType deliveryType, String shippingMethodName, String shippingMethodProperties) Builds the shipping method.- Parameters:
deliveryType
- the delivery typeshippingMethodName
- the shipping method nameshippingMethodProperties
- the shipping method properties- Returns:
- the shipping method domain
-
buildShippingClasses
Builds the shipping classes.- Parameters:
obj
- the obj- Returns:
- the list
-
validateShippingClass
public static List<ShippingMethodDomain> validateShippingClass(String shippingClass, List<ShippingMethodDomain> shippingDomains, Map<String, CollectionPropertyDomain> properties, String type, BigDecimal price, BigDecimal skuPriceInclBundleForQuantity, BigDecimal quantity) Validate shipping class.- Parameters:
shippingClass
- the shipping classshippingDomains
- the shipping domainsproperties
- the propertiestype
- the typeprice
- the priceskuPriceInclBundleForQuantity
- the sku price incl bundle for quantityquantity
- the quantity- Returns:
- the list
-
getShippingClasses
Gets the shipping class domain.- Parameters:
properties
- the properties- Returns:
- the shipping zones
-
calculateItemShippingCost
public static void calculateItemShippingCost(Map<String, CollectionPropertyDomain> properties, ItemsDomain domainItem, ItemShippingDetailsDomain domainModel, List<ShippingMethodDomain> shippingMethodDomains) Calculate item shipping cost.- Parameters:
properties
- the propertiesdomainItem
- the domain itemdomainModel
- the domain modelshippingMethodDomains
- the shipping method domains
-