mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Add period restriction to domain flows
Specifically, Domain[Create,Allocate,ApplicationCreate]Flow ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=147458283
This commit is contained in:
parent
335b3f0cf8
commit
53262d82bb
14 changed files with 171 additions and 21 deletions
|
@ -44,6 +44,7 @@ import google.registry.model.transfer.TransferData;
|
|||
import google.registry.model.transfer.TransferStatus;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Interval;
|
||||
|
||||
|
@ -334,11 +335,14 @@ public class DomainResource extends DomainBase
|
|||
|
||||
/** Return what the expiration time would be if the given number of years were added to it. */
|
||||
public static DateTime extendRegistrationWithCap(
|
||||
DateTime now, DateTime currentExpirationTime, Integer extendedRegistrationYears) {
|
||||
DateTime now,
|
||||
DateTime currentExpirationTime,
|
||||
@Nullable Integer extendedRegistrationYears) {
|
||||
// We must cap registration at the max years (aka 10), even if that truncates the last year.
|
||||
return earliestOf(
|
||||
leapSafeAddYears(
|
||||
currentExpirationTime, Optional.fromNullable(extendedRegistrationYears).or(0)),
|
||||
currentExpirationTime,
|
||||
Optional.fromNullable(extendedRegistrationYears).or(0)),
|
||||
leapSafeAddYears(now, MAX_REGISTRATION_YEARS));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue