Class AllocationTokenFlowUtils
java.lang.Object
google.registry.flows.domain.token.AllocationTokenFlowUtils
Utility functions for dealing with
AllocationToken
s in domain flows.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The allocation token exists but is not valid, e.g.static class
The allocation token is not currently valid.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 was already redeemed.static class
The __REMOVE_BULK_PRICING__ token is missing on a bulk pricing domain commandstatic class
The allocation token is invalid.static class
The __REMOVE_BULK_PRICING__ token is not allowed on non bulk pricing domains -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
discountTokenInvalidForPremiumName
(AllocationToken token, boolean isPremium) Don't apply discounts on premium domains if the token isn't configured that way.static Optional
<AllocationToken> loadAllocationTokenFromExtension
(String registrarId, String domainName, org.joda.time.DateTime now, Optional<AllocationTokenExtension> extension) Loads and verifies the allocation token if one is specified, otherwise does nothing.static Optional
<AllocationToken> loadTokenFromExtensionOrGetDefault
(String registrarId, org.joda.time.DateTime now, Optional<AllocationTokenExtension> extension, Tld tld, String domainName, FeeQueryCommandExtensionItem.CommandName commandName) Loads the relevant token, if present, for the given extension + request.static Domain
maybeApplyBulkPricingRemovalToken
(Domain domain, Optional<AllocationToken> allocationToken) Removes the bulk pricing token from the provided domain, if applicable.static AllocationToken
redeemToken
(AllocationToken token, HistoryEntry.HistoryEntryId redemptionHistoryId) Redeems a SINGLE_USEAllocationToken
, returning the redeemed copy.static void
verifyBulkTokenAllowedOnDomain
(Domain domain, Optional<AllocationToken> allocationToken) Verifies that the given domain can have a bulk pricing token removed from it.
-
Method Details
-
redeemToken
public static AllocationToken redeemToken(AllocationToken token, HistoryEntry.HistoryEntryId redemptionHistoryId) Redeems a SINGLE_USEAllocationToken
, returning the redeemed copy. -
discountTokenInvalidForPremiumName
Don't apply discounts on premium domains if the token isn't configured that way. -
loadAllocationTokenFromExtension
public static Optional<AllocationToken> loadAllocationTokenFromExtension(String registrarId, String domainName, org.joda.time.DateTime now, Optional<AllocationTokenExtension> extension) throws AllocationTokenFlowUtils.NonexistentAllocationTokenException, AllocationTokenFlowUtils.AllocationTokenInvalidException Loads and verifies the allocation token if one is specified, otherwise does nothing. -
loadTokenFromExtensionOrGetDefault
public static Optional<AllocationToken> loadTokenFromExtensionOrGetDefault(String registrarId, org.joda.time.DateTime now, Optional<AllocationTokenExtension> extension, Tld tld, String domainName, FeeQueryCommandExtensionItem.CommandName commandName) throws AllocationTokenFlowUtils.NonexistentAllocationTokenException, AllocationTokenFlowUtils.AllocationTokenInvalidException Loads the relevant token, if present, for the given extension + request.This may be the allocation token provided in the request, if it is present and valid for the request. Otherwise, it may be a default allocation token if one is present and valid for the request.
-
verifyBulkTokenAllowedOnDomain
public static void verifyBulkTokenAllowedOnDomain(Domain domain, Optional<AllocationToken> allocationToken) throws EppException Verifies that the given domain can have a bulk pricing token removed from it.- Throws:
EppException
-
maybeApplyBulkPricingRemovalToken
public static Domain maybeApplyBulkPricingRemovalToken(Domain domain, Optional<AllocationToken> allocationToken) Removes the bulk pricing token from the provided domain, if applicable.- Parameters:
allocationToken
- the (possibly) REMOVE_BULK_PRICING token provided by the client.
-