Class ShippingUtils

java.lang.Object
com.skava.shipping.util.ShippingUtils
All Implemented Interfaces:
Serializable

public class ShippingUtils extends Object implements Serializable
This is a Utility class for shipping calculation which contains validate of shipping delivery type and method.
See Also:
  • Constructor Details

    • ShippingUtils

      public ShippingUtils()
  • Method Details

    • checkValidOnDeliveryType

      public static boolean checkValidOnDeliveryType(ShippingAddress dtoModel, DeliveryType type)
      Check valid on delivery type.
      Parameters:
      dtoModel - the dto model
      type - the type
      Returns:
      true, if successful
    • encrypt

      public static String encrypt(String valueToEncrypt)
      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

      public static String decrypt(String valueToDecrypt)
      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 DO
      cachedCalculatedShipping - the cached calculated shipping
      expireTime - 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 type
      shippingMethodName - the shipping method name
      shippingMethodProperties - the shipping method properties
      Returns:
      the shipping method domain
    • buildShippingClasses

      public static List<ShippingClassDomain> buildShippingClasses(org.json.JSONObject obj)
      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 class
      shippingDomains - the shipping domains
      properties - the properties
      type - the type
      price - the price
      skuPriceInclBundleForQuantity - the sku price incl bundle for quantity
      quantity - the quantity
      Returns:
      the list
    • getShippingClasses

      public static List<String> getShippingClasses(Map<String,CollectionPropertyDomain> properties)
      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 properties
      domainItem - the domain item
      domainModel - the domain model
      shippingMethodDomains - the shipping method domains