mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Require fee extension when registering domain in EAP
Failing to use the fee extension during EAP can result in charges to registrars that are radically different than what they may have been expecting. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177597883
This commit is contained in:
parent
087a500093
commit
ebfa27b3ad
4 changed files with 41 additions and 3 deletions
|
@ -517,6 +517,8 @@ An EPP flow that creates a new domain resource.
|
||||||
* Service extension(s) must be declared at login.
|
* Service extension(s) must be declared at login.
|
||||||
* The current registry phase does not allow for general registrations.
|
* The current registry phase does not allow for general registrations.
|
||||||
* 2003
|
* 2003
|
||||||
|
* Fees must be explicitly acknowledged when creating domains during the
|
||||||
|
Early Access Program.
|
||||||
* Fees must be explicitly acknowledged when performing any operations on a
|
* Fees must be explicitly acknowledged when performing any operations on a
|
||||||
premium name.
|
premium name.
|
||||||
* Admin contact is required.
|
* Admin contact is required.
|
||||||
|
|
|
@ -133,6 +133,7 @@ import org.joda.time.Duration;
|
||||||
* @error {@link DomainFlowUtils.ExceedsMaxRegistrationYearsException}
|
* @error {@link DomainFlowUtils.ExceedsMaxRegistrationYearsException}
|
||||||
* @error {@link DomainFlowUtils.ExpiredClaimException}
|
* @error {@link DomainFlowUtils.ExpiredClaimException}
|
||||||
* @error {@link DomainFlowUtils.FeesMismatchException}
|
* @error {@link DomainFlowUtils.FeesMismatchException}
|
||||||
|
* @error {@link DomainFlowUtils.FeesRequiredDuringEarlyAccessProgramException}
|
||||||
* @error {@link DomainFlowUtils.FeesRequiredForPremiumNameException}
|
* @error {@link DomainFlowUtils.FeesRequiredForPremiumNameException}
|
||||||
* @error {@link DomainFlowUtils.InvalidIdnDomainLabelException}
|
* @error {@link DomainFlowUtils.InvalidIdnDomainLabelException}
|
||||||
* @error {@link DomainFlowUtils.InvalidLrpTokenException}
|
* @error {@link DomainFlowUtils.InvalidLrpTokenException}
|
||||||
|
|
|
@ -631,6 +631,9 @@ public class DomainFlowUtils {
|
||||||
// This only happens when the total fees are non-zero and include custom fees requiring the
|
// This only happens when the total fees are non-zero and include custom fees requiring the
|
||||||
// extension.
|
// extension.
|
||||||
if (feeCommand == null) {
|
if (feeCommand == null) {
|
||||||
|
if (!feesAndCredits.getEapCost().isZero()) {
|
||||||
|
throw new FeesRequiredDuringEarlyAccessProgramException(feesAndCredits.getEapCost());
|
||||||
|
}
|
||||||
if (feesAndCredits.getTotalCost().isZero() || !feesAndCredits.isFeeExtensionRequired()) {
|
if (feesAndCredits.getTotalCost().isZero() || !feesAndCredits.isFeeExtensionRequired()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1167,9 +1170,6 @@ public class DomainFlowUtils {
|
||||||
|
|
||||||
/** Fees must be explicitly acknowledged when performing an operation which is not free. */
|
/** Fees must be explicitly acknowledged when performing an operation which is not free. */
|
||||||
static class FeesRequiredForNonFreeOperationException extends RequiredParameterMissingException {
|
static class FeesRequiredForNonFreeOperationException extends RequiredParameterMissingException {
|
||||||
FeesRequiredForNonFreeOperationException() {
|
|
||||||
super("Fees must be explicitly acknowledged when performing an operation which is not free.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public FeesRequiredForNonFreeOperationException(Money expectedFee) {
|
public FeesRequiredForNonFreeOperationException(Money expectedFee) {
|
||||||
super(
|
super(
|
||||||
|
@ -1179,6 +1179,18 @@ public class DomainFlowUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Fees must be explicitly acknowledged when creating domains during the Early Access Program. */
|
||||||
|
static class FeesRequiredDuringEarlyAccessProgramException
|
||||||
|
extends RequiredParameterMissingException {
|
||||||
|
|
||||||
|
public FeesRequiredDuringEarlyAccessProgramException(Money expectedFee) {
|
||||||
|
super(
|
||||||
|
"Fees must be explicitly acknowledged when creating domains "
|
||||||
|
+ "during the Early Access Program. The EAP fee is: "
|
||||||
|
+ expectedFee);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** The 'grace-period', 'applied' and 'refundable' fields are disallowed by server policy. */
|
/** The 'grace-period', 'applied' and 'refundable' fields are disallowed by server policy. */
|
||||||
static class UnsupportedFeeAttributeException extends UnimplementedOptionException {
|
static class UnsupportedFeeAttributeException extends UnimplementedOptionException {
|
||||||
UnsupportedFeeAttributeException() {
|
UnsupportedFeeAttributeException() {
|
||||||
|
|
|
@ -43,6 +43,7 @@ import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
||||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||||
|
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
|
||||||
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
|
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
|
||||||
|
@ -82,6 +83,7 @@ import google.registry.flows.domain.DomainFlowUtils.EmptyDomainNamePartException
|
||||||
import google.registry.flows.domain.DomainFlowUtils.ExceedsMaxRegistrationYearsException;
|
import google.registry.flows.domain.DomainFlowUtils.ExceedsMaxRegistrationYearsException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.ExpiredClaimException;
|
import google.registry.flows.domain.DomainFlowUtils.ExpiredClaimException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.FeesMismatchException;
|
import google.registry.flows.domain.DomainFlowUtils.FeesMismatchException;
|
||||||
|
import google.registry.flows.domain.DomainFlowUtils.FeesRequiredDuringEarlyAccessProgramException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.FeesRequiredForPremiumNameException;
|
import google.registry.flows.domain.DomainFlowUtils.FeesRequiredForPremiumNameException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.InvalidIdnDomainLabelException;
|
import google.registry.flows.domain.DomainFlowUtils.InvalidIdnDomainLabelException;
|
||||||
import google.registry.flows.domain.DomainFlowUtils.InvalidLrpTokenException;
|
import google.registry.flows.domain.DomainFlowUtils.InvalidLrpTokenException;
|
||||||
|
@ -1967,6 +1969,27 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
||||||
"tld", "domain_create_response_eap_fee.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
|
"tld", "domain_create_response_eap_fee.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFailure_domainInEap_failsWithoutFeeExtension() throws Exception {
|
||||||
|
persistContactsAndHosts();
|
||||||
|
persistResource(
|
||||||
|
Registry.get("tld")
|
||||||
|
.asBuilder()
|
||||||
|
.setEapFeeSchedule(
|
||||||
|
ImmutableSortedMap.of(
|
||||||
|
START_OF_TIME, Money.of(USD, 0),
|
||||||
|
clock.nowUtc().minusDays(1), Money.of(USD, 100),
|
||||||
|
clock.nowUtc().plusDays(1), Money.of(USD, 0)))
|
||||||
|
.build());
|
||||||
|
Exception e = expectThrows(FeesRequiredDuringEarlyAccessProgramException.class, this::runFlow);
|
||||||
|
assertThat(e)
|
||||||
|
.hasMessageThat()
|
||||||
|
.isEqualTo(
|
||||||
|
"Fees must be explicitly acknowledged when creating domains "
|
||||||
|
+ "during the Early Access Program. The EAP fee is: USD 100.00");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_eapFee_beforeEntireSchedule() throws Exception {
|
public void testSuccess_eapFee_beforeEntireSchedule() throws Exception {
|
||||||
persistContactsAndHosts();
|
persistContactsAndHosts();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue