mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Update lastEppUpdateTime after certain grace period is passed
The lastEppUpdateTime should be updated asynchronously in the situations below: - Implicit transfer success after 5 day pending transfer period - Implicit end of any grace period ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=224831791
This commit is contained in:
parent
c7fc964d9c
commit
5bc70cbc99
14 changed files with 347 additions and 84 deletions
|
@ -281,10 +281,15 @@ public class DomainResource extends DomainBase
|
|||
}
|
||||
// Set all remaining transfer properties.
|
||||
setAutomaticTransferSuccessProperties(builder, transferData);
|
||||
builder
|
||||
.setLastEppUpdateTime(transferExpirationTime)
|
||||
.setLastEppUpdateClientId(transferData.getGainingClientId());
|
||||
// Finish projecting to now.
|
||||
return builder.build().cloneProjectedAtTime(now);
|
||||
}
|
||||
|
||||
Optional<DateTime> newLastEppUpdateTime = Optional.empty();
|
||||
|
||||
// There is no transfer. Do any necessary autorenews.
|
||||
|
||||
Builder builder = asBuilder();
|
||||
|
@ -296,11 +301,13 @@ public class DomainResource extends DomainBase
|
|||
DateTime newExpirationTime = lastAutorenewTime.plusYears(1);
|
||||
builder
|
||||
.setRegistrationExpirationTime(newExpirationTime)
|
||||
.addGracePeriod(GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.AUTO_RENEW,
|
||||
lastAutorenewTime.plus(Registry.get(getTld()).getAutoRenewGracePeriodLength()),
|
||||
getCurrentSponsorClientId(),
|
||||
autorenewBillingEvent));
|
||||
.addGracePeriod(
|
||||
GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.AUTO_RENEW,
|
||||
lastAutorenewTime.plus(Registry.get(getTld()).getAutoRenewGracePeriodLength()),
|
||||
getCurrentSponsorClientId(),
|
||||
autorenewBillingEvent));
|
||||
newLastEppUpdateTime = Optional.of(lastAutorenewTime);
|
||||
}
|
||||
|
||||
// Remove any grace periods that have expired.
|
||||
|
@ -309,6 +316,22 @@ public class DomainResource extends DomainBase
|
|||
for (GracePeriod gracePeriod : almostBuilt.getGracePeriods()) {
|
||||
if (isBeforeOrAt(gracePeriod.getExpirationTime(), now)) {
|
||||
builder.removeGracePeriod(gracePeriod);
|
||||
if (!newLastEppUpdateTime.isPresent()
|
||||
|| isBeforeOrAt(newLastEppUpdateTime.get(), gracePeriod.getExpirationTime())) {
|
||||
newLastEppUpdateTime = Optional.of(gracePeriod.getExpirationTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// It is possible that the lastEppUpdateClientId is different from current sponsor client
|
||||
// id, so we have to do the comparison instead of having one variable just storing the most
|
||||
// recent time.
|
||||
if (newLastEppUpdateTime.isPresent()) {
|
||||
if (getLastEppUpdateTime() == null
|
||||
|| newLastEppUpdateTime.get().isAfter(getLastEppUpdateTime())) {
|
||||
builder
|
||||
.setLastEppUpdateTime(newLastEppUpdateTime.get())
|
||||
.setLastEppUpdateClientId(getCurrentSponsorClientId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue