mirror of
https://github.com/google/nomulus.git
synced 2025-07-25 03:58:34 +02:00
Allow domain transfers with 0 period and in auto-renew grace period
Normally, if a domain is in the auto-renew grace period, a transfer will cancel the auto-renew billing event. In the event of a transfer with no change to registration end date, the auto-renew billing event should not be cancelled and the gaining registrar should not be charged for the transfer. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=170576726
This commit is contained in:
parent
3c0b17dc6f
commit
7aa5629517
9 changed files with 120 additions and 50 deletions
|
@ -42,6 +42,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
|
||||
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
|
||||
|
@ -52,6 +53,7 @@ import google.registry.model.billing.BillingEvent.Cancellation;
|
|||
import google.registry.model.billing.BillingEvent.Cancellation.Builder;
|
||||
import google.registry.model.billing.BillingEvent.OneTime;
|
||||
import google.registry.model.billing.BillingEvent.Reason;
|
||||
import google.registry.model.billing.BillingEvent.Recurring;
|
||||
import google.registry.model.contact.ContactAuthInfo;
|
||||
import google.registry.model.domain.DomainAuthInfo;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
|
@ -568,7 +570,6 @@ public class DomainTransferApproveFlowTest
|
|||
previousSuccessRecord.asBuilder().setReportAmount(-1).build(),
|
||||
DomainTransactionRecord.create(
|
||||
"tld", clock.nowUtc().plusDays(3), TRANSFER_SUCCESSFUL, 1));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -589,4 +590,37 @@ public class DomainTransferApproveFlowTest
|
|||
domain.getRegistrationExpirationTime().plusYears(0));
|
||||
assertHistoryEntriesDoNotContainTransferBillingEventsOrGracePeriods();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_superuserExtension_transferPeriodZero_autorenewGraceActive()
|
||||
throws Exception {
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
Key<Recurring> existingAutorenewEvent = domain.getAutorenewBillingEvent();
|
||||
// Set domain to have auto-renewed just before the transfer request, so that it will have an
|
||||
// active autorenew grace period spanning the entire transfer window.
|
||||
DateTime autorenewTime = clock.nowUtc().minusDays(1);
|
||||
DateTime expirationTime = autorenewTime.plusYears(1);
|
||||
TransferData.Builder transferDataBuilder = domain.getTransferData().asBuilder();
|
||||
domain =
|
||||
persistResource(
|
||||
domain
|
||||
.asBuilder()
|
||||
.setTransferData(
|
||||
transferDataBuilder.setTransferPeriod(Period.create(0, Unit.YEARS)).build())
|
||||
.setRegistrationExpirationTime(expirationTime)
|
||||
.addGracePeriod(
|
||||
GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.AUTO_RENEW,
|
||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
||||
"TheRegistrar",
|
||||
existingAutorenewEvent))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
runSuccessfulFlowWithAssertions(
|
||||
"tld",
|
||||
"domain_transfer_approve.xml",
|
||||
"domain_transfer_approve_response_zero_period_autorenew_grace.xml",
|
||||
domain.getRegistrationExpirationTime());
|
||||
assertHistoryEntriesDoNotContainTransferBillingEventsOrGracePeriods();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ import google.registry.flows.exceptions.InvalidTransferPeriodValueException;
|
|||
import google.registry.flows.exceptions.MissingTransferRequestAuthInfoException;
|
||||
import google.registry.flows.exceptions.ObjectAlreadySponsoredException;
|
||||
import google.registry.flows.exceptions.ResourceStatusProhibitsOperationException;
|
||||
import google.registry.flows.exceptions.SuperuserExtensionAndAutorenewGracePeriodException;
|
||||
import google.registry.flows.exceptions.TransferPeriodMustBeOneYearException;
|
||||
import google.registry.flows.exceptions.TransferPeriodZeroAndFeeTransferExtensionException;
|
||||
import google.registry.model.billing.BillingEvent;
|
||||
|
@ -713,20 +712,33 @@ public class DomainTransferRequestFlowTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_superuserExtension_duringAutorenewGracePeriod() throws Exception {
|
||||
setupDomain("example", "tld");
|
||||
public void testSuccess_superuserExtension_zeroPeriod_autorenewGraceActive()
|
||||
throws Exception {
|
||||
eppRequestSource = EppRequestSource.TOOL;
|
||||
DomainResource domain = reloadResourceByForeignKey();
|
||||
DateTime oldExpirationTime = clock.nowUtc().minusDays(1);
|
||||
persistResource(domain.asBuilder()
|
||||
.setRegistrationExpirationTime(oldExpirationTime)
|
||||
setupDomain("example", "tld");
|
||||
Key<BillingEvent.Recurring> existingAutorenewEvent =
|
||||
domain.getAutorenewBillingEvent();
|
||||
// Set domain to have auto-renewed just before the transfer request, so that it will have an
|
||||
// active autorenew grace period spanning the entire transfer window.
|
||||
DateTime autorenewTime = clock.nowUtc().minusDays(1);
|
||||
DateTime expirationTime = autorenewTime.plusYears(1);
|
||||
domain = persistResource(domain.asBuilder()
|
||||
.setRegistrationExpirationTime(expirationTime)
|
||||
.addGracePeriod(GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.AUTO_RENEW,
|
||||
autorenewTime.plus(Registry.get("tld").getAutoRenewGracePeriodLength()),
|
||||
"TheRegistrar",
|
||||
existingAutorenewEvent))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(SuperuserExtensionAndAutorenewGracePeriodException.class);
|
||||
runTest(
|
||||
doSuccessfulSuperuserExtensionTest(
|
||||
"domain_transfer_request_superuser_extension.xml",
|
||||
UserPrivileges.SUPERUSER,
|
||||
ImmutableMap.of("PERIOD", "1", "AUTOMATIC_TRANSFER_LENGTH", "5"));
|
||||
"domain_transfer_request_response_su_ext_zero_period_autorenew_grace.xml",
|
||||
domain.getRegistrationExpirationTime(),
|
||||
ImmutableMap.of("PERIOD", "0", "AUTOMATIC_TRANSFER_LENGTH", "0"),
|
||||
Optional.<Money>absent(),
|
||||
Period.create(0, Unit.YEARS),
|
||||
Duration.standardDays(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<response>
|
||||
<result code="1000">
|
||||
<msg>Command completed successfully</msg>
|
||||
</result>
|
||||
<resData>
|
||||
<domain:trnData
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.tld</domain:name>
|
||||
<domain:trStatus>clientApproved</domain:trStatus>
|
||||
<domain:reID>NewRegistrar</domain:reID>
|
||||
<domain:reDate>2000-06-06T22:00:00.0Z</domain:reDate>
|
||||
<domain:acID>TheRegistrar</domain:acID>
|
||||
<domain:acDate>2000-06-09T22:00:00.0Z</domain:acDate>
|
||||
<domain:exDate>2001-06-08T22:00:00.0Z</domain:exDate>
|
||||
</domain:trnData>
|
||||
</resData>
|
||||
<trID>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
<svTRID>server-trid</svTRID>
|
||||
</trID>
|
||||
</response>
|
||||
</epp>
|
|
@ -0,0 +1,23 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<response>
|
||||
<result code="1001">
|
||||
<msg>Command completed successfully; action pending</msg>
|
||||
</result>
|
||||
<resData>
|
||||
<domain:trnData
|
||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||
<domain:name>example.tld</domain:name>
|
||||
<domain:trStatus>pending</domain:trStatus>
|
||||
<domain:reID>NewRegistrar</domain:reID>
|
||||
<domain:reDate>2000-06-09T22:00:00.0Z</domain:reDate>
|
||||
<domain:acID>TheRegistrar</domain:acID>
|
||||
<domain:acDate>2000-06-09T22:00:00.0Z</domain:acDate>
|
||||
<domain:exDate>2001-06-08T22:00:00.0Z</domain:exDate>
|
||||
</domain:trnData>
|
||||
</resData>
|
||||
<trID>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
<svTRID>server-trid</svTRID>
|
||||
</trID>
|
||||
</response>
|
||||
</epp>
|
Loading…
Add table
Add a link
Reference in a new issue