diff --git a/java/google/registry/flows/domain/DomainCreateFlow.java b/java/google/registry/flows/domain/DomainCreateFlow.java index be58a8007..528fdf1d8 100644 --- a/java/google/registry/flows/domain/DomainCreateFlow.java +++ b/java/google/registry/flows/domain/DomainCreateFlow.java @@ -310,7 +310,7 @@ public class DomainCreateFlow implements TransactionalFlow { // Bill for the create. BillingEvent.OneTime createBillingEvent = createOneTimeBillingEvent( - registry, isAnchorTenant, years, feesAndCredits, historyEntry, now); + registry, isAnchorTenant, 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); @@ -502,10 +502,19 @@ public class DomainCreateFlow implements TransactionalFlow { private OneTime createOneTimeBillingEvent( Registry registry, boolean isAnchorTenant, + boolean isSunriseCreate, int years, FeesAndCredits feesAndCredits, HistoryEntry historyEntry, DateTime now) { + ImmutableSet.Builder flagsBuilder = new ImmutableSet.Builder<>(); + // Sunrise and anchor tenancy are orthogonal tags and thus both can be present together. + if (isSunriseCreate) { + flagsBuilder.add(Flag.SUNRISE); + } + if (isAnchorTenant) { + flagsBuilder.add(Flag.ANCHOR_TENANT); + } return new BillingEvent.OneTime.Builder() .setReason(Reason.CREATE) .setTargetId(targetId) @@ -518,10 +527,7 @@ public class DomainCreateFlow implements TransactionalFlow { isAnchorTenant ? registry.getAnchorTenantAddGracePeriodLength() : registry.getAddGracePeriodLength())) - .setFlags( - isAnchorTenant - ? ImmutableSet.of(BillingEvent.Flag.ANCHOR_TENANT) - : ImmutableSet.of()) + .setFlags(flagsBuilder.build()) .setParent(historyEntry) .build(); } diff --git a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java index 07847337c..a0ce16274 100644 --- a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java @@ -203,7 +203,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase expectedBillingFlags) throws Exception { DomainResource domain = reloadResourceByForeignKey(); // Calculate the total cost. @@ -215,13 +216,11 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase billingFlags = - isAnchorTenant ? ImmutableSet.of(BillingEvent.Flag.ANCHOR_TENANT) : ImmutableSet.of(); HistoryEntry historyEntry = getHistoryEntries(domain).get(0); assertAboutDomains() .that(domain) @@ -242,7 +241,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase