Class DomainFlowUtils
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Command is not allowed in the current registry phase.static class
The fee description passed in the transform command matches multiple fee types.static class
The fee description passed in the transform command cannot be parsed.static class
The fees passed in the transform command do not match the fees that will be charged.static class
Domain label is not allowed by IDN table.static class
Registrar is missing the billing account map for this currency type.static class
Nameservers are not allow-listed for this TLD.static class
Nameservers not specified for domain on TLD with nameserver allow list.static class
Registrar is not authorized to access this TLD.static class
Registrant is not allow-listed for this TLD. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Warning message for allocation of collision domains in sunrise.static final com.google.common.collect.ImmutableSet
<ReservationType> Reservation types that are only allowed in sunrise by policy. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkAllowedAccessToTld
(String registrarId, String tld) Check if the registrar running the flow has access to the TLD in question.static Optional
<AllocationToken> checkForDefaultToken
(Tld tld, String domainName, FeeQueryCommandExtensionItem.CommandName commandName, String registrarId, org.joda.time.DateTime now) Checks if there is a valid default token to be used for a domain create command.static void
checkHasBillingAccount
(String registrarId, String tldStr) Check if the registrar has the correct billing account map configured.static com.google.common.collect.ImmutableSet
<DomainTransactionRecord> createCancelingRecords
(Domain domain, org.joda.time.DateTime now, org.joda.time.Duration maxSearchPeriod, com.google.common.collect.ImmutableSet<DomainTransactionRecord.TransactionReportField> cancelableFields) Returns a set of DomainTransactionRecords which negate the most recent HistoryEntry's records.static boolean
isAnchorTenant
(com.google.common.net.InternetDomainName domainName, Optional<AllocationToken> token, Optional<MetadataExtension> metadataExtension) Returns whether a given domain create request is for a valid anchor tenant.static boolean
isBlockedByBsa
(String domainLabel, Tld tld, org.joda.time.DateTime now) static boolean
isRegisterBsaCreate
(com.google.common.net.InternetDomainName domainName, Optional<AllocationToken> token) Returns whether a given domain create request may bypass the BSA block check.static boolean
isReserved
(com.google.common.net.InternetDomainName domainName, boolean isSunrise) static boolean
isValidReservedCreate
(com.google.common.net.InternetDomainName domainName, Optional<AllocationToken> token) Returns whether a given domain create request is for a valid reserved domain.static BillingRecurrence.Builder
newAutorenewBillingEvent
(Domain domain) Fills in a builder with the data needed for an autorenew billing event for this domain.newAutorenewPollMessage
(Domain domain) Fills in a builder with the data needed for an autorenew poll message for this domain.static BillingRecurrence
updateAutorenewRecurrenceEndTime
(Domain domain, BillingRecurrence existingBillingRecurrence, org.joda.time.DateTime newEndTime, HistoryEntry.HistoryEntryId historyId) Re-saves the current autorenew billing event and poll message with a new end time.static boolean
validateAlgorithm
(int alg) static com.google.common.net.InternetDomainName
validateDomainName
(String name) Returns parsed version ofname
if domain name label follows our naming rules and is under one of the given allowed TLDs.static String
validateDomainNameWithIdnTables
(com.google.common.net.InternetDomainName domainName) Returns name of first matching IDN table for domain label.static void
validateFeeChallenge
(Optional<? extends FeeTransformCommandExtension> feeCommand, FeesAndCredits feesAndCredits, boolean defaultTokenUsed) Validates that fees are acked and match if they are required (typically for premium domains).static void
validateFeesAckedIfPresent
(Optional<? extends FeeTransformCommandExtension> feeCommand, FeesAndCredits feesAndCredits, boolean defaultTokenUsed) Validates that non-zero fees are acked (i.e.static void
validateRegistrationPeriod
(int years) Check that a new registration period (via a create) does not extend beyond a maximum number of years (e.g.static void
validateRegistrationPeriod
(org.joda.time.DateTime now, org.joda.time.DateTime newExpirationTime) Check whether a new expiration time (via a renew) does not extend beyond a maximum number of years (e.g.static void
verifyNotBlockedByBsa
(com.google.common.net.InternetDomainName domainName, Tld tld, org.joda.time.DateTime now, Optional<AllocationToken> allocationToken) Verifies that thedomainLabel
is not blocked by any BSA block label for the giventld
at the specified time.static void
verifyNotInPredelegation
(Tld registry, org.joda.time.DateTime now) Check that the registry phase is not predelegation, during which some flows are forbidden.
-
Field Details
-
TYPES_ALLOWED_FOR_CREATE_ONLY_IN_SUNRISE
public static final com.google.common.collect.ImmutableSet<ReservationType> TYPES_ALLOWED_FOR_CREATE_ONLY_IN_SUNRISEReservation types that are only allowed in sunrise by policy. -
COLLISION_MESSAGE
Warning message for allocation of collision domains in sunrise.- See Also:
-
-
Constructor Details
-
DomainFlowUtils
public DomainFlowUtils()
-
-
Method Details
-
validateDomainName
public static com.google.common.net.InternetDomainName validateDomainName(String name) throws EppException Returns parsed version ofname
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
public static String validateDomainNameWithIdnTables(com.google.common.net.InternetDomainName domainName) throws DomainFlowUtils.InvalidIdnDomainLabelException Returns name of first matching IDN table for domain label.- Throws:
DomainFlowUtils.InvalidIdnDomainLabelException
- if IDN table or language validation failed- See Also:
-
verifyNotBlockedByBsa
public static void verifyNotBlockedByBsa(com.google.common.net.InternetDomainName domainName, Tld tld, org.joda.time.DateTime now, Optional<AllocationToken> allocationToken) throws google.registry.flows.domain.DomainFlowUtils.DomainLabelBlockedByBsaException Verifies that thedomainLabel
is not blocked by any BSA block label for the giventld
at the specified time.- Throws:
google.registry.flows.domain.DomainFlowUtils.DomainLabelBlockedByBsaException
-
isBlockedByBsa
-
isAnchorTenant
public static boolean isAnchorTenant(com.google.common.net.InternetDomainName domainName, Optional<AllocationToken> token, 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, Optional<AllocationToken> token) Returns whether a given domain create request is for a valid reserved domain. -
isRegisterBsaCreate
public static boolean isRegisterBsaCreate(com.google.common.net.InternetDomainName domainName, Optional<AllocationToken> token) Returns whether a given domain create request may bypass the BSA block check. -
checkAllowedAccessToTld
Check if the registrar running the flow has access to the TLD in question.- Throws:
EppException
-
checkHasBillingAccount
Check if the registrar has the correct billing account map configured.- Throws:
EppException
-
validateAlgorithm
public static boolean validateAlgorithm(int alg) -
isReserved
public static boolean isReserved(com.google.common.net.InternetDomainName domainName, boolean isSunrise) -
newAutorenewBillingEvent
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
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 BillingRecurrence updateAutorenewRecurrenceEndTime(Domain domain, BillingRecurrence existingBillingRecurrence, org.joda.time.DateTime newEndTime, @Nullable HistoryEntry.HistoryEntryId historyId) 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 recurrence billing event.
-
validateFeeChallenge
public static void validateFeeChallenge(Optional<? extends FeeTransformCommandExtension> feeCommand, FeesAndCredits feesAndCredits, boolean defaultTokenUsed) 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(Optional<? extends FeeTransformCommandExtension> feeCommand, FeesAndCredits feesAndCredits, boolean defaultTokenUsed) 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.DomainBase.MAX_REGISTRATION_YEARS
) from "now".- Throws:
google.registry.flows.domain.DomainFlowUtils.ExceedsMaxRegistrationYearsException
- if the new registration period is too longEppException
-
validateRegistrationPeriod
Check that a new registration period (via a create) does not extend beyond a maximum number of years (e.g.DomainBase.MAX_REGISTRATION_YEARS
).- Throws:
google.registry.flows.domain.DomainFlowUtils.ExceedsMaxRegistrationYearsException
- if the new registration period is too longEppException
-
verifyNotInPredelegation
public static void verifyNotInPredelegation(Tld registry, org.joda.time.DateTime now) throws DomainFlowUtils.BadCommandForRegistryPhaseException Check that the registry phase is not predelegation, during which some flows are forbidden. -
createCancelingRecords
public static com.google.common.collect.ImmutableSet<DomainTransactionRecord> createCancelingRecords(Domain domain, org.joda.time.DateTime now, org.joda.time.Duration maxSearchPeriod, com.google.common.collect.ImmutableSet<DomainTransactionRecord.TransactionReportField> cancelableFields) Returns a set of DomainTransactionRecords which negate the most recent HistoryEntry's records.Domain deletes and transfers use this function to account for previous records negated by their flow. For example, if a grace period delete occurs, we must add -1 counters for the associated NET_ADDS_#_YRS field, if it exists.
The steps are as follows: 1. Find all HistoryEntries under the domain modified in the past, up to the maxSearchPeriod. 2. Only keep HistoryEntries with a DomainTransactionRecord that a) hasn't been reported yet and b) matches the predicate 3. Return the transactionRecords under the most recent HistoryEntry that fits the above criteria, with negated reportAmounts.
-
checkForDefaultToken
public static Optional<AllocationToken> checkForDefaultToken(Tld tld, String domainName, FeeQueryCommandExtensionItem.CommandName commandName, String registrarId, org.joda.time.DateTime now) throws EppException Checks if there is a valid default token to be used for a domain create command.If there is more than one valid default token for the registration, only the first valid token found on the TLD's default token list will be returned.
- Throws:
EppException
-