mirror of
https://github.com/google/nomulus.git
synced 2025-05-29 08:50:09 +02:00
Simplify blocking of renews for domains in pending transfer
This tweaks the logic that prohibits domain renews during pending transfers to just use the regular verifyNoDisallowedStatuses() check instead of a special check on TransferData with a custom exception. This is simpler and produces a better error message: we get "Operation disallowed by status: pendingTransfer" instead of "Object with given ID (foo.com) already has a pending transfer" (which is intended for use when denying a transfer request for an object already being transferred, not for this case). For the record, we originally prohibited renews for domains in pending transfer because there's no good reason to do such a renew: b/12533793. But in fact our transfer server-approve logic relies heavily on this behavior, because otherwise the domain's expiration time computed in cloneProjectedAtTime() will reflect the transfer year added to the post-renew expiration time, whereas all the transfer server approve entities (e.g. new autorenew billing event) will reflect the pre-renew expiration time at the moment the transfer was requested. As such, it would be quite difficult to ever support a renew during pending transfer, since it would need to change many fields within the transfer server approve entities. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=150325501
This commit is contained in:
parent
4d20490258
commit
e1c9395749
3 changed files with 3 additions and 19 deletions
|
@ -545,9 +545,6 @@ comes in at the exact millisecond that the domain would have expired.
|
|||
* 2201
|
||||
* The specified resource belongs to another client.
|
||||
* Registrar is not authorized to access this TLD.
|
||||
* 2300
|
||||
* The domain has a pending transfer on it and so can't be explicitly
|
||||
renewed.
|
||||
* 2303
|
||||
* Resource with this id does not exist.
|
||||
* 2304
|
||||
|
|
|
@ -35,7 +35,6 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.EppException.ObjectPendingTransferException;
|
||||
import google.registry.flows.EppException.ParameterValueRangeErrorException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
|
@ -70,7 +69,6 @@ import google.registry.model.eppoutput.EppResponse;
|
|||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.money.Money;
|
||||
import org.joda.time.DateTime;
|
||||
|
@ -99,7 +97,6 @@ import org.joda.time.DateTime;
|
|||
* @error {@link DomainFlowUtils.FeesRequiredForPremiumNameException}
|
||||
* @error {@link DomainFlowUtils.NotAuthorizedForTldException}
|
||||
* @error {@link DomainFlowUtils.UnsupportedFeeAttributeException}
|
||||
* @error {@link DomainRenewFlow.DomainHasPendingTransferException}
|
||||
* @error {@link DomainRenewFlow.IncorrectCurrentExpirationDateException}
|
||||
*/
|
||||
public final class DomainRenewFlow implements TransactionalFlow {
|
||||
|
@ -107,6 +104,8 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
|||
private static final ImmutableSet<StatusValue> RENEW_DISALLOWED_STATUSES = ImmutableSet.of(
|
||||
StatusValue.CLIENT_RENEW_PROHIBITED,
|
||||
StatusValue.PENDING_DELETE,
|
||||
// Disallow renews during pendingTransfer; it needlessly complicates server-approve transfers.
|
||||
StatusValue.PENDING_TRANSFER,
|
||||
StatusValue.SERVER_RENEW_PROHIBITED);
|
||||
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
|
@ -219,10 +218,6 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
|||
verifyResourceOwnership(clientId, existingDomain);
|
||||
}
|
||||
checkAllowedAccessToTld(clientId, existingDomain.getTld());
|
||||
// Verify that the resource does not have a pending transfer on it.
|
||||
if (existingDomain.getTransferData().getTransferStatus() == TransferStatus.PENDING) {
|
||||
throw new DomainHasPendingTransferException(targetId);
|
||||
}
|
||||
verifyUnitIsYears(command.getPeriod());
|
||||
// If the date they specify doesn't match the expiration, fail. (This is an idempotence check).
|
||||
if (!command.getCurrentExpirationDate().equals(
|
||||
|
@ -255,13 +250,6 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
|||
.build());
|
||||
}
|
||||
|
||||
/** The domain has a pending transfer on it and so can't be explicitly renewed. */
|
||||
public static class DomainHasPendingTransferException extends ObjectPendingTransferException {
|
||||
public DomainHasPendingTransferException(String targetId) {
|
||||
super(targetId);
|
||||
}
|
||||
}
|
||||
|
||||
/** The current expiration date is incorrect. */
|
||||
static class IncorrectCurrentExpirationDateException extends ParameterValueRangeErrorException {
|
||||
public IncorrectCurrentExpirationDateException() {
|
||||
|
|
|
@ -46,7 +46,6 @@ import google.registry.flows.domain.DomainFlowUtils.FeesMismatchException;
|
|||
import google.registry.flows.domain.DomainFlowUtils.FeesRequiredForPremiumNameException;
|
||||
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
|
||||
import google.registry.flows.domain.DomainFlowUtils.UnsupportedFeeAttributeException;
|
||||
import google.registry.flows.domain.DomainRenewFlow.DomainHasPendingTransferException;
|
||||
import google.registry.flows.domain.DomainRenewFlow.IncorrectCurrentExpirationDateException;
|
||||
import google.registry.flows.exceptions.ResourceStatusProhibitsOperationException;
|
||||
import google.registry.model.billing.BillingEvent;
|
||||
|
@ -573,7 +572,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.asBuilder()
|
||||
.setRegistrationExpirationTime(DateTime.parse("2001-09-08T22:00:00.0Z"))
|
||||
.build());
|
||||
thrown.expect(DomainHasPendingTransferException.class);
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "pendingTransfer");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue