Remove obsolete TransferData.extendedRegistrationYears

Now that transfers are always restricted to 1 year, it's unnecessary to store
extendedRegistrationYears on TransferData - it will always be equal to 1.  This
simplifies logic in a few other places, e.g. RdeDomainImportAction.

I verified in BigQuery that no DomainBases exist with extendedRegistrationYears
values that aren't either null or equal to 1.  At some point we should remove
the persisted fields from datastore via e.g. resaving all those domains, but
it's low priority and can wait until we have some more pressing migration.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150373897
This commit is contained in:
nickfelt 2017-03-16 15:03:18 -07:00 committed by Ben McIlwain
parent 70fbdccea2
commit 09f619cce2
29 changed files with 54 additions and 215 deletions

View file

@ -96,14 +96,13 @@ public final class ResourceFlowUtils {
builder = new ContactTransferResponse.Builder().setContactId(eppResource.getForeignKey());
} else {
DomainResource domain = (DomainResource) eppResource;
builder = new DomainTransferResponse.Builder()
builder =
new DomainTransferResponse.Builder()
.setFullyQualifiedDomainNameName(eppResource.getForeignKey())
// TODO(b/25084229): fix exDate computation logic.
.setExtendedRegistrationExpirationTime(
ADD_EXDATE_STATUSES.contains(transferData.getTransferStatus())
? extendRegistrationWithCap(
now,
domain.getRegistrationExpirationTime(),
transferData.getExtendedRegistrationYears())
? extendRegistrationWithCap(now, domain.getRegistrationExpirationTime(), 1)
: null);
}
builder.setGainingClientId(transferData.getGainingClientId())
@ -218,7 +217,6 @@ public final class ResourceFlowUtils {
TransferData oldTransferData, TransferStatus transferStatus, DateTime now) {
checkArgument(!oldTransferData.equals(TransferData.EMPTY), "No old transfer to resolve.");
return oldTransferData.asBuilder()
.setExtendedRegistrationYears(null)
.setServerApproveEntities(null)
.setServerApproveBillingEvent(null)
.setServerApproveAutorenewEvent(null)

View file

@ -108,20 +108,20 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
.setOtherClientId(gainingClientId)
.setParent(Key.create(existingDomain))
.build();
int extraYears = transferData.getExtendedRegistrationYears();
// Bill for the transfer.
BillingEvent.OneTime billingEvent = new BillingEvent.OneTime.Builder()
.setReason(Reason.TRANSFER)
.setTargetId(targetId)
.setClientId(gainingClientId)
.setPeriodYears(extraYears)
.setCost(getDomainRenewCost(targetId, transferData.getTransferRequestTime(), extraYears))
.setPeriodYears(1)
.setCost(getDomainRenewCost(targetId, transferData.getTransferRequestTime(), 1))
.setEventTime(now)
.setBillingTime(now.plus(Registry.get(tld).getTransferGracePeriodLength()))
.setParent(historyEntry)
.build();
// If we are within an autorenew grace period, cancel the autorenew billing event and reduce
// the number of years to extend the registration by one to "subsume" the autorenew.
// If we are within an autorenew grace period, cancel the autorenew billing event and don't
// increase the registration time, since the transfer subsumes the autorenew's extra year.
int extraYears = 1; // All transfers are one year.
GracePeriod autorenewGrace =
getOnlyElement(existingDomain.getGracePeriodsOfType(GracePeriodStatus.AUTO_RENEW), null);
if (autorenewGrace != null) {

View file

@ -85,11 +85,8 @@ public final class DomainTransferQueryFlow implements Flow {
DateTime newExpirationTime = null;
if (transferData.getTransferStatus().isApproved()
|| transferData.getTransferStatus().equals(TransferStatus.PENDING)) {
// TODO(b/25084229): This is not quite right.
newExpirationTime = extendRegistrationWithCap(
now,
domain.getRegistrationExpirationTime(),
transferData.getExtendedRegistrationYears());
// TODO(b/25084229): fix exDate computation logic.
newExpirationTime = extendRegistrationWithCap(now, domain.getRegistrationExpirationTime(), 1);
}
return responseBuilder
.setResData(createTransferResponse(targetId, transferData, newExpirationTime))

View file

@ -128,7 +128,6 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
extensionManager.validate();
validateClientIsLoggedIn(gainingClientId);
Period period = ((Transfer) resourceCommand).getPeriod();
int years = period.getValue();
DateTime now = ofy().getTransactionTime();
DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
verifyTransferAllowed(existingDomain, period, now);
@ -143,25 +142,24 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
DateTime automaticTransferTime = now.plus(registry.getAutomaticTransferLength());
// If the domain will be in the auto-renew grace period at the moment of transfer, the transfer
// will subsume the autorenew, so we reduce by 1 the number of years to extend the registration.
// Note that the regular "years" remains the same since it affects the transfer charge amount.
// The gaining registrar is still billed for the full years; the losing registrar will get a
// will subsume the autorenew, so we don't add the normal extra year from the transfer.
// The gaining registrar is still billed for the extra year; the losing registrar will get a
// cancellation for the autorenew written out within createTransferServerApproveEntities().
//
// See b/19430703#comment17 and https://www.icann.org/news/advisory-2002-06-06-en for the
// policy documentation for transfers subsuming autorenews within the autorenew grace period.
int registrationExtensionYears = years;
int extraYears = 1;
DomainResource domainAtTransferTime =
existingDomain.cloneProjectedAtTime(automaticTransferTime);
if (!domainAtTransferTime.getGracePeriodsOfType(GracePeriodStatus.AUTO_RENEW).isEmpty()) {
registrationExtensionYears--;
extraYears--;
}
// The new expiration time if there is a server approval.
DateTime serverApproveNewExpirationTime =
extendRegistrationWithCap(
automaticTransferTime,
domainAtTransferTime.getRegistrationExpirationTime(),
registrationExtensionYears);
extraYears);
// Create speculative entities in anticipation of an automatic server approval.
ImmutableSet<TransferServerApproveEntity> serverApproveEntities =
createTransferServerApproveEntities(
@ -172,11 +170,10 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
trid,
gainingClientId,
feesAndCredits.getTotalCost(),
years,
now);
// Create the transfer data that represents the pending transfer.
TransferData pendingTransferData = createPendingTransferData(
createTransferDataBuilder(existingDomain, automaticTransferTime, years, now),
createTransferDataBuilder(existingDomain, automaticTransferTime, now),
serverApproveEntities);
// Create a poll message to notify the losing registrar that a transfer was requested.
PollMessage requestPollMessage = createLosingTransferPollMessage(
@ -262,14 +259,13 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
}
private Builder createTransferDataBuilder(
DomainResource existingDomain, DateTime automaticTransferTime, int years, DateTime now) {
DomainResource existingDomain, DateTime automaticTransferTime, DateTime now) {
return new TransferData.Builder()
.setTransferRequestTrid(trid)
.setTransferRequestTime(now)
.setGainingClientId(gainingClientId)
.setLosingClientId(existingDomain.getCurrentSponsorClientId())
.setPendingTransferExpirationTime(automaticTransferTime)
.setExtendedRegistrationYears(years);
.setPendingTransferExpirationTime(automaticTransferTime);
}
private DomainTransferResponse createResponse(

View file

@ -92,13 +92,12 @@ public final class DomainTransferUtils {
Trid trid,
String gainingClientId,
Money transferCost,
int years,
DateTime now) {
String targetId = existingDomain.getFullyQualifiedDomainName();
// Create a TransferData for the server-approve case to use for the speculative poll messages.
TransferData serverApproveTransferData =
createTransferDataBuilder(
existingDomain, trid, gainingClientId, automaticTransferTime, years, now)
existingDomain, trid, gainingClientId, automaticTransferTime, now)
.setTransferStatus(TransferStatus.SERVER_APPROVED)
.build();
Registry registry = Registry.get(existingDomain.getTld());
@ -110,8 +109,7 @@ public final class DomainTransferUtils {
targetId,
gainingClientId,
registry,
transferCost,
years))
transferCost))
.addAll(
createOptionalAutorenewCancellation(
automaticTransferTime, historyEntry, targetId, existingDomain)
@ -255,14 +253,13 @@ public final class DomainTransferUtils {
String targetId,
String gainingClientId,
Registry registry,
Money transferCost,
int years) {
Money transferCost) {
return new BillingEvent.OneTime.Builder()
.setReason(Reason.TRANSFER)
.setTargetId(targetId)
.setClientId(gainingClientId)
.setCost(transferCost)
.setPeriodYears(years)
.setPeriodYears(1)
.setEventTime(automaticTransferTime)
.setBillingTime(automaticTransferTime.plus(registry.getTransferGracePeriodLength()))
.setParent(historyEntry)
@ -274,15 +271,13 @@ public final class DomainTransferUtils {
Trid trid,
String gainingClientId,
DateTime automaticTransferTime,
int years,
DateTime now) {
return new TransferData.Builder()
.setTransferRequestTrid(trid)
.setTransferRequestTime(now)
.setGainingClientId(gainingClientId)
.setLosingClientId(existingDomain.getCurrentSponsorClientId())
.setPendingTransferExpirationTime(automaticTransferTime)
.setExtendedRegistrationYears(years);
.setPendingTransferExpirationTime(automaticTransferTime);
}
private DomainTransferUtils() {}

View file

@ -247,9 +247,8 @@ public class DomainResource extends DomainBase
cloneProjectedAtTime(transferExpirationTime.minusMillis(1));
// If we are within an autorenew grace period, the transfer will subsume the autorenew. There
// will already be a cancellation written in advance by the transfer request flow, so we don't
// need to worry about billing, but we do need to reduce the number of years added to the
// expiration time by one to account for the year added by the autorenew.
int extraYears = transferData.getExtendedRegistrationYears();
// need to worry about billing, but we do need to cancel out the expiration time increase.
int extraYears = 1; // All transfers are one year.
if (domainAtTransferTime.getGracePeriodStatuses().contains(GracePeriodStatus.AUTO_RENEW)) {
extraYears--;
}

View file

@ -81,12 +81,6 @@ public class TransferData extends BaseTransferObject implements Buildable {
/** The transaction id of the most recent transfer request (or null if there never was one). */
Trid transferRequestTrid;
/**
* The number of years to add to the registration expiration time if this transfer is approved.
* Can be null if never transferred, or for resource types where it's not applicable.
*/
Integer extendedRegistrationYears;
public ImmutableSet<Key<? extends TransferServerApproveEntity>> getServerApproveEntities() {
return nullToEmptyImmutableCopy(serverApproveEntities);
}
@ -107,10 +101,6 @@ public class TransferData extends BaseTransferObject implements Buildable {
return transferRequestTrid;
}
public Integer getExtendedRegistrationYears() {
return extendedRegistrationYears;
}
@Override
public Builder asBuilder() {
return new Builder(clone(this));
@ -155,12 +145,6 @@ public class TransferData extends BaseTransferObject implements Buildable {
getInstance().transferRequestTrid = transferRequestTrid;
return this;
}
/** Set the years to add to the registration if this transfer completes. */
public Builder setExtendedRegistrationYears(Integer extendedRegistrationYears) {
getInstance().extendedRegistrationYears = extendedRegistrationYears;
return thisCastToDerived();
}
}
/**

View file

@ -17,7 +17,6 @@ package google.registry.rde;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Ascii;
import com.google.common.base.Optional;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
@ -257,9 +256,9 @@ final class DomainResourceToXjcConverter {
bean.setAcRr(RdeUtil.makeXjcRdeRrType(model.getLosingClientId()));
bean.setReDate(model.getTransferRequestTime());
bean.setAcDate(model.getPendingTransferExpirationTime());
// TODO(b/25084229): fix exDate computation logic.
if (model.getTransferStatus() == TransferStatus.PENDING) {
int years = Optional.fromNullable(model.getExtendedRegistrationYears()).or(0);
bean.setExDate(domainExpires.plusYears(years));
bean.setExDate(domainExpires.plusYears(1));
} else {
bean.setExDate(domainExpires);
}

View file

@ -189,19 +189,17 @@ public class RdeDomainImportAction implements Runnable {
Money transferCost = getDomainRenewCost(
domain.getFullyQualifiedDomainName(),
transferData.getPendingTransferExpirationTime(),
transferData.getExtendedRegistrationYears());
1);
// Create speculative entities in anticipation of an automatic server approval.
ImmutableSet<TransferServerApproveEntity> serverApproveEntities =
createTransferServerApproveEntities(
transferData.getPendingTransferExpirationTime(),
domain.getRegistrationExpirationTime()
.plusYears(transferData.getExtendedRegistrationYears()),
domain.getRegistrationExpirationTime().plusYears(1),
historyEntry,
domain,
historyEntry.getTrid(),
transferData.getGainingClientId(),
transferCost,
transferData.getExtendedRegistrationYears(),
transferData.getTransferRequestTime());
transferData =
createPendingTransferData(transferData.asBuilder(), serverApproveEntities);

View file

@ -60,7 +60,6 @@ import java.security.ProviderException;
import java.security.SecureRandom;
import java.util.Random;
import org.joda.time.DateTime;
import org.joda.time.Years;
/** Utility class that converts an {@link XjcRdeDomainElement} into a {@link DomainResource}. */
final class XjcToDomainResourceConverter extends XjcToEppResourceConverter {
@ -208,7 +207,7 @@ final class XjcToDomainResourceConverter extends XjcToEppResourceConverter {
? ImmutableSet.<DelegationSignerData>of()
: ImmutableSet.copyOf(
transform(domain.getSecDNS().getDsDatas(), SECDNS_CONVERTER)))
.setTransferData(convertDomainTransferData(domain.getTrnData(), domain.getExDate()))
.setTransferData(convertDomainTransferData(domain.getTrnData()))
// authInfo pw must be a token between 6 and 16 characters in length
// generate a token of 16 characters as the default authInfo pw
.setAuthInfo(DomainAuthInfo
@ -241,34 +240,17 @@ final class XjcToDomainResourceConverter extends XjcToEppResourceConverter {
}
/** Converts {@link XjcRdeDomainTransferDataType} to {@link TransferData}. */
private static TransferData convertDomainTransferData(XjcRdeDomainTransferDataType data,
DateTime domainExpiration) {
private static TransferData convertDomainTransferData(XjcRdeDomainTransferDataType data) {
if (data == null) {
return TransferData.EMPTY;
}
// If the transfer is pending, calculate the number of years to add to the domain expiration
// on approval of the transfer.
TransferStatus transferStatus = TRANSFER_STATUS_MAPPER.xmlToEnum(data.getTrStatus().value());
// Get new expiration date
DateTime newExpirationTime = domainExpiration;
if (transferStatus == TransferStatus.PENDING) {
// Default to domain expiration time plus one year if no expiration is specified
if (data.getExDate() == null) {
newExpirationTime = newExpirationTime.plusYears(1);
} else {
newExpirationTime = data.getExDate();
}
}
// TODO(b/25084229): read in the exDate and store it somewhere.
return new TransferData.Builder()
.setTransferStatus(transferStatus)
.setTransferStatus(TRANSFER_STATUS_MAPPER.xmlToEnum(data.getTrStatus().value()))
.setGainingClientId(data.getReRr().getValue())
.setLosingClientId(data.getAcRr().getValue())
.setTransferRequestTime(data.getReDate())
.setPendingTransferExpirationTime(data.getAcDate())
// This will be wrong for domains that are not in pending transfer,
// but there isn't a reliable way to calculate it.
.setExtendedRegistrationYears(
Years.yearsBetween(domainExpiration, newExpirationTime).getYears())
.build();
}

View file

@ -298,18 +298,15 @@ public class DomainTransferApproveFlowTest
DateTime oldExpirationTime = clock.nowUtc().minusDays(1);
persistResource(domain.asBuilder()
.setRegistrationExpirationTime(oldExpirationTime)
.setTransferData(domain.getTransferData().asBuilder()
.setExtendedRegistrationYears(2)
.build())
.build());
// The autorenew should be subsumed into the transfer resulting in 2 years of renewal in total.
// The autorenew should be subsumed into the transfer resulting in 1 year of renewal in total.
clock.advanceOneMilli();
doSuccessfulTest(
"tld",
"domain_transfer_approve_domain_authinfo.xml",
"domain_transfer_approve_response_autorenew.xml",
oldExpirationTime.plusYears(2),
2,
oldExpirationTime.plusYears(1),
1,
// Expect the grace period for autorenew to be cancelled.
new BillingEvent.Cancellation.Builder()
.setReason(Reason.RENEW)

View file

@ -101,7 +101,6 @@ public class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
TRANSFER_REQUEST_TIME,
TRANSFER_EXPIRATION_TIME,
EXTENDED_REGISTRATION_EXPIRATION_TIME,
EXTENDED_REGISTRATION_YEARS,
TRANSFER_REQUEST_TIME);
}
@ -176,8 +175,7 @@ public class DomainTransferFlowTestCase<F extends Flow, R extends EppResource>
domain,
historyEntry,
TRANSFER_REQUEST_TIME,
TRANSFER_EXPIRATION_TIME,
EXTENDED_REGISTRATION_YEARS);
TRANSFER_EXPIRATION_TIME);
}
/** Get the autorenew event that the losing client will have after a SERVER_APPROVED transfer. */

View file

@ -148,10 +148,10 @@ public class DomainTransferQueryFlowTest
@Test
public void testSuccess_tenYears() throws Exception {
// Extend registration by 9 years here; with the extra 1 year from the transfer, we should
// hit the 10-year capping.
domain = persistResource(domain.asBuilder()
.setTransferData(domain.getTransferData().asBuilder()
.setExtendedRegistrationYears(10)
.build())
.setRegistrationExpirationTime(domain.getRegistrationExpirationTime().plusYears(9))
.build());
doSuccessfulTest(
"domain_transfer_query.xml",

View file

@ -164,7 +164,6 @@ public class DomainTransferRequestFlowTest
domain = reloadResourceByForeignKey();
final HistoryEntry historyEntryTransferRequest =
getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST);
int registrationYears = domain.getTransferData().getExtendedRegistrationYears();
subordinateHost = reloadResourceAndCloneAtTime(subordinateHost, clock.nowUtc());
assertTransferRequested(domain);
assertAboutDomains().that(domain)
@ -174,7 +173,7 @@ public class DomainTransferRequestFlowTest
HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST);
assertAboutHistoryEntries()
.that(historyEntryTransferRequest)
.hasPeriodYears(registrationYears)
.hasPeriodYears(1)
.and()
.hasOtherClientId("TheRegistrar");
assertAboutHosts().that(subordinateHost).hasNoHistoryEntries();
@ -190,8 +189,8 @@ public class DomainTransferRequestFlowTest
.setEventTime(implicitTransferTime)
.setBillingTime(implicitTransferTime.plus(registry.getTransferGracePeriodLength()))
.setClientId("NewRegistrar")
.setCost(transferCost.or(Money.of(USD, 11).multipliedBy(registrationYears)))
.setPeriodYears(registrationYears)
.setCost(transferCost.or(Money.of(USD, 11)))
.setPeriodYears(1)
.setParent(historyEntryTransferRequest)
.build();
assertBillingEvents(FluentIterable.from(extraExpectedBillingEvents)

View file

@ -12,7 +12,7 @@
<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>2002-06-08T22:00:00.0Z</domain:exDate>
<domain:exDate>2001-06-08T22:00:00.0Z</domain:exDate>
</domain:trnData>
</resData>
<trID>

View file

@ -193,7 +193,6 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.setTransferRequestTime(requestTime)
.setLosingClientId("TheRegistrar")
.setPendingTransferExpirationTime(transferExpirationTime)
.setExtendedRegistrationYears(1)
.build())
.build());
persistResource(
@ -222,7 +221,6 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.setTransferRequestTime(requestTime)
.setLosingClientId("NewRegistrar")
.setPendingTransferExpirationTime(transferExpirationTime)
.setExtendedRegistrationYears(1)
.build())
.build());
persistResource(

View file

@ -113,7 +113,6 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setTransferRequestTime(requestTime)
.setLosingClientId("TheRegistrar")
.setPendingTransferExpirationTime(transferExpirationTime)
.setExtendedRegistrationYears(1)
.build())
.build();
}

View file

@ -102,7 +102,6 @@ public class ContactResourceTest extends EntityTestCase {
.build())
.setStatusValues(ImmutableSet.of(StatusValue.OK))
.setTransferData(new TransferData.Builder()
.setExtendedRegistrationYears(0)
.setGainingClientId("gaining")
.setLosingClientId("losing")
.setPendingTransferExpirationTime(clock.nowUtc())

View file

@ -124,7 +124,6 @@ public class DomainResourceTest extends EntityTestCase {
LaunchNotice.create("tcnid", "validatorId", START_OF_TIME, START_OF_TIME))
.setTransferData(
new TransferData.Builder()
.setExtendedRegistrationYears(1)
.setGainingClientId("gaining")
.setLosingClientId("losing")
.setPendingTransferExpirationTime(clock.nowUtc())
@ -306,7 +305,6 @@ public class DomainResourceTest extends EntityTestCase {
.setServerApproveBillingEvent(Key.create(transferBillingEvent))
.setServerApproveEntities(ImmutableSet.<Key<? extends TransferServerApproveEntity>>of(
Key.create(transferBillingEvent)))
.setExtendedRegistrationYears(1)
.build())
.addGracePeriod(
// Okay for billing event to be null since the point of this grace period is just

View file

@ -61,7 +61,6 @@ public class HostResourceTest extends EntityTestCase {
newDomainResource("example.com").asBuilder()
.setRepoId("1-COM")
.setTransferData(new TransferData.Builder()
.setExtendedRegistrationYears(0)
.setGainingClientId("gaining")
.setLosingClientId("losing")
.setPendingTransferExpirationTime(clock.nowUtc())

View file

@ -876,7 +876,6 @@ class google.registry.model.transfer.TransferData {
com.googlecode.objectify.Key<google.registry.model.poll.PollMessage$Autorenew> serverApproveAutorenewPollMessage;
google.registry.model.eppcommon.Trid transferRequestTrid;
google.registry.model.transfer.TransferStatus transferStatus;
java.lang.Integer extendedRegistrationYears;
java.lang.String gainingClientId;
java.lang.String losingClientId;
java.util.Set<com.googlecode.objectify.Key<? extends google.registry.model.transfer.TransferData$TransferServerApproveEntity>> serverApproveEntities;

View file

@ -160,7 +160,6 @@ public class RdapJsonFormatterTest {
.setTransferRequestTime(clock.nowUtc().minusDays(1))
.setLosingClientId("TheRegistrar")
.setPendingTransferExpirationTime(clock.nowUtc().plusYears(100))
.setExtendedRegistrationYears(1)
.build())
.build())))
.build());

View file

@ -332,7 +332,6 @@ public class ContactResourceToXjcConverterTest {
.setPhoneNumber("+1.2126660001")
.build())
.setTransferData(new TransferData.Builder()
.setExtendedRegistrationYears(1)
.setGainingClientId("TheRegistrar")
.setLosingClientId("NewRegistrar")
.setTransferRequestTime(DateTime.parse("1925-04-19TZ"))

View file

@ -324,7 +324,6 @@ public class DomainResourceToXjcConverterTest {
.setParent(historyEntry)
.build())))
.setTransferData(new TransferData.Builder()
.setExtendedRegistrationYears(1)
.setGainingClientId("gaining")
.setLosingClientId("losing")
.setPendingTransferExpirationTime(DateTime.parse("1925-04-20T00:00:00Z"))

View file

@ -149,7 +149,6 @@ final class RdeFixtures {
.setParent(historyEntry)
.build())))
.setTransferData(new TransferData.Builder()
.setExtendedRegistrationYears(1)
.setGainingClientId("gaining")
.setLosingClientId("losing")
.setPendingTransferExpirationTime(DateTime.parse("1925-04-20T00:00:00Z"))

View file

@ -388,36 +388,6 @@ public class XjcToDomainResourceConverterTest {
.isEqualTo(DateTime.parse("2015-01-08T22:00:00.0Z"));
}
@Test
public void testConvertDomainResourcePendingTransferDefaultExtendedYears() throws Exception {
persistActiveContact("jd1234");
persistActiveContact("sh8013");
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pending_transfer.xml");
DomainResource domain = persistResource(convertDomainInTransaction(xjcDomain));
assertThat(domain.getTransferData()).isNotNull();
assertThat(domain.getTransferData().getExtendedRegistrationYears()).isEqualTo(1);
}
@Test
public void testConvertDomainResourcePendingTransferExtendOneYear() throws Exception {
persistActiveContact("jd1234");
persistActiveContact("sh8013");
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pending_transfer_1yr.xml");
DomainResource domain = persistResource(convertDomainInTransaction(xjcDomain));
assertThat(domain.getTransferData()).isNotNull();
assertThat(domain.getTransferData().getExtendedRegistrationYears()).isEqualTo(1);
}
@Test
public void testConvertDomainResourcePendingTransferExtendTwoYears() throws Exception {
persistActiveContact("jd1234");
persistActiveContact("sh8013");
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pending_transfer_2yr.xml");
DomainResource domain = persistResource(convertDomainInTransaction(xjcDomain));
assertThat(domain.getTransferData()).isNotNull();
assertThat(domain.getTransferData().getExtendedRegistrationYears()).isEqualTo(2);
}
private static DomainResource convertDomainInTransaction(final XjcRdeDomain xjcDomain) {
final HistoryEntry historyEntry = createHistoryEntryForDomainImport(xjcDomain);
final BillingEvent.Recurring autorenewBillingEvent =

View file

@ -1,24 +0,0 @@
<rdeDom:domain
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
xmlns:rdeDom="urn:ietf:params:xml:ns:rdeDomain-1.0">
<rdeDom:name>example1.example</rdeDom:name>
<rdeDom:roid>Dexample1-TEST</rdeDom:roid>
<rdeDom:status s="pendingTransfer"/>
<rdeDom:registrant>jd1234</rdeDom:registrant>
<rdeDom:contact type="admin">sh8013</rdeDom:contact>
<rdeDom:contact type="tech">sh8013</rdeDom:contact>
<rdeDom:clID>RegistrarX</rdeDom:clID>
<rdeDom:crRr client="jdoe">RegistrarX</rdeDom:crRr>
<rdeDom:crDate>1999-04-03T22:00:00.0Z</rdeDom:crDate>
<rdeDom:exDate>2015-04-03T22:00:00.0Z</rdeDom:exDate>
<rdeDom:upRr>RegistrarY</rdeDom:upRr>
<rdeDom:upDate>2015-01-03T22:00:00.0Z</rdeDom:upDate>
<rdeDom:trnData>
<rdeDom:trStatus>pending</rdeDom:trStatus>
<rdeDom:reRr>RegistrarY</rdeDom:reRr>
<rdeDom:reDate>2015-01-03T22:00:00.0Z</rdeDom:reDate>
<rdeDom:acRr>RegistrarX</rdeDom:acRr>
<rdeDom:acDate>2015-01-08T22:00:00.0Z</rdeDom:acDate>
<rdeDom:exDate>2016-04-03T22:00:00.0Z</rdeDom:exDate>
</rdeDom:trnData>
</rdeDom:domain>

View file

@ -1,24 +0,0 @@
<rdeDom:domain
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
xmlns:rdeDom="urn:ietf:params:xml:ns:rdeDomain-1.0">
<rdeDom:name>example1.example</rdeDom:name>
<rdeDom:roid>Dexample1-TEST</rdeDom:roid>
<rdeDom:status s="pendingTransfer"/>
<rdeDom:registrant>jd1234</rdeDom:registrant>
<rdeDom:contact type="admin">sh8013</rdeDom:contact>
<rdeDom:contact type="tech">sh8013</rdeDom:contact>
<rdeDom:clID>RegistrarX</rdeDom:clID>
<rdeDom:crRr client="jdoe">RegistrarX</rdeDom:crRr>
<rdeDom:crDate>1999-04-03T22:00:00.0Z</rdeDom:crDate>
<rdeDom:exDate>2015-04-03T22:00:00.0Z</rdeDom:exDate>
<rdeDom:upRr>RegistrarY</rdeDom:upRr>
<rdeDom:upDate>2015-01-03T22:00:00.0Z</rdeDom:upDate>
<rdeDom:trnData>
<rdeDom:trStatus>pending</rdeDom:trStatus>
<rdeDom:reRr>RegistrarY</rdeDom:reRr>
<rdeDom:reDate>2015-01-03T22:00:00.0Z</rdeDom:reDate>
<rdeDom:acRr>RegistrarX</rdeDom:acRr>
<rdeDom:acDate>2015-01-08T22:00:00.0Z</rdeDom:acDate>
<rdeDom:exDate>2017-04-03T22:00:00.0Z</rdeDom:exDate>
</rdeDom:trnData>
</rdeDom:domain>

View file

@ -431,12 +431,6 @@ public class DatastoreHelper {
.setPendingTransferExpirationTime(expirationTime);
}
private static Builder createTransferDataBuilder(
DateTime requestTime, DateTime expirationTime, Integer extendedRegistrationYears) {
return createTransferDataBuilder(requestTime, expirationTime)
.setExtendedRegistrationYears(extendedRegistrationYears);
}
public static PollMessage.OneTime createPollMessageForImplicitTransfer(
EppResource contact,
HistoryEntry historyEntry,
@ -460,8 +454,7 @@ public class DatastoreHelper {
DomainResource domain,
HistoryEntry historyEntry,
DateTime costLookupTime,
DateTime eventTime,
Integer extendedRegistrationYears) {
DateTime eventTime) {
return new BillingEvent.OneTime.Builder()
.setReason(Reason.TRANSFER)
.setTargetId(domain.getFullyQualifiedDomainName())
@ -469,10 +462,8 @@ public class DatastoreHelper {
.setBillingTime(
eventTime.plus(Registry.get(domain.getTld()).getTransferGracePeriodLength()))
.setClientId("NewRegistrar")
.setPeriodYears(extendedRegistrationYears)
.setCost(
getDomainRenewCost(
domain.getFullyQualifiedDomainName(), costLookupTime, extendedRegistrationYears))
.setPeriodYears(1)
.setCost(getDomainRenewCost(domain.getFullyQualifiedDomainName(), costLookupTime, 1))
.setParent(historyEntry)
.build();
}
@ -522,7 +513,6 @@ public class DatastoreHelper {
DateTime requestTime,
DateTime expirationTime,
DateTime extendedRegistrationExpirationTime,
int extendedRegistrationYears,
DateTime now) {
HistoryEntry historyEntryDomainTransfer = persistResource(
new HistoryEntry.Builder()
@ -533,8 +523,7 @@ public class DatastoreHelper {
domain,
historyEntryDomainTransfer,
requestTime,
expirationTime,
extendedRegistrationYears));
expirationTime));
BillingEvent.Recurring gainingClientAutorenewEvent = persistResource(
new BillingEvent.Recurring.Builder()
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
@ -571,8 +560,7 @@ public class DatastoreHelper {
} else {
deleteResource(autorenewPollMessage);
}
Builder transferDataBuilder = createTransferDataBuilder(
requestTime, expirationTime, extendedRegistrationYears);
Builder transferDataBuilder = createTransferDataBuilder(requestTime, expirationTime);
return persistResource(domain.asBuilder()
.setPersistedCurrentSponsorClientId("TheRegistrar")
.addStatusValue(StatusValue.PENDING_TRANSFER)
@ -602,7 +590,6 @@ public class DatastoreHelper {
expirationTime,
now)))))
.setTransferRequestTrid(Trid.create("transferClient-trid", "transferServer-trid"))
.setExtendedRegistrationYears(extendedRegistrationYears)
.build())
.build());
}