From b3d27a62c4b7e0b13f4dcd22fec4fc80281c4643 Mon Sep 17 00:00:00 2001 From: Lai Jiang Date: Wed, 9 Sep 2020 19:37:41 -0400 Subject: [PATCH] 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 --- .../registry/beam/invoicing/sql/billing_events.sql | 4 +--- .../google/registry/model/registry/Registry.java | 12 ++++++------ .../registry/tools/CreateOrUpdateTldCommand.java | 8 ++++---- .../registry/beam/invoicing/billing_events_test.sql | 4 +--- .../test/resources/google/registry/model/schema.txt | 2 +- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/core/src/main/java/google/registry/beam/invoicing/sql/billing_events.sql b/core/src/main/java/google/registry/beam/invoicing/sql/billing_events.sql index c5bdb635d..b2123c367 100644 --- a/core/src/main/java/google/registry/beam/invoicing/sql/billing_events.sql +++ b/core/src/main/java/google/registry/beam/invoicing/sql/billing_events.sql @@ -55,9 +55,7 @@ FROM ( FROM `%PROJECT_ID%.%DATASTORE_EXPORT_DATA_SET%.%REGISTRY_TABLE%` WHERE - -- TODO(b/18092292): Add a filter for tldState (not PDT/PREDELEGATION) - tldType = 'REAL' - AND disableInvoicing is not TRUE) ) AS BillingEvent + enableInvoicing IS TRUE) ) AS BillingEvent -- Gather billing ID from registrar table -- This is a 'JOIN' as opposed to 'LEFT JOIN' to filter out -- non-billable registrars diff --git a/core/src/main/java/google/registry/model/registry/Registry.java b/core/src/main/java/google/registry/model/registry/Registry.java index 4592d034e..8db02d68b 100644 --- a/core/src/main/java/google/registry/model/registry/Registry.java +++ b/core/src/main/java/google/registry/model/registry/Registry.java @@ -340,12 +340,12 @@ public class Registry extends ImmutableObject implements Buildable { TldType tldType = TldType.REAL; /** - * Whether to disable invoicing for a {@link TldType#REAL} TLD. + * Whether to enable invoicing for this TLD. * - *

Note that invoicing is always disabled for {@link TldType#TEST} TLDs. Setting this field has - * no effect for {@link TldType#TEST} TLDs. + *

Note that this boolean is the sole determiner on whether invoices should be generated for a + * 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 @@ -646,8 +646,8 @@ public class Registry extends ImmutableObject implements Buildable { return this; } - public Builder setDisableInvoicing(boolean disableInvoicing) { - getInstance().disableInvoicing = disableInvoicing; + public Builder setInvoicingEnabled(boolean invoicingEnabled) { + getInstance().invoicingEnabled = invoicingEnabled; return this; } diff --git a/core/src/main/java/google/registry/tools/CreateOrUpdateTldCommand.java b/core/src/main/java/google/registry/tools/CreateOrUpdateTldCommand.java index ae408ce90..2f283cc77 100644 --- a/core/src/main/java/google/registry/tools/CreateOrUpdateTldCommand.java +++ b/core/src/main/java/google/registry/tools/CreateOrUpdateTldCommand.java @@ -118,10 +118,10 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand { @Nullable @Parameter( - names = "--disable_invoicing", - description = "Whether invoicing is disabled for a REAL tld.", + names = "--invoicing_enabled", + description = "Whether invoicing is enabled for this tld.", arity = 1) - private Boolean disableInvoicing; + private Boolean invoicingEnabled; @Nullable @Parameter( @@ -327,7 +327,7 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand { Optional.ofNullable(serverStatusChangeCost) .ifPresent(builder::setServerStatusChangeBillingCost); 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(claimsPeriodEnd).ifPresent(builder::setClaimsPeriodEnd); Optional.ofNullable(numDnsPublishShards).ifPresent(builder::setNumDnsPublishLocks); diff --git a/core/src/test/resources/google/registry/beam/invoicing/billing_events_test.sql b/core/src/test/resources/google/registry/beam/invoicing/billing_events_test.sql index e9b36e5b9..52edec0c2 100644 --- a/core/src/test/resources/google/registry/beam/invoicing/billing_events_test.sql +++ b/core/src/test/resources/google/registry/beam/invoicing/billing_events_test.sql @@ -55,9 +55,7 @@ FROM ( FROM `my-project-id.latest_datastore_export.Registry` WHERE - -- TODO(b/18092292): Add a filter for tldState (not PDT/PREDELEGATION) - tldType = 'REAL' - AND disableInvoicing is not TRUE) ) AS BillingEvent + enableInvoicing IS TRUE) ) AS BillingEvent -- Gather billing ID from registrar table -- This is a 'JOIN' as opposed to 'LEFT JOIN' to filter out -- non-billable registrars diff --git a/core/src/test/resources/google/registry/model/schema.txt b/core/src/test/resources/google/registry/model/schema.txt index dea026cec..fe487b033 100644 --- a/core/src/test/resources/google/registry/model/schema.txt +++ b/core/src/test/resources/google/registry/model/schema.txt @@ -618,9 +618,9 @@ enum google.registry.model.registrar.RegistrarContact$Type { class google.registry.model.registry.Registry { @Id java.lang.String tldStrId; @Parent com.googlecode.objectify.Key parent; - boolean disableInvoicing; boolean dnsPaused; boolean escrowEnabled; + boolean invoicingEnabled; com.googlecode.objectify.Key premiumList; google.registry.model.CreateAutoTimestamp creationTime; google.registry.model.common.TimedTransitionProperty tldStateTransitions;