Class QuoteExpirationTimeUtils
java.lang.Object
de.hybris.platform.commerceservices.util.QuoteExpirationTimeUtils
Utility class for determining quote expiration time and checking its validity. It also provides methods for getting
the configurable offer validity periods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic DatedetermineExpirationTime(Date oldExpiryDate, 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 usingisExpirationTimeValid(Date, Date)method.static intGets the configured value for the quote default offer validity period in days or 30 if the property is not found.static DategetEndOfDay(Date day) Sets the time part of the provided input date parameter to end of day (23:59:59).static intGets the configured value for the quote minimum offer validity period in days or 1 if the property is not found.static booleanisExpirationTimeValid(Date expiryDate, Date today) Checks if the expiration date provided as input is valid or not.
-
Field Details
-
DEFAULT_OFFER_VALIDITY_PERIOD_IN_DAYS
public static final int DEFAULT_OFFER_VALIDITY_PERIOD_IN_DAYS- See Also:
-
MIN_OFFER_VALIDITY_PERIOD_IN_DAYS
public static final int MIN_OFFER_VALIDITY_PERIOD_IN_DAYS- See Also:
-
-
Method Details
-
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
Determines the expiration time for a quote by checking if the expiration time that is currently set for the quote is valid or not usingisExpirationTimeValid(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 quotetoday- the current date with normalized time- Returns:
- the determined expiration time for the quote
-
getEndOfDay
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
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 checktoday- the current date with normalized time- Returns:
- true if the expiration date is valid, otherwise false
-