Add a RESERVED billing event flag for creates of reserved domains

This is an additional signal we can use for the billing/invoicing pipeline that
will be helfpul in targeting invoice rows that may need adjustment.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=217524250
This commit is contained in:
mcilwain 2018-10-17 08:42:24 -07:00 committed by jianglai
parent 3cfde5d4a1
commit f43125bb04
5 changed files with 26 additions and 4 deletions

View file

@ -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)