Change disable invoicing flag to enable invoicing flag (#783)

* Change disable invoicing flag to enable invoicing flag

This flag will be the sole determinor on if invoicing is enabled,
regardless of TLD types.

Once this PR is deployed we will need to run the nomulus command to
update this flag on all launched open TLDs.

For context on why this change is made, see b/159626744.

* Rename enableInvoicing to InvoicingEnabled
This commit is contained in:
Lai Jiang 2020-09-09 19:37:41 -04:00 committed by GitHub
parent 4f750778de
commit b3d27a62c4
5 changed files with 13 additions and 17 deletions

View file

@ -55,9 +55,7 @@ FROM (
FROM FROM
`%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%REGISTRY_TABLE%` `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%REGISTRY_TABLE%`
WHERE WHERE
-- TODO(b/18092292): Add a filter for tldState (not PDT/PREDELEGATION) enableInvoicing IS TRUE) ) AS BillingEvent
tldType = 'REAL'
AND disableInvoicing is not TRUE) ) AS BillingEvent
-- Gather billing ID from registrar table -- Gather billing ID from registrar table
-- This is a 'JOIN' as opposed to 'LEFT JOIN' to filter out -- This is a 'JOIN' as opposed to 'LEFT JOIN' to filter out
-- non-billable registrars -- non-billable registrars

View file

@ -340,12 +340,12 @@ public class Registry extends ImmutableObject implements Buildable {
TldType tldType = TldType.REAL; TldType tldType = TldType.REAL;
/** /**
* Whether to disable invoicing for a {@link TldType#REAL} TLD. * Whether to enable invoicing for this TLD.
* *
* <p>Note that invoicing is always disabled for {@link TldType#TEST} TLDs. Setting this field has * <p>Note that this boolean is the sole determiner on whether invoices should be generated for a
* no effect for {@link TldType#TEST} TLDs. * TLD. This applies to {@link TldType#TEST} TLDs as well.
*/ */
boolean disableInvoicing = false; boolean invoicingEnabled = false;
/** /**
* A property that transitions to different TldStates at different times. Stored as a list of * A property that transitions to different TldStates at different times. Stored as a list of
@ -646,8 +646,8 @@ public class Registry extends ImmutableObject implements Buildable {
return this; return this;
} }
public Builder setDisableInvoicing(boolean disableInvoicing) { public Builder setInvoicingEnabled(boolean invoicingEnabled) {
getInstance().disableInvoicing = disableInvoicing; getInstance().invoicingEnabled = invoicingEnabled;
return this; return this;
} }

View file

@ -118,10 +118,10 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
@Nullable @Nullable
@Parameter( @Parameter(
names = "--disable_invoicing", names = "--invoicing_enabled",
description = "Whether invoicing is disabled for a REAL tld.", description = "Whether invoicing is enabled for this tld.",
arity = 1) arity = 1)
private Boolean disableInvoicing; private Boolean invoicingEnabled;
@Nullable @Nullable
@Parameter( @Parameter(
@ -327,7 +327,7 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
Optional.ofNullable(serverStatusChangeCost) Optional.ofNullable(serverStatusChangeCost)
.ifPresent(builder::setServerStatusChangeBillingCost); .ifPresent(builder::setServerStatusChangeBillingCost);
Optional.ofNullable(tldType).ifPresent(builder::setTldType); Optional.ofNullable(tldType).ifPresent(builder::setTldType);
Optional.ofNullable(disableInvoicing).ifPresent(builder::setDisableInvoicing); Optional.ofNullable(invoicingEnabled).ifPresent(builder::setInvoicingEnabled);
Optional.ofNullable(lordnUsername).ifPresent(u -> builder.setLordnUsername(u.orElse(null))); Optional.ofNullable(lordnUsername).ifPresent(u -> builder.setLordnUsername(u.orElse(null)));
Optional.ofNullable(claimsPeriodEnd).ifPresent(builder::setClaimsPeriodEnd); Optional.ofNullable(claimsPeriodEnd).ifPresent(builder::setClaimsPeriodEnd);
Optional.ofNullable(numDnsPublishShards).ifPresent(builder::setNumDnsPublishLocks); Optional.ofNullable(numDnsPublishShards).ifPresent(builder::setNumDnsPublishLocks);

View file

@ -55,9 +55,7 @@ FROM (
FROM FROM
`my-project-id.latest_datastore_export.Registry` `my-project-id.latest_datastore_export.Registry`
WHERE WHERE
-- TODO(b/18092292): Add a filter for tldState (not PDT/PREDELEGATION) enableInvoicing IS TRUE) ) AS BillingEvent
tldType = 'REAL'
AND disableInvoicing is not TRUE) ) AS BillingEvent
-- Gather billing ID from registrar table -- Gather billing ID from registrar table
-- This is a 'JOIN' as opposed to 'LEFT JOIN' to filter out -- This is a 'JOIN' as opposed to 'LEFT JOIN' to filter out
-- non-billable registrars -- non-billable registrars

View file

@ -618,9 +618,9 @@ enum google.registry.model.registrar.RegistrarContact$Type {
class google.registry.model.registry.Registry { class google.registry.model.registry.Registry {
@Id java.lang.String tldStrId; @Id java.lang.String tldStrId;
@Parent com.googlecode.objectify.Key<google.registry.model.common.EntityGroupRoot> parent; @Parent com.googlecode.objectify.Key<google.registry.model.common.EntityGroupRoot> parent;
boolean disableInvoicing;
boolean dnsPaused; boolean dnsPaused;
boolean escrowEnabled; boolean escrowEnabled;
boolean invoicingEnabled;
com.googlecode.objectify.Key<google.registry.model.registry.label.PremiumList> premiumList; com.googlecode.objectify.Key<google.registry.model.registry.label.PremiumList> premiumList;
google.registry.model.CreateAutoTimestamp creationTime; google.registry.model.CreateAutoTimestamp creationTime;
google.registry.model.common.TimedTransitionProperty<google.registry.model.registry.Registry$TldState, google.registry.model.registry.Registry$TldStateTransition> tldStateTransitions; google.registry.model.common.TimedTransitionProperty<google.registry.model.registry.Registry$TldState, google.registry.model.registry.Registry$TldStateTransition> tldStateTransitions;