diff --git a/core/src/main/java/google/registry/tools/RegistryTool.java b/core/src/main/java/google/registry/tools/RegistryTool.java index b3f1f5092..40b00ad53 100644 --- a/core/src/main/java/google/registry/tools/RegistryTool.java +++ b/core/src/main/java/google/registry/tools/RegistryTool.java @@ -15,7 +15,6 @@ package google.registry.tools; import com.google.common.collect.ImmutableMap; -import google.registry.tools.javascrap.BackfillRegistrarBillingAccountsCommand; import google.registry.tools.javascrap.CompareEscrowDepositsCommand; /** Container class to create and run remote commands against a Datastore instance. */ @@ -30,7 +29,6 @@ public final class RegistryTool { public static final ImmutableMap> COMMAND_MAP = new ImmutableMap.Builder>() .put("ack_poll_messages", AckPollMessagesCommand.class) - .put("backfill_registrar_billing_accounts", BackfillRegistrarBillingAccountsCommand.class) .put("canonicalize_labels", CanonicalizeLabelsCommand.class) .put("check_domain", CheckDomainCommand.class) .put("check_domain_claims", CheckDomainClaimsCommand.class) diff --git a/core/src/main/java/google/registry/tools/RegistryToolComponent.java b/core/src/main/java/google/registry/tools/RegistryToolComponent.java index c6b50b0a3..55f3b55b0 100644 --- a/core/src/main/java/google/registry/tools/RegistryToolComponent.java +++ b/core/src/main/java/google/registry/tools/RegistryToolComponent.java @@ -41,7 +41,6 @@ import google.registry.request.Modules.UrlConnectionServiceModule; import google.registry.request.Modules.UrlFetchServiceModule; import google.registry.request.Modules.UserServiceModule; import google.registry.tools.AuthModule.LocalCredentialModule; -import google.registry.tools.javascrap.BackfillRegistrarBillingAccountsCommand; import google.registry.tools.javascrap.CompareEscrowDepositsCommand; import google.registry.util.UtilsModule; import google.registry.whois.NonCachingWhoisModule; @@ -86,8 +85,6 @@ import javax.inject.Singleton; interface RegistryToolComponent { void inject(AckPollMessagesCommand command); - void inject(BackfillRegistrarBillingAccountsCommand command); - void inject(CheckDomainClaimsCommand command); void inject(CheckDomainCommand command); diff --git a/core/src/main/java/google/registry/tools/javascrap/BackfillRegistrarBillingAccountsCommand.java b/core/src/main/java/google/registry/tools/javascrap/BackfillRegistrarBillingAccountsCommand.java deleted file mode 100644 index 24afd47f1..000000000 --- a/core/src/main/java/google/registry/tools/javascrap/BackfillRegistrarBillingAccountsCommand.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 The Nomulus Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package google.registry.tools.javascrap; - -import static com.google.common.base.Preconditions.checkState; -import static google.registry.model.OteAccountBuilder.DEFAULT_BILLING_ACCOUNT_MAP; -import static google.registry.persistence.transaction.TransactionManagerFactory.tm; - -import com.beust.jcommander.Parameters; -import google.registry.config.RegistryEnvironment; -import google.registry.model.registrar.Registrar; -import google.registry.tools.CommandWithRemoteApi; - -/** - * Backfills the billing account maps on all Registrars that don't have any set. - * - *

This should not (and cannot) be used on production. Its purpose is to backfill these values on - * sandbox, where most registrars have an empty billing account map, including all that were created - * for OT&E. The same default billing account map is used for all registrars, and includes - * values for USD and JPY. The actual values here don't matter as we don't do invoicing on sandbox - * anyway. - */ -@Parameters(separators = " =", commandDescription = "Backfill registrar billing account maps.") -public class BackfillRegistrarBillingAccountsCommand implements CommandWithRemoteApi { - - @Override - public void run() throws Exception { - checkState( - RegistryEnvironment.get() != RegistryEnvironment.PRODUCTION, - "Do not run this on production"); - System.out.println("Populating billing account maps on all registrars missing them ..."); - tm().transact( - () -> - tm().loadAllOfStream(Registrar.class) - .filter(r -> r.getBillingAccountMap().isEmpty()) - .forEach( - r -> - tm().update( - r.asBuilder() - .setBillingAccountMap(DEFAULT_BILLING_ACCOUNT_MAP) - .build()))); - System.out.println("Done!"); - } -}