diff --git a/java/google/registry/flows/domain/DomainCreateFlow.java b/java/google/registry/flows/domain/DomainCreateFlow.java index 894d2421f..3feb56153 100644 --- a/java/google/registry/flows/domain/DomainCreateFlow.java +++ b/java/google/registry/flows/domain/DomainCreateFlow.java @@ -23,6 +23,7 @@ import static google.registry.flows.domain.DomainFlowUtils.cloneAndLinkReference import static google.registry.flows.domain.DomainFlowUtils.createFeeCreateResponse; import static google.registry.flows.domain.DomainFlowUtils.getReservationTypes; import static google.registry.flows.domain.DomainFlowUtils.isAnchorTenant; +import static google.registry.flows.domain.DomainFlowUtils.isReserved; import static google.registry.flows.domain.DomainFlowUtils.isValidReservedCreate; import static google.registry.flows.domain.DomainFlowUtils.validateCreateCommandContactsAndNameservers; import static google.registry.flows.domain.DomainFlowUtils.validateDomainAllowedOnCreateRestrictedTld; @@ -320,7 +321,14 @@ public class DomainCreateFlow implements TransactionalFlow { // Bill for the create. BillingEvent.OneTime createBillingEvent = createOneTimeBillingEvent( - registry, isAnchorTenant, isSunriseCreate, years, feesAndCredits, historyEntry, now); + registry, + isAnchorTenant, + isSunriseCreate, + isReserved(domainName, isSunriseCreate), + years, + feesAndCredits, + historyEntry, + now); // Create a new autorenew billing event and poll message starting at the expiration time. BillingEvent.Recurring autorenewBillingEvent = createAutorenewBillingEvent(historyEntry, registrationExpirationTime); @@ -507,6 +515,7 @@ public class DomainCreateFlow implements TransactionalFlow { Registry registry, boolean isAnchorTenant, boolean isSunriseCreate, + boolean isReserved, int years, FeesAndCredits feesAndCredits, HistoryEntry historyEntry, @@ -518,6 +527,10 @@ public class DomainCreateFlow implements TransactionalFlow { } if (isAnchorTenant) { flagsBuilder.add(Flag.ANCHOR_TENANT); + } else if (isReserved) { + // Don't add this flag if the domain is an anchor tenant (which are also reserved); only add + // it if it's reserved for other reasons. + flagsBuilder.add(Flag.RESERVED); } return new BillingEvent.OneTime.Builder() .setReason(Reason.CREATE) diff --git a/java/google/registry/flows/domain/DomainFlowUtils.java b/java/google/registry/flows/domain/DomainFlowUtils.java index 85843db84..8830a032a 100644 --- a/java/google/registry/flows/domain/DomainFlowUtils.java +++ b/java/google/registry/flows/domain/DomainFlowUtils.java @@ -453,7 +453,7 @@ public class DomainFlowUtils { private static final ImmutableSet RESERVED_TYPES = ImmutableSet.of(RESERVED_FOR_SPECIFIC_USE, RESERVED_FOR_ANCHOR_TENANT, FULLY_BLOCKED); - private static boolean isReserved(InternetDomainName domainName, boolean isSunrise) { + static boolean isReserved(InternetDomainName domainName, boolean isSunrise) { ImmutableSet types = getReservationTypes(domainName); return !Sets.intersection(types, RESERVED_TYPES).isEmpty() || !(isSunrise || intersection(TYPES_ALLOWED_FOR_CREATE_ONLY_IN_SUNRISE, types).isEmpty()); diff --git a/java/google/registry/model/billing/BillingEvent.java b/java/google/registry/model/billing/BillingEvent.java index 4d3c364dc..934eefd95 100644 --- a/java/google/registry/model/billing/BillingEvent.java +++ b/java/google/registry/model/billing/BillingEvent.java @@ -71,6 +71,14 @@ public abstract class BillingEvent extends ImmutableObject ANCHOR_TENANT, AUTO_RENEW, LANDRUSH, + /** + * This flag is used on create {@link OneTime} billing events for domains that were reserved. + * + *

This can happen when allocation tokens are used or superusers override a domain + * reservation. These cases can need special handling in billing/invoicing. Anchor tenants will + * never have this flag applied; they will have ANCHOR_TENANT instead. + */ + RESERVED, SUNRISE, /** * This flag will be added to any {@link OneTime} events that are created via, e.g., an diff --git a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java index da4f3a562..e7fff05bd 100644 --- a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java @@ -1060,7 +1060,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase