mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Fix DomainTransferRequestFlow to correctly cancel autorenew graces
This fixes longstanding bug b/19430703 in which domain transfers that were server-approved would only handle the autorenew grace period correctly if the autorenew grace period was going to start within the transfer window. If the autorenew grace period was already active (e.g. the domain had recently autorenewed, before the transfer was requested), the logic would miss it, even if it was going to be active throughout the transfer window (i.e. it would still be active at the server-approval time). When the autorenew grace period is active at the time a transfer is approved (whether by the server or explicitly via DomainTransferApproveFlow), the correct behavior is to essentially "cancel" the autorenew - the losing registrar receives a refund for the autorenew charge, and the gaining registrar's transfer extended registration years are applied to the expiration time as it was prior to that autorenew. The way we implement this is that we just have the transfer essentially "subsume" the autorenew - we deduct 1 year from the transfer's extended registration years before extending the registration period from what the expiration time is post-autorenew at the moment of transfer approval. See b/19430703#comment17 for details on the policy justification; the only real ICANN document about this is https://www.icann.org/news/advisory-2002-06-06-en, but registrars informally document in many places that transfers will trigger autorenew grace, e.g. see https://support.google.com/domains/answer/3251236 There are still a few parts of this bug that remain unfixed: 1) RdeDomainImportAction repeats a lot of logic when handling imported domains that are in pending transfer, so it will also need to address this case in some way, but the policy choices there are unclear so I'm waiting until we know more about RDE import goals to figure out how to fix that. 2) Behavior at the millisecond edge cases is inconsistent - specifically, for the case where a transfer is requested such that the automatic transfer time is exactly the domain's expiration time (down to the millisecond), the correct behavior is a little unclear and this CL for now ignores this issue in favor of getting a fix for 99.999% of the issue into prod. See newly created b/35881941 for the gory details. Also, there are parts of this bug that will be fixed as parts of either b/25084229 (transfer exDate computations) or b/35110537 (disallowing transfers with extended registration years other than 1), both of which are less pressing. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=149024269
This commit is contained in:
parent
f663f00251
commit
3a7f67b7f3
7 changed files with 175 additions and 49 deletions
|
@ -50,6 +50,7 @@ import google.registry.model.domain.Period;
|
|||
import google.registry.model.domain.fee.FeeTransferCommandExtension;
|
||||
import google.registry.model.domain.fee.FeeTransformResponseExtension;
|
||||
import google.registry.model.domain.metadata.MetadataExtension;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.eppcommon.AuthInfo;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
|
@ -138,9 +139,27 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
|||
validateFeeChallenge(targetId, tld, now, feeTransfer, feesAndCredits);
|
||||
HistoryEntry historyEntry = buildHistory(period, existingDomain, now);
|
||||
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
|
||||
// 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;
|
||||
DomainResource domainAtTransferTime =
|
||||
existingDomain.cloneProjectedAtTime(automaticTransferTime);
|
||||
if (!domainAtTransferTime.getGracePeriodsOfType(GracePeriodStatus.AUTO_RENEW).isEmpty()) {
|
||||
registrationExtensionYears--;
|
||||
}
|
||||
// The new expiration time if there is a server approval.
|
||||
DateTime serverApproveNewExpirationTime = extendRegistrationWithCap(
|
||||
automaticTransferTime, existingDomain.getRegistrationExpirationTime(), years);
|
||||
DateTime serverApproveNewExpirationTime =
|
||||
extendRegistrationWithCap(
|
||||
automaticTransferTime,
|
||||
domainAtTransferTime.getRegistrationExpirationTime(),
|
||||
registrationExtensionYears);
|
||||
// Create speculative entities in anticipation of an automatic server approval.
|
||||
ImmutableSet<TransferServerApproveEntity> serverApproveEntities =
|
||||
createTransferServerApproveEntities(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue