Always require acknowledgment of premium fees

This removes the configuration ability on both Registry and Registrar entities
to allow operations on premium domains to succeed without acking the fees using
the fee extension. We only ever used this ability during the minna launch, and
it was a fiasco. We have no intention of ever allowing creation, renewal,
transfer, restoring, etc. of premium domains without acking the fees ever again,
and haven't done so since 2013, so removing this ability allows us to simplify
our code, data model, and tests.

Note that all TLDs in our production system currently require price ACKing
anyway, so from an external partner perspective this commit is a noop.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=229423650
This commit is contained in:
mcilwain 2019-01-15 12:56:32 -08:00 committed by jianglai
parent 3e0eaecc9b
commit 37aa1d1815
33 changed files with 81 additions and 257 deletions

View file

@ -290,7 +290,7 @@ public class DomainCreateFlow implements TransactionalFlow {
eppInput.getSingleExtension(FeeCreateCommandExtension.class); eppInput.getSingleExtension(FeeCreateCommandExtension.class);
FeesAndCredits feesAndCredits = FeesAndCredits feesAndCredits =
pricingLogic.getCreatePrice(registry, targetId, now, years, isAnchorTenant); pricingLogic.getCreatePrice(registry, targetId, now, years, isAnchorTenant);
validateFeeChallenge(targetId, registry.getTldStr(), clientId, now, feeCreate, feesAndCredits); validateFeeChallenge(targetId, now, feeCreate, feesAndCredits);
Optional<SecDnsCreateExtension> secDnsCreate = Optional<SecDnsCreateExtension> secDnsCreate =
validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class)); validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class));
String repoId = createDomainRepoId(ObjectifyService.allocateId(), registry.getTldStr()); String repoId = createDomainRepoId(ObjectifyService.allocateId(), registry.getTldStr());

View file

@ -672,18 +672,11 @@ public class DomainFlowUtils {
*/ */
public static void validateFeeChallenge( public static void validateFeeChallenge(
String domainName, String domainName,
String tld,
String clientId,
DateTime priceTime, DateTime priceTime,
final Optional<? extends FeeTransformCommandExtension> feeCommand, final Optional<? extends FeeTransformCommandExtension> feeCommand,
FeesAndCredits feesAndCredits) FeesAndCredits feesAndCredits)
throws EppException { throws EppException {
if (isDomainPremium(domainName, priceTime) && !feeCommand.isPresent()) {
Registry registry = Registry.get(tld);
Registrar registrar = Registrar.loadByClientIdCached(clientId).get();
boolean premiumAckRequired =
registry.getPremiumPriceAckRequired() || registrar.getPremiumPriceAckRequired();
if (premiumAckRequired && isDomainPremium(domainName, priceTime) && !feeCommand.isPresent()) {
throw new FeesRequiredForPremiumNameException(); throw new FeesRequiredForPremiumNameException();
} }
validateFeesAckedIfPresent(feeCommand, feesAndCredits); validateFeesAckedIfPresent(feeCommand, feesAndCredits);

View file

@ -149,8 +149,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
eppInput.getSingleExtension(FeeRenewCommandExtension.class); eppInput.getSingleExtension(FeeRenewCommandExtension.class);
FeesAndCredits feesAndCredits = FeesAndCredits feesAndCredits =
pricingLogic.getRenewPrice(Registry.get(existingDomain.getTld()), targetId, now, years); pricingLogic.getRenewPrice(Registry.get(existingDomain.getTld()), targetId, now, years);
validateFeeChallenge( validateFeeChallenge(targetId, now, feeRenew, feesAndCredits);
targetId, existingDomain.getTld(), clientId, now, feeRenew, feesAndCredits);
flowCustomLogic.afterValidation( flowCustomLogic.afterValidation(
AfterValidationParameters.newBuilder() AfterValidationParameters.newBuilder()
.setExistingDomain(existingDomain) .setExistingDomain(existingDomain)

View file

@ -208,8 +208,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
if (!existingDomain.getGracePeriodStatuses().contains(GracePeriodStatus.REDEMPTION)) { if (!existingDomain.getGracePeriodStatuses().contains(GracePeriodStatus.REDEMPTION)) {
throw new DomainNotEligibleForRestoreException(); throw new DomainNotEligibleForRestoreException();
} }
validateFeeChallenge( validateFeeChallenge(targetId, now, feeUpdate, feesAndCredits);
targetId, existingDomain.getTld(), clientId, now, feeUpdate, feesAndCredits);
} }
private ImmutableSet<BillingEvent.OneTime> createRestoreAndRenewBillingEvents( private ImmutableSet<BillingEvent.OneTime> createRestoreAndRenewBillingEvents(

View file

@ -167,7 +167,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
? Optional.empty() ? Optional.empty()
: Optional.of(pricingLogic.getTransferPrice(registry, targetId, now)); : Optional.of(pricingLogic.getTransferPrice(registry, targetId, now));
if (feesAndCredits.isPresent()) { if (feesAndCredits.isPresent()) {
validateFeeChallenge(targetId, tld, gainingClientId, now, feeTransfer, feesAndCredits.get()); validateFeeChallenge(targetId, now, feeTransfer, feesAndCredits.get());
} }
HistoryEntry historyEntry = buildHistoryEntry(existingDomain, registry, now, period); HistoryEntry historyEntry = buildHistoryEntry(existingDomain, registry, now, period);
DateTime automaticTransferTime = DateTime automaticTransferTime =

View file

@ -394,13 +394,6 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
*/ */
boolean contactsRequireSyncing = true; boolean contactsRequireSyncing = true;
/** Whether the registrar must acknowledge the price to register non-standard-priced domains. */
boolean premiumPriceAckRequired;
public boolean getPremiumPriceAckRequired() {
return premiumPriceAckRequired;
}
@NonFinalForTesting @NonFinalForTesting
private static Supplier<byte[]> saltSupplier = private static Supplier<byte[]> saltSupplier =
() -> { () -> {
@ -593,7 +586,6 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
.put("emailAddress", emailAddress) .put("emailAddress", emailAddress)
.put("whoisServer", getWhoisServer()) .put("whoisServer", getWhoisServer())
.put("blockPremiumNames", blockPremiumNames) .put("blockPremiumNames", blockPremiumNames)
.put("premiumPriceAckRequired", premiumPriceAckRequired)
.put("url", url) .put("url", url)
.put("icannReferralEmail", getIcannReferralEmail()) .put("icannReferralEmail", getIcannReferralEmail())
.put("driveFolderId", driveFolderId) .put("driveFolderId", driveFolderId)
@ -866,11 +858,6 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
return this; return this;
} }
public Builder setPremiumPriceAckRequired(boolean premiumPriceAckRequired) {
getInstance().premiumPriceAckRequired = premiumPriceAckRequired;
return this;
}
/** Build the registrar, nullifying empty fields. */ /** Build the registrar, nullifying empty fields. */
@Override @Override
public Registrar build() { public Registrar build() {

View file

@ -334,9 +334,6 @@ public class Registry extends ImmutableObject implements Buildable {
/** Whether the pull queue that writes to authoritative DNS is paused for this TLD. */ /** Whether the pull queue that writes to authoritative DNS is paused for this TLD. */
boolean dnsPaused = DEFAULT_DNS_PAUSED; boolean dnsPaused = DEFAULT_DNS_PAUSED;
/** Whether the price must be acknowledged to register premium names on this TLD. */
boolean premiumPriceAckRequired = true;
/** /**
* Whether only domains with {@link ReservationType#NAMESERVER_RESTRICTED} reservation type in a * Whether only domains with {@link ReservationType#NAMESERVER_RESTRICTED} reservation type in a
* reserved list can be registered on this TLD. * reserved list can be registered on this TLD.
@ -462,10 +459,6 @@ public class Registry extends ImmutableObject implements Buildable {
return driveFolderId; return driveFolderId;
} }
public boolean getPremiumPriceAckRequired() {
return premiumPriceAckRequired;
}
/** /**
* Returns true if only domains with nameserver restricted reservation on this TLD can be created. * Returns true if only domains with nameserver restricted reservation on this TLD can be created.
*/ */
@ -658,11 +651,6 @@ public class Registry extends ImmutableObject implements Buildable {
return this; return this;
} }
public Builder setPremiumPriceAckRequired(boolean premiumPriceAckRequired) {
getInstance().premiumPriceAckRequired = premiumPriceAckRequired;
return this;
}
public Builder setDomainCreateRestricted(boolean domainCreateRestricted) { public Builder setDomainCreateRestricted(boolean domainCreateRestricted) {
getInstance().domainCreateRestricted = domainCreateRestricted; getInstance().domainCreateRestricted = domainCreateRestricted;
return this; return this;

View file

@ -259,13 +259,6 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
description = "Hostname of registrar WHOIS server. (Default: whois.nic.google)") description = "Hostname of registrar WHOIS server. (Default: whois.nic.google)")
String whoisServer; String whoisServer;
@Nullable
@Parameter(
names = "--premium_price_ack_required",
description = "Whether operations on premium domains require explicit ack of prices",
arity = 1)
private Boolean premiumPriceAckRequired;
/** Returns the existing registrar (for update) or null (for creates). */ /** Returns the existing registrar (for update) or null (for creates). */
@Nullable @Nullable
abstract Registrar getOldRegistrar(String clientId); abstract Registrar getOldRegistrar(String clientId);
@ -392,7 +385,6 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
Optional.ofNullable(phonePasscode).ifPresent(builder::setPhonePasscode); Optional.ofNullable(phonePasscode).ifPresent(builder::setPhonePasscode);
Optional.ofNullable(icannReferralEmail).ifPresent(builder::setIcannReferralEmail); Optional.ofNullable(icannReferralEmail).ifPresent(builder::setIcannReferralEmail);
Optional.ofNullable(whoisServer).ifPresent(builder::setWhoisServer); Optional.ofNullable(whoisServer).ifPresent(builder::setWhoisServer);
Optional.ofNullable(premiumPriceAckRequired).ifPresent(builder::setPremiumPriceAckRequired);
// If the registrarName is being set, verify that it is either null or it normalizes uniquely. // If the registrarName is being set, verify that it is either null or it normalizes uniquely.
String oldRegistrarName = (oldRegistrar == null) ? null : oldRegistrar.getRegistrarName(); String oldRegistrarName = (oldRegistrar == null) ? null : oldRegistrar.getRegistrarName();

View file

@ -117,13 +117,6 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
description = "Tld type (REAL or TEST)") description = "Tld type (REAL or TEST)")
private TldType tldType; private TldType tldType;
@Nullable
@Parameter(
names = "--premium_price_ack_required",
description = "Whether operations on premium domains require explicit ack of prices",
arity = 1)
private Boolean premiumPriceAckRequired;
@Nullable @Nullable
@Parameter( @Parameter(
names = "--create_billing_cost", names = "--create_billing_cost",
@ -335,7 +328,6 @@ 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(premiumPriceAckRequired).ifPresent(builder::setPremiumPriceAckRequired);
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(domainCreateRestricted).ifPresent(builder::setDomainCreateRestricted); Optional.ofNullable(domainCreateRestricted).ifPresent(builder::setDomainCreateRestricted);

View file

@ -57,8 +57,7 @@ public final class ListTldsAction extends ListObjectsAction<Registry> {
return ImmutableBiMap.of( return ImmutableBiMap.of(
"TLD", "tldStr", "TLD", "tldStr",
"dns", "dnsPaused", "dns", "dnsPaused",
"escrow", "escrowEnabled", "escrow", "escrowEnabled");
"premiumPricing", "premiumPriceAckRequired");
} }
@Override @Override
@ -67,7 +66,6 @@ public final class ListTldsAction extends ListObjectsAction<Registry> {
return new ImmutableMap.Builder<String, String>() return new ImmutableMap.Builder<String, String>()
.put("dnsPaused", registry.getDnsPaused() ? "paused" : "-") .put("dnsPaused", registry.getDnsPaused() ? "paused" : "-")
.put("escrowEnabled", registry.getEscrowEnabled() ? "enabled" : "-") .put("escrowEnabled", registry.getEscrowEnabled() ? "enabled" : "-")
.put("premiumPriceAckRequired", registry.getPremiumPriceAckRequired() ? "ack req'd" : "-")
.put("tldState", registry.isPdt(now) ? "PDT" : registry.getTldState(now).toString()) .put("tldState", registry.isPdt(now) ? "PDT" : registry.getTldState(now).toString())
.put("tldStateTransitions", registry.getTldStateTransitions().toString()) .put("tldStateTransitions", registry.getTldStateTransitions().toString())
.put("renewBillingCost", registry.getStandardRenewCost(now).toString()) .put("renewBillingCost", registry.getStandardRenewCost(now).toString())

View file

@ -87,8 +87,7 @@ registry.json.Response.prototype.results;
* localizedAddress: registry.json.RegistrarAddress, * localizedAddress: registry.json.RegistrarAddress,
* whoisServer: (string?|undefined), * whoisServer: (string?|undefined),
* referralUrl: (string?|undefined), * referralUrl: (string?|undefined),
* contacts: !Array.<registry.json.RegistrarContact>, * contacts: !Array.<registry.json.RegistrarContact>
* premiumPriceAckRequired: boolean
* }} * }}
*/ */
registry.json.Registrar; registry.json.Registrar;

View file

@ -279,9 +279,6 @@ public final class RegistrarFormFields {
args, L10N_STREET_FIELD, L10N_CITY_FIELD, L10N_STATE_FIELD, L10N_ZIP_FIELD)) args, L10N_STREET_FIELD, L10N_CITY_FIELD, L10N_STATE_FIELD, L10N_ZIP_FIELD))
.build(); .build();
public static final FormField<Boolean, Boolean> PREMIUM_PRICE_ACK_REQUIRED =
FormField.named("premiumPriceAckRequired", Boolean.class).build();
private static @Nullable RegistrarAddress toNewAddress( private static @Nullable RegistrarAddress toNewAddress(
@Nullable Map<String, ?> args, @Nullable Map<String, ?> args,
final FormField<List<String>, List<String>> streetField, final FormField<List<String>, List<String>> streetField,

View file

@ -35,7 +35,6 @@ import com.google.template.soy.data.SoyMapData;
import com.google.template.soy.shared.SoyCssRenamingMap; import com.google.template.soy.shared.SoyCssRenamingMap;
import com.google.template.soy.tofu.SoyTofu; import com.google.template.soy.tofu.SoyTofu;
import google.registry.config.RegistryConfig.Config; import google.registry.config.RegistryConfig.Config;
import google.registry.model.registrar.Registrar;
import google.registry.request.Action; import google.registry.request.Action;
import google.registry.request.Parameter; import google.registry.request.Parameter;
import google.registry.request.Response; import google.registry.request.Response;
@ -149,8 +148,7 @@ public final class ConsoleUiAction implements Runnable {
// since we double check the access to the registrar on any read / update request. We have to // since we double check the access to the registrar on any read / update request. We have to
// - since the access might get revoked between the initial page load and the request! (also // - since the access might get revoked between the initial page load and the request! (also
// because the requests come from the browser, and can easily be faked) // because the requests come from the browser, and can easily be faked)
Registrar registrar = registrarAccessor.getRegistrar(clientId); registrarAccessor.getRegistrar(clientId);
data.put("requireFeeExtension", registrar.getPremiumPriceAckRequired());
} catch (RegistrarAccessDeniedException e) { } catch (RegistrarAccessDeniedException e) {
logger.atWarning().withCause(e).log( logger.atWarning().withCause(e).log(
"User %s doesn't have access to registrar console.", authResult.userIdForLogging()); "User %s doesn't have access to registrar console.", authResult.userIdForLogging());

View file

@ -260,11 +260,6 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
Registrar.Builder builder = initialRegistrar.asBuilder(); Registrar.Builder builder = initialRegistrar.asBuilder();
// BILLING
RegistrarFormFields.PREMIUM_PRICE_ACK_REQUIRED
.extractUntyped(args)
.ifPresent(builder::setPremiumPriceAckRequired);
// WHOIS // WHOIS
// //
// Because of how whoisServer handles "default value", it's possible that setting the existing // Because of how whoisServer handles "default value", it's possible that setting the existing

View file

@ -315,8 +315,6 @@
{template .resources} {template .resources}
{@param? driveFolderId: string} {@param? driveFolderId: string}
{@param technicalDocsUrl: string} {@param technicalDocsUrl: string}
{@param premiumPriceAckRequired: bool}
{@param readonly: bool}
<div id="domain-registrar-resources"> <div id="domain-registrar-resources">
<h1>Resources &amp; billing</h1> <h1>Resources &amp; billing</h1>
<p> <p>
@ -341,15 +339,6 @@
{else} {else}
<em>Your billing folder is pending allocation.</em> <em>Your billing folder is pending allocation.</em>
{/if} {/if}
<h2><img src="/assets/images/folder.png">EPP Settings</h2>
<p>Use the 'Edit' button above to switch to enable editing the information
below. <i>Updates may require up to 10 minutes to take effect.</i>
<form name="item" class="{css('item')} {css('registrar')}">
<input type="checkbox" id="premiumPriceAckRequired" name="premiumPriceAckRequired"
{if $premiumPriceAckRequired} checked{/if}
{if $readonly} disabled{/if}>
Require use of fee extension to acknowledge all premium domain prices.
</form>
</div> </div>
{/template} {/template}

View file

@ -656,20 +656,9 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@Test
public void testSuccess_premium() throws Exception {
createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net");
doSuccessfulTest(
"example", "domain_create_response_premium.xml", ImmutableMap.of("DOMAIN", "rich.example"));
}
@Test @Test
public void testSuccess_premiumAndEap() throws Exception { public void testSuccess_premiumAndEap() throws Exception {
createTld("example"); createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_create_premium_eap.xml"); setEppInput("domain_create_premium_eap.xml");
persistContactsAndHosts("net"); persistContactsAndHosts("net");
persistResource( persistResource(
@ -1258,7 +1247,6 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testSuccess_superuserOverridesPremiumNameBlock() throws Exception { public void testSuccess_superuserOverridesPremiumNameBlock() throws Exception {
createTld("example"); createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
setEppInput("domain_create_premium.xml"); setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net"); persistContactsAndHosts("net");
// Modify the Registrar to block premium names. // Modify the Registrar to block premium names.
@ -1421,7 +1409,6 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
@Test @Test
public void testFailure_premiumBlocked() { public void testFailure_premiumBlocked() {
createTld("example"); createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
setEppInput("domain_create_premium.xml"); setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net"); persistContactsAndHosts("net");
// Modify the Registrar to block premium names. // Modify the Registrar to block premium names.
@ -1431,34 +1418,9 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
} }
@Test @Test
public void testFailure_premiumNotAcked_byRegistryRequiringAcking() { public void testFailure_premiumNotAcked() {
createTld("example"); createTld("example");
assertThat(Registry.get("example").getPremiumPriceAckRequired()).isTrue(); setEppInput("domain_create.xml", ImmutableMap.of("DOMAIN", "rich.example"));
setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net");
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_premiumNotAcked_byRegistrarRequiringAcking() {
createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net");
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_premiumNotAcked_whenRegistrarAndRegistryRequireAcking() {
createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(true).build());
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net"); persistContactsAndHosts("net");
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow); EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();

View file

@ -715,21 +715,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
} }
@Test @Test
public void testFailure_registryRequiresAcking_feeNotProvidedOnPremiumName() throws Exception { public void testFailure_feeNotProvidedOnPremiumName() throws Exception {
createTld("example"); createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_renew_premium.xml");
persistDomain();
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_registrarRequiresAcking_feeNotProvidedOnPremiumName() throws Exception {
createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_renew_premium.xml"); setEppInput("domain_renew_premium.xml");
persistDomain(); persistDomain();
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow); EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);

View file

@ -88,7 +88,7 @@ public class DomainRestoreRequestFlowTest
@Before @Before
public void initDomainTest() { public void initDomainTest() {
createTld("tld"); createTld("tld");
setEppInput("domain_update_restore_request.xml"); setEppInput("domain_update_restore_request.xml", ImmutableMap.of("DOMAIN", "example.tld"));
} }
void persistPendingDeleteDomain() throws Exception { void persistPendingDeleteDomain() throws Exception {
@ -123,14 +123,14 @@ public class DomainRestoreRequestFlowTest
@Test @Test
public void testDryRun() throws Exception { public void testDryRun() throws Exception {
setEppInput("domain_update_restore_request.xml"); setEppInput("domain_update_restore_request.xml", ImmutableMap.of("DOMAIN", "example.tld"));
persistPendingDeleteDomain(); persistPendingDeleteDomain();
dryRunFlowAssertResponse(loadFile("generic_success_response.xml")); dryRunFlowAssertResponse(loadFile("generic_success_response.xml"));
} }
@Test @Test
public void testSuccess() throws Exception { public void testSuccess() throws Exception {
setEppInput("domain_update_restore_request.xml"); setEppInput("domain_update_restore_request.xml", ImmutableMap.of("DOMAIN", "example.tld"));
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertTransactionalFlow(true); assertTransactionalFlow(true);
// Double check that we see a poll message in the future for when the delete happens. // Double check that we see a poll message in the future for when the delete happens.
@ -321,10 +321,9 @@ public class DomainRestoreRequestFlowTest
@Test @Test
public void testSuccess_premiumNotBlocked() throws Exception { public void testSuccess_premiumNotBlocked() throws Exception {
createTld("example"); createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
setEppInput("domain_update_restore_request_premium.xml"); setEppInput("domain_update_restore_request_premium.xml");
persistPendingDeleteDomain(); persistPendingDeleteDomain();
runFlow(); runFlowAssertResponse(loadFile("domain_update_restore_request_response_premium.xml"));
} }
@Test @Test
@ -342,13 +341,14 @@ public class DomainRestoreRequestFlowTest
@Test @Test
public void testSuccess_superuserOverridesPremiumNameBlock() throws Exception { public void testSuccess_superuserOverridesPremiumNameBlock() throws Exception {
createTld("example"); createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
setEppInput("domain_update_restore_request_premium.xml"); setEppInput("domain_update_restore_request_premium.xml");
persistPendingDeleteDomain(); persistPendingDeleteDomain();
// Modify the Registrar to block premium names. // Modify the Registrar to block premium names.
persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build()); persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build());
runFlowAssertResponse( runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("generic_success_response.xml")); CommitMode.LIVE,
UserPrivileges.SUPERUSER,
loadFile("domain_update_restore_request_response_premium.xml"));
} }
@Test @Test
@ -591,21 +591,9 @@ public class DomainRestoreRequestFlowTest
} }
@Test @Test
public void testFailure_premiumNotAcked_whenRegistryRequiresFeeAcking() throws Exception { public void testFailure_premiumNotAcked() throws Exception {
createTld("example"); createTld("example");
setEppInput("domain_update_restore_request_premium.xml"); setEppInput("domain_update_restore_request.xml", ImmutableMap.of("DOMAIN", "rich.example"));
persistPendingDeleteDomain();
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_premiumNotAcked_whenRegistrarRequiresFeeAcking() throws Exception {
createTld("example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_update_restore_request_premium.xml");
persistPendingDeleteDomain(); persistPendingDeleteDomain();
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow); EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();

View file

@ -1150,21 +1150,35 @@ public class DomainTransferRequestFlowTest
@Test @Test
public void testSuccess_premiumNotBlocked() throws Exception { public void testSuccess_premiumNotBlocked() throws Exception {
setupDomain("rich", "example"); setupDomain("rich", "example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
clock.advanceOneMilli(); clock.advanceOneMilli();
// We don't verify the results; just check that the flow doesn't fail. // We don't verify the results; just check that the flow doesn't fail.
runTest("domain_transfer_request_premium.xml", UserPrivileges.NORMAL); runTest(
"domain_transfer_request_fee.xml",
UserPrivileges.NORMAL,
ImmutableMap.of(
"DOMAIN", "rich.example",
"YEARS", "1",
"AMOUNT", "100.00",
"FEE_VERSION", "0.12",
"FEE_NS", "fee12"));
} }
@Test @Test
public void testSuccess_premiumNotBlockedInSuperuserMode() throws Exception { public void testSuccess_premiumNotBlockedInSuperuserMode() throws Exception {
setupDomain("rich", "example"); setupDomain("rich", "example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
clock.advanceOneMilli(); clock.advanceOneMilli();
// Modify the Registrar to block premium names. // Modify the Registrar to block premium names.
persistResource(loadRegistrar("NewRegistrar").asBuilder().setBlockPremiumNames(true).build()); persistResource(loadRegistrar("NewRegistrar").asBuilder().setBlockPremiumNames(true).build());
// We don't verify the results; just check that the flow doesn't fail. // We don't verify the results; just check that the flow doesn't fail.
runTest("domain_transfer_request_premium.xml", UserPrivileges.SUPERUSER); runTest(
"domain_transfer_request_fee.xml",
UserPrivileges.SUPERUSER,
ImmutableMap.of(
"DOMAIN", "rich.example",
"YEARS", "1",
"AMOUNT", "100.00",
"FEE_VERSION", "0.12",
"FEE_NS", "fee12"));
} }
private void runWrongCurrencyTest(Map<String, String> substitutions) { private void runWrongCurrencyTest(Map<String, String> substitutions) {
@ -1275,7 +1289,7 @@ public class DomainTransferRequestFlowTest
} }
@Test @Test
public void testFailure_registryRequiresAcking_feeNotProvidedOnPremiumName() { public void testFailure_feeNotProvidedOnPremiumName() {
setupDomain("rich", "example"); setupDomain("rich", "example");
EppException thrown = EppException thrown =
assertThrows( assertThrows(
@ -1284,20 +1298,6 @@ public class DomainTransferRequestFlowTest
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@Test
public void testFailure_registrarRequiresAcking_feeNotProvidedOnPremiumName() {
setupDomain("rich", "example");
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build());
persistResource(
loadRegistrar("NewRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
clock.advanceOneMilli();
EppException thrown =
assertThrows(
FeesRequiredForPremiumNameException.class,
() -> doFailingTest("domain_transfer_request_premium.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test @Test
public void testFailure_noAuthInfo() { public void testFailure_noAuthInfo() {
setupDomain("example", "tld"); setupDomain("example", "tld");

View file

@ -2,7 +2,7 @@
<command> <command>
<create> <create>
<domain:create <domain:create
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>rich.example</domain:name> <domain:name>rich.example</domain:name>
<domain:period unit="y">2</domain:period> <domain:period unit="y">2</domain:period>
<domain:ns> <domain:ns>
@ -17,6 +17,12 @@
</domain:authInfo> </domain:authInfo>
</domain:create> </domain:create>
</create> </create>
<extension>
<fee:create xmlns:fee="urn:ietf:params:xml:ns:fee-0.12">
<fee:currency>USD</fee:currency>
<fee:fee>200.00</fee:fee>
</fee:create>
</extension>
<clTRID>ABC-12345</clTRID> <clTRID>ABC-12345</clTRID>
</command> </command>
</epp> </epp>

View file

@ -11,6 +11,12 @@
<domain:exDate>2001-04-03T22:00:00.0Z</domain:exDate> <domain:exDate>2001-04-03T22:00:00.0Z</domain:exDate>
</domain:creData> </domain:creData>
</resData> </resData>
<extension>
<fee:creData xmlns:fee="urn:ietf:params:xml:ns:fee-0.12">
<fee:currency>USD</fee:currency>
<fee:fee description="create">200.00</fee:fee>
</fee:creData>
</extension>
<trID> <trID>
<clTRID>ABC-12345</clTRID> <clTRID>ABC-12345</clTRID>
<svTRID>server-trid</svTRID> <svTRID>server-trid</svTRID>

View file

@ -3,7 +3,7 @@
<update> <update>
<domain:update <domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>example.tld</domain:name> <domain:name>%DOMAIN%</domain:name>
<domain:chg/> <domain:chg/>
</domain:update> </domain:update>
</update> </update>

View file

@ -2,7 +2,7 @@
<command> <command>
<update> <update>
<domain:update <domain:update
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>rich.example</domain:name> <domain:name>rich.example</domain:name>
<domain:chg/> <domain:chg/>
</domain:update> </domain:update>
@ -11,6 +11,15 @@
<rgp:update xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0"> <rgp:update xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0">
<rgp:restore op="request"/> <rgp:restore op="request"/>
</rgp:update> </rgp:update>
<fee:update xmlns:fee="urn:ietf:params:xml:ns:fee-0.12">
<fee:currency>USD</fee:currency>
<fee:fee description="renew" refundable="true" grace-period="P0D" applied="immediate">
100.00
</fee:fee>
<fee:fee description="restore" refundable="true" grace-period="P0D" applied="immediate">
17.00
</fee:fee>
</fee:update>
</extension> </extension>
<clTRID>ABC-12345</clTRID> <clTRID>ABC-12345</clTRID>
</command> </command>

View file

@ -0,0 +1,18 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<response>
<result code="1000">
<msg>Command completed successfully</msg>
</result>
<extension>
<fee:updData xmlns:fee="urn:ietf:params:xml:ns:fee-0.12">
<fee:currency>USD</fee:currency>
<fee:fee description="restore">17.00</fee:fee>
<fee:fee description="renew">100.00</fee:fee>
</fee:updData>
</extension>
<trID>
<clTRID>ABC-12345</clTRID>
<svTRID>server-trid</svTRID>
</trID>
</response>
</epp>

View file

@ -98,7 +98,6 @@ public class RegistrarTest extends EntityTestCase {
.setBillingAccountMap( .setBillingAccountMap(
ImmutableMap.of(CurrencyUnit.USD, "abc123", CurrencyUnit.JPY, "789xyz")) ImmutableMap.of(CurrencyUnit.USD, "abc123", CurrencyUnit.JPY, "789xyz"))
.setPhonePasscode("01234") .setPhonePasscode("01234")
.setPremiumPriceAckRequired(true)
.build()); .build());
persistResource(registrar); persistResource(registrar);
abuseAdminContact = abuseAdminContact =

View file

@ -409,7 +409,6 @@ class google.registry.model.registrar.Registrar {
@Parent com.googlecode.objectify.Key<google.registry.model.common.EntityGroupRoot> parent; @Parent com.googlecode.objectify.Key<google.registry.model.common.EntityGroupRoot> parent;
boolean blockPremiumNames; boolean blockPremiumNames;
boolean contactsRequireSyncing; boolean contactsRequireSyncing;
boolean premiumPriceAckRequired;
google.registry.model.CreateAutoTimestamp creationTime; google.registry.model.CreateAutoTimestamp creationTime;
google.registry.model.UpdateAutoTimestamp lastUpdateTime; google.registry.model.UpdateAutoTimestamp lastUpdateTime;
google.registry.model.registrar.Registrar$State state; google.registry.model.registrar.Registrar$State state;
@ -491,7 +490,6 @@ class google.registry.model.registry.Registry {
boolean dnsPaused; boolean dnsPaused;
boolean domainCreateRestricted; boolean domainCreateRestricted;
boolean escrowEnabled; boolean escrowEnabled;
boolean premiumPriceAckRequired;
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;

View file

@ -88,7 +88,6 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
assertThat(registrar.getCreationTime()).isIn(Range.closed(before, after)); assertThat(registrar.getCreationTime()).isIn(Range.closed(before, after));
assertThat(registrar.getLastUpdateTime()).isEqualTo(registrar.getCreationTime()); assertThat(registrar.getLastUpdateTime()).isEqualTo(registrar.getCreationTime());
assertThat(registrar.getBlockPremiumNames()).isFalse(); assertThat(registrar.getBlockPremiumNames()).isFalse();
assertThat(registrar.getPremiumPriceAckRequired()).isFalse();
assertThat(registrar.getPoNumber()).isEmpty(); assertThat(registrar.getPoNumber()).isEmpty();
verify(connection) verify(connection)
@ -787,28 +786,6 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
assertThat(registrar.get().getFaxNumber()).isEqualTo("+1.2125556342"); assertThat(registrar.get().getFaxNumber()).isEqualTo("+1.2125556342");
} }
@Test
public void testSuccess_premiumPriceAckRequired() throws Exception {
runCommandForced(
"--name=blobio",
"--password=some_password",
"--registrar_type=REAL",
"--iana_id=8",
"--passcode=01234",
"--icann_referral_email=foo@bar.test",
"--street=\"123 Fake St\"",
"--city Fakington",
"--state MA",
"--zip 00351",
"--cc US",
"--premium_price_ack_required=true",
"clientz");
Optional<Registrar> registrar = Registrar.loadByClientId("clientz");
assertThat(registrar).isPresent();
assertThat(registrar.get().getPremiumPriceAckRequired()).isTrue();
}
@Test @Test
public void testFailure_missingRegistrarType() { public void testFailure_missingRegistrarType() {
IllegalArgumentException thrown = IllegalArgumentException thrown =

View file

@ -275,16 +275,6 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
.containsExactly("xn--q9jyb4c_abuse", "common_abuse"); .containsExactly("xn--q9jyb4c_abuse", "common_abuse");
} }
@Test
public void testSuccess_setPremiumPriceAckRequired() throws Exception {
runCommandForced(
"--premium_price_ack_required=true",
"--roid_suffix=Q9JYB4C",
"--dns_writers=VoidDnsWriter",
"xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getPremiumPriceAckRequired()).isTrue();
}
@Test @Test
public void testFailure_invalidAddGracePeriod() { public void testFailure_invalidAddGracePeriod() {
IllegalArgumentException thrown = IllegalArgumentException thrown =

View file

@ -312,28 +312,12 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
assertThat(loadRegistrar("NewRegistrar").getBlockPremiumNames()).isFalse(); assertThat(loadRegistrar("NewRegistrar").getBlockPremiumNames()).isFalse();
} }
@Test
public void testSuccess_premiumPriceAckRequired() throws Exception {
assertThat(loadRegistrar("NewRegistrar").getPremiumPriceAckRequired()).isFalse();
runCommandForced("--premium_price_ack_required=true", "NewRegistrar");
assertThat(loadRegistrar("NewRegistrar").getPremiumPriceAckRequired()).isTrue();
}
@Test
public void testSuccess_resetPremiumPriceAckRequired() throws Exception {
persistResource(
loadRegistrar("NewRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
runCommandForced("--premium_price_ack_required=false", "NewRegistrar");
assertThat(loadRegistrar("NewRegistrar").getPremiumPriceAckRequired()).isFalse();
}
@Test @Test
public void testSuccess_unspecifiedBooleansArentChanged() throws Exception { public void testSuccess_unspecifiedBooleansArentChanged() throws Exception {
persistResource( persistResource(
loadRegistrar("NewRegistrar") loadRegistrar("NewRegistrar")
.asBuilder() .asBuilder()
.setBlockPremiumNames(true) .setBlockPremiumNames(true)
.setPremiumPriceAckRequired(true)
.setContactsRequireSyncing(true) .setContactsRequireSyncing(true)
.build()); .build());
// Make some unrelated change where we don't specify the flags for the booleans. // Make some unrelated change where we don't specify the flags for the booleans.
@ -341,7 +325,6 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
// Make sure that the boolean fields didn't get reset back to false. // Make sure that the boolean fields didn't get reset back to false.
Registrar reloadedRegistrar = loadRegistrar("NewRegistrar"); Registrar reloadedRegistrar = loadRegistrar("NewRegistrar");
assertThat(reloadedRegistrar.getBlockPremiumNames()).isTrue(); assertThat(reloadedRegistrar.getBlockPremiumNames()).isTrue();
assertThat(reloadedRegistrar.getPremiumPriceAckRequired()).isTrue();
assertThat(reloadedRegistrar.getContactsRequireSyncing()).isTrue(); assertThat(reloadedRegistrar.getContactsRequireSyncing()).isTrue();
} }

View file

@ -229,19 +229,6 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
.isEqualTo(Money.ofMajor(JPY, 101112)); .isEqualTo(Money.ofMajor(JPY, 101112));
} }
@Test
public void testSuccess_setPremiumPriceAckRequired() throws Exception {
runCommandForced("--premium_price_ack_required=true", "xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getPremiumPriceAckRequired()).isTrue();
}
@Test
public void testSuccess_clearPremiumPriceAckRequired() throws Exception {
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setPremiumPriceAckRequired(true).build());
runCommandForced("--premium_price_ack_required=false", "xn--q9jyb4c");
assertThat(Registry.get("xn--q9jyb4c").getPremiumPriceAckRequired()).isFalse();
}
@Test @Test
public void testSuccess_setLordnUsername() throws Exception { public void testSuccess_setLordnUsername() throws Exception {
runCommandForced("--lordn_username=lordn000", "xn--q9jyb4c"); runCommandForced("--lordn_username=lordn000", "xn--q9jyb4c");

View file

@ -115,7 +115,6 @@ function testNavToResources() {
path: 'resources', path: 'resources',
xsrfToken: test.testXsrfToken, xsrfToken: test.testXsrfToken,
technicalDocsUrl: 'http://example.com/techdocs', technicalDocsUrl: 'http://example.com/techdocs',
premiumPriceAckRequired: false,
readonly: true, readonly: true,
}); });
const xhr = goog.testing.net.XhrIo.getSendInstances().pop(); const xhr = goog.testing.net.XhrIo.getSendInstances().pop();

View file

@ -345,15 +345,6 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
CLIENT_ID, "update", allExceptCorrectRoles.toString(), "ERROR: ForbiddenException"); CLIENT_ID, "update", allExceptCorrectRoles.toString(), "ERROR: ForbiddenException");
} }
@Test
public void testUpdate_premiumPriceAck() {
doTestUpdate(
Role.OWNER,
Registrar::getPremiumPriceAckRequired,
true,
Registrar.Builder::setPremiumPriceAckRequired);
}
@Test @Test
public void testUpdate_whoisServer() { public void testUpdate_whoisServer() {
doTestUpdate( doTestUpdate(

View file

@ -1,2 +0,0 @@
The following changes were made to the registrar:
premiumPriceAckRequired: false -> true