Class QuoteExpirationTimeUtils


  • public final class QuoteExpirationTimeUtils
    extends java.lang.Object
    Utility class for determining quote expiration time and checking its validity. It also provides methods for getting the configurable offer validity periods.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Date determineExpirationTime​(java.util.Date oldExpiryDate, java.util.Date today)
      Determines the expiration time for a quote by checking if the expiration time that is currently set for the quote is valid or not using isExpirationTimeValid(Date, Date) method.
      static int getDefaultOfferValidityPeriodDays()
      Gets the configured value for the quote default offer validity period in days or 30 if the property is not found.
      static java.util.Date getEndOfDay​(java.util.Date day)
      Sets the time part of the provided input date parameter to end of day (23:59:59).
      static int getMinOfferValidityPeriodInDays()
      Gets the configured value for the quote minimum offer validity period in days or 1 if the property is not found.
      static boolean isExpirationTimeValid​(java.util.Date expiryDate, java.util.Date today)
      Checks if the expiration date provided as input is valid or not.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_OFFER_VALIDITY_PERIOD_IN_DAYS

        public static final int DEFAULT_OFFER_VALIDITY_PERIOD_IN_DAYS
        See Also:
        Constant Field Values
      • MIN_OFFER_VALIDITY_PERIOD_IN_DAYS

        public static final int MIN_OFFER_VALIDITY_PERIOD_IN_DAYS
        See Also:
        Constant Field Values
    • Method Detail

      • getDefaultOfferValidityPeriodDays

        public static int getDefaultOfferValidityPeriodDays()
        Gets the configured value for the quote default offer validity period in days or 30 if the property is not found.
        Returns:
        the quote default offer validity period in days
      • getMinOfferValidityPeriodInDays

        public static int getMinOfferValidityPeriodInDays()
        Gets the configured value for the quote minimum offer validity period in days or 1 if the property is not found.
        Returns:
        the quote minimum offer validity period in days
      • determineExpirationTime

        public static java.util.Date determineExpirationTime​(java.util.Date oldExpiryDate,
                                                             java.util.Date today)
        Determines the expiration time for a quote by checking if the expiration time that is currently set for the quote is valid or not using isExpirationTimeValid(Date, Date) method. If it is valid, it returns the expiration time as is, otherwise it returns an expiration time set to current date with normalized time plus the quote default offer validity period in days and with the time part set to end day.
        Parameters:
        oldExpiryDate - the expiration date that is currently set for the quote
        today - the current date with normalized time
        Returns:
        the determined expiration time for the quote
      • getEndOfDay

        public static java.util.Date getEndOfDay​(java.util.Date day)
        Sets the time part of the provided input date parameter to end of day (23:59:59).
        Parameters:
        day - the date for which the time part to be set to end of day
        Returns:
        the updated date object with the time part set to end of day
      • isExpirationTimeValid

        public static boolean isExpirationTimeValid​(java.util.Date expiryDate,
                                                    java.util.Date today)
        Checks if the expiration date provided as input is valid or not. An expiration date is not valid if it is before the current date with normalized time plus the quote minimum offer validity period in days or it is not set. Otherwise, the expiration date is valid.
        Parameters:
        expiryDate - the expiration date to check
        today - the current date with normalized time
        Returns:
        true if the expiration date is valid, otherwise false