Class AllocationTokenFlowUtils
java.lang.Object
google.registry.flows.domain.token.AllocationTokenFlowUtils
Utility functions for dealing with
AllocationToken
s in domain flows.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The allocation token is not currently valid.static class
The allocation token is not valid for this EPP command.static class
The allocation token is not valid for this domain.static class
The allocation token is not valid for this registrar.static class
The allocation token is not valid for this TLD.static class
The allocation token was already redeemed.static class
The allocation token is invalid.static class
The __REMOVE_BULK_PRICING__ token is missing on a bulk pricing domain commandstatic class
The __REMOVE_BULK_PRICING__ token is not allowed on non bulk pricing domains -
Method Summary
Modifier and TypeMethodDescriptioncheckDomainsWithToken
(List<com.google.common.net.InternetDomainName> domainNames, String token, String registrarId, org.joda.time.DateTime now) Checks if the allocation token applies to the given domain names, used for domain checks.static Domain
maybeApplyBulkPricingRemovalToken
(Domain domain, Optional<AllocationToken> allocationToken) redeemToken
(AllocationToken token, HistoryEntry.HistoryEntryId redemptionHistoryId) Redeems a SINGLE_USEAllocationToken
, returning the redeemed copy.static void
validateToken
(com.google.common.net.InternetDomainName domainName, AllocationToken token, FeeQueryCommandExtensionItem.CommandName commandName, String registrarId, boolean isPremium, org.joda.time.DateTime now) Validates a given token.static void
validateTokenForPossiblePremiumName
(Optional<AllocationToken> token, boolean isPremium) Validates that the given token is valid for a premium name if the name is premium.verifyAllocationTokenCreateIfPresent
(DomainCommand.Create command, Tld tld, String registrarId, org.joda.time.DateTime now, Optional<AllocationTokenExtension> extension) Verifies and returns the allocation token if one is specified, otherwise does nothing.verifyAllocationTokenIfPresent
(Domain existingDomain, Tld tld, String registrarId, org.joda.time.DateTime now, FeeQueryCommandExtensionItem.CommandName commandName, Optional<AllocationTokenExtension> extension) Verifies and returns the allocation token if one is specified, otherwise does nothing.static void
verifyTokenAllowedOnDomain
(Domain domain, Optional<AllocationToken> allocationToken)
-
Method Details
-
checkDomainsWithToken
public AllocationTokenDomainCheckResults checkDomainsWithToken(List<com.google.common.net.InternetDomainName> domainNames, String token, String registrarId, org.joda.time.DateTime now) Checks if the allocation token applies to the given domain names, used for domain checks.- Returns:
- A map of domain names to domain check error response messages. If a message is present for a a given domain then it does not validate with this allocation token; domains that do validate have blank messages (i.e. no error).
-
redeemToken
public AllocationToken redeemToken(AllocationToken token, HistoryEntry.HistoryEntryId redemptionHistoryId) Redeems a SINGLE_USEAllocationToken
, returning the redeemed copy. -
validateToken
public static void validateToken(com.google.common.net.InternetDomainName domainName, AllocationToken token, FeeQueryCommandExtensionItem.CommandName commandName, String registrarId, boolean isPremium, org.joda.time.DateTime now) throws EppException Validates a given token. The token could be invalid if it has allowed client IDs or TLDs that do not include this client ID / TLD, or if the token has a promotion that is not currently running, or the token is not valid for a premium name when necessary.- Throws:
EppException
- if the token is invalid in any way
-
validateTokenForPossiblePremiumName
public static void validateTokenForPossiblePremiumName(Optional<AllocationToken> token, boolean isPremium) throws DomainPricingLogic.AllocationTokenInvalidForPremiumNameException Validates that the given token is valid for a premium name if the name is premium. -
verifyAllocationTokenCreateIfPresent
public Optional<AllocationToken> verifyAllocationTokenCreateIfPresent(DomainCommand.Create command, Tld tld, String registrarId, org.joda.time.DateTime now, Optional<AllocationTokenExtension> extension) throws EppException Verifies and returns the allocation token if one is specified, otherwise does nothing.- Throws:
EppException
-
verifyAllocationTokenIfPresent
public Optional<AllocationToken> verifyAllocationTokenIfPresent(Domain existingDomain, Tld tld, String registrarId, org.joda.time.DateTime now, FeeQueryCommandExtensionItem.CommandName commandName, Optional<AllocationTokenExtension> extension) throws EppException Verifies and returns the allocation token if one is specified, otherwise does nothing.- Throws:
EppException
-
verifyTokenAllowedOnDomain
public static void verifyTokenAllowedOnDomain(Domain domain, Optional<AllocationToken> allocationToken) throws EppException - Throws:
EppException
-
maybeApplyBulkPricingRemovalToken
public static Domain maybeApplyBulkPricingRemovalToken(Domain domain, Optional<AllocationToken> allocationToken)
-