Class DomainFlowUtils


  • public class DomainFlowUtils
    extends java.lang.Object
    Static utility functions for domain flows.
    • Field Detail

      • TYPES_ALLOWED_FOR_CREATE_ONLY_IN_SUNRISE

        public static final com.google.common.collect.ImmutableSet<ReservationType> TYPES_ALLOWED_FOR_CREATE_ONLY_IN_SUNRISE
        Reservation types that are only allowed in sunrise by policy.
      • COLLISION_MESSAGE

        public static final java.lang.String COLLISION_MESSAGE
        Warning message for allocation of collision domains in sunrise.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DomainFlowUtils

        public DomainFlowUtils()
    • Method Detail

      • validateDomainName

        public static com.google.common.net.InternetDomainName validateDomainName​(java.lang.String name)
                                                                           throws EppException
        Returns parsed version of name if domain name label follows our naming rules and is under one of the given allowed TLDs.

        Note: This method does not perform language validation with IDN tables.

        Throws:
        EppException
        See Also:
        validateDomainNameWithIdnTables(InternetDomainName)
      • isAnchorTenant

        public static boolean isAnchorTenant​(com.google.common.net.InternetDomainName domainName,
                                             java.util.Optional<AllocationToken> token,
                                             java.util.Optional<MetadataExtension> metadataExtension)
        Returns whether a given domain create request is for a valid anchor tenant.
      • isValidReservedCreate

        public static boolean isValidReservedCreate​(com.google.common.net.InternetDomainName domainName,
                                                    java.util.Optional<AllocationToken> token)
        Returns whether a given domain create request is for a valid reserved domain.
      • checkAllowedAccessToTld

        public static void checkAllowedAccessToTld​(java.lang.String registrarId,
                                                   java.lang.String tld)
                                            throws EppException
        Check if the registrar running the flow has access to the TLD in question.
        Throws:
        EppException
      • newAutorenewBillingEvent

        public static BillingEvent.Recurring.Builder newAutorenewBillingEvent​(DomainBase domain)
        Fills in a builder with the data needed for an autorenew billing event for this domain. This does not copy over the id of the current autorenew billing event.
      • newAutorenewPollMessage

        public static PollMessage.Autorenew.Builder newAutorenewPollMessage​(DomainBase domain)
        Fills in a builder with the data needed for an autorenew poll message for this domain. This does not copy over the id of the current autorenew poll message.
      • updateAutorenewRecurrenceEndTime

        public static BillingEvent.Recurring updateAutorenewRecurrenceEndTime​(DomainBase domain,
                                                                              org.joda.time.DateTime newEndTime)
        Re-saves the current autorenew billing event and poll message with a new end time.

        This may end up deleting the poll message (if closing the message interval) or recreating it (if opening the message interval). This may cause an autorenew billing event to have an end time earlier than its event time (i.e. if it's being ended before it was ever triggered).

        Returns the new autorenew recurring billing event.

      • validateFeeChallenge

        public static void validateFeeChallenge​(java.lang.String domainName,
                                                org.joda.time.DateTime priceTime,
                                                java.util.Optional<? extends FeeTransformCommandExtension> feeCommand,
                                                FeesAndCredits feesAndCredits)
                                         throws EppException
        Validates that fees are acked and match if they are required (typically for premium domains).

        This is used by domain operations that have an implicit cost, e.g. domain create or renew (both of which add one or more years' worth of registration). Depending on registry and/or registrar settings, explicit price acking using the fee extension may be required for premium domain names.

        Throws:
        EppException
      • validateFeesAckedIfPresent

        public static void validateFeesAckedIfPresent​(java.util.Optional<? extends FeeTransformCommandExtension> feeCommand,
                                                      FeesAndCredits feesAndCredits)
                                               throws EppException
        Validates that non-zero fees are acked (i.e. they are specified and the amount matches).

        This is used directly by update operations, i.e. those that otherwise don't have implicit costs, and is also used as a helper method to validate if fees are required for operations that do have implicit costs, e.g. creates and renews.

        Throws:
        EppException
      • validateRegistrationPeriod

        public static void validateRegistrationPeriod​(org.joda.time.DateTime now,
                                                      org.joda.time.DateTime newExpirationTime)
                                               throws EppException
        Check whether a new expiration time (via a renew) does not extend beyond a maximum number of years (e.g. DomainContent.MAX_REGISTRATION_YEARS) from "now".
        Throws:
        google.registry.flows.domain.DomainFlowUtils.ExceedsMaxRegistrationYearsException - if the new registration period is too long
        EppException
      • validateRegistrationPeriod

        public static void validateRegistrationPeriod​(int years)
                                               throws EppException
        Check that a new registration period (via a create) does not extend beyond a maximum number of years (e.g. DomainContent.MAX_REGISTRATION_YEARS).
        Throws:
        google.registry.flows.domain.DomainFlowUtils.ExceedsMaxRegistrationYearsException - if the new registration period is too long
        EppException