mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Restrict domain transfer periods to 1 year
It turns out that this ICANN policy appears to prohibit transfers with registration extensions other than 1 year (section A.8): https://www.icann.org/resources/pages/policy-2012-03-07-en This is backed up by the practical fact that we've never seen a registrar request a transfer for any period other than one year. And removing the support for multi-year transfers vastly simplifies transfer logic and eliminates a bunch of annoying corner cases. Users still can achieve the same thing by doing a 1-year transfer plus a manual renewal afterwards for the remainder of the desired extension. This change leaves in place lots of infrastructure to support multi-year transfers that is now obsolete (e.g. TransferData.extendedRegistrationYears). This should all be cleaned up, but it's a lower priority than fixing the gap itself and insulating ourselves against needing to handle any real multi-year transfer case. Once this CL goes in, we can start ignoring extendedRegistrationYears entirely because it'll always be 1 year, which makes the cleanup process easier. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=150212864
This commit is contained in:
parent
852f1afb6c
commit
f28104ad03
13 changed files with 97 additions and 42 deletions
|
@ -53,6 +53,7 @@ import google.registry.flows.exceptions.AlreadyPendingTransferException;
|
|||
import google.registry.flows.exceptions.MissingTransferRequestAuthInfoException;
|
||||
import google.registry.flows.exceptions.ObjectAlreadySponsoredException;
|
||||
import google.registry.flows.exceptions.ResourceStatusProhibitsOperationException;
|
||||
import google.registry.flows.exceptions.TransferPeriodMustBeOneYearException;
|
||||
import google.registry.model.billing.BillingEvent;
|
||||
import google.registry.model.billing.BillingEvent.Cancellation.Builder;
|
||||
import google.registry.model.billing.BillingEvent.Reason;
|
||||
|
@ -500,22 +501,35 @@ public class DomainTransferRequestFlowTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_missingPeriod() throws Exception {
|
||||
public void testSuccess_missingPeriod_defaultsToOneYear() throws Exception {
|
||||
setupDomain("example", "tld");
|
||||
doSuccessfulTest("domain_transfer_request_missing_period.xml",
|
||||
doSuccessfulTest(
|
||||
"domain_transfer_request_missing_period.xml",
|
||||
"domain_transfer_request_response.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_multiYearPeriod() throws Exception {
|
||||
setupDomain("example", "tld");
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(TransferPeriodMustBeOneYearException.class);
|
||||
doFailingTest("domain_transfer_request_2_years.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_cappedExpiration() throws Exception {
|
||||
setupDomain("example", "tld");
|
||||
// The current expiration is in 15 months, so requesting 10 years would give 11 years 3 months,
|
||||
// were it not that we cap at 10 years. (MAX_REGISTRATION_YEARS == 10 and is unlikely to ever
|
||||
// change; we just use a constant for readability.)
|
||||
// Set the domain to expire 10 years from now (as if it were just created with a 10-year term).
|
||||
domain = persistResource(domain.asBuilder()
|
||||
.setRegistrationExpirationTime(clock.nowUtc().plusYears(10))
|
||||
.build());
|
||||
// New expiration time should be capped at exactly 10 years from the transfer server-approve
|
||||
// time, so the domain only ends up gaining the 5-day transfer window's worth of extra
|
||||
// registration time.
|
||||
clock.advanceOneMilli();
|
||||
doSuccessfulTest(
|
||||
"domain_transfer_request_10_years.xml",
|
||||
"domain_transfer_request_response_10_years.xml",
|
||||
"domain_transfer_request.xml",
|
||||
"domain_transfer_request_response_10_year_cap.xml",
|
||||
clock.nowUtc().plus(Registry.get("tld").getAutomaticTransferLength()).plusYears(10));
|
||||
}
|
||||
|
||||
|
@ -534,16 +548,16 @@ public class DomainTransferRequestFlowTest
|
|||
doSuccessfulTest(
|
||||
"domain_transfer_request_fee.xml",
|
||||
"domain_transfer_request_response_fees.xml",
|
||||
domain.getRegistrationExpirationTime().plusYears(3),
|
||||
domain.getRegistrationExpirationTime().plusYears(1),
|
||||
new ImmutableMap.Builder<String, String>()
|
||||
.put("DOMAIN", "expensive-domain.foo")
|
||||
.put("YEARS", "3")
|
||||
.put("AMOUNT", "133.00")
|
||||
.put("EXDATE", "2004-09-08T22:00:00.0Z")
|
||||
.put("YEARS", "1")
|
||||
.put("AMOUNT", "111.00")
|
||||
.put("EXDATE", "2002-09-08T22:00:00.0Z")
|
||||
.put("FEE_VERSION", "0.6")
|
||||
.put("FEE_NS", "fee")
|
||||
.build(),
|
||||
Optional.of(Money.of(USD, 133)));
|
||||
Optional.of(Money.of(USD, 111)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue