mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Handle LRP tokens in flows
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=130679951
This commit is contained in:
parent
5ff8b9377c
commit
1894b2308b
9 changed files with 256 additions and 5 deletions
|
@ -16,12 +16,16 @@ package google.registry.pricing;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.pricing.PricingEngineProxy.getPricesForDomainName;
|
||||
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.DomainCommand.Create;
|
||||
import google.registry.model.domain.LrpToken;
|
||||
import google.registry.model.domain.fee.EapFee;
|
||||
import google.registry.model.domain.fee.Fee;
|
||||
import google.registry.model.pricing.PremiumPricingEngine.DomainPrices;
|
||||
|
@ -146,4 +150,26 @@ public final class TldSpecificLogicProxy {
|
|||
public static Optional<String> getFeeClass(String domainName, DateTime date) {
|
||||
return getPricesForDomainName(domainName, date).getFeeClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a {@link Create} command has a valid {@link LrpToken} for a particular TLD, and
|
||||
* return that token (wrapped in an {@link Optional}) if one exists.
|
||||
*
|
||||
* <p>This method has no knowledge of whether or not an auth code (interpreted here as an LRP
|
||||
* token) has already been checked against the reserved list for QLP (anchor tenant), as auth
|
||||
* codes are used for both types of registrations.
|
||||
*/
|
||||
public static Optional<LrpToken> getMatchingLrpToken(Create createCommand) {
|
||||
// Note that until the actual per-TLD logic is built out, what's being done here is a basic
|
||||
// domain-name-to-assignee match.
|
||||
String lrpToken = createCommand.getAuthInfo().getPw().getValue();
|
||||
LrpToken token = ofy().load().key(Key.create(LrpToken.class, lrpToken)).now();
|
||||
if (token != null) {
|
||||
if (token.getAssignee().equalsIgnoreCase(createCommand.getFullyQualifiedDomainName())
|
||||
&& token.getRedemptionHistoryEntry() == null) {
|
||||
return Optional.of(token);
|
||||
}
|
||||
}
|
||||
return Optional.<LrpToken>absent();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue