diff --git a/java/google/registry/flows/domain/DomainAllocateFlow.java b/java/google/registry/flows/domain/DomainAllocateFlow.java index c0e5a9b6e..76fb423c0 100644 --- a/java/google/registry/flows/domain/DomainAllocateFlow.java +++ b/java/google/registry/flows/domain/DomainAllocateFlow.java @@ -391,7 +391,8 @@ public class DomainAllocateFlow implements TransactionalFlow { private ImmutableList createResponseExtensions( DateTime now, Registry registry, int years) throws EppException { - FeesAndCredits feesAndCredits = pricingLogic.getCreatePrice(registry, targetId, now, years); + FeesAndCredits feesAndCredits = + pricingLogic.getCreatePrice(registry, targetId, now, years, false); Optional feeCreate = eppInput.getSingleExtension(FeeCreateCommandExtension.class); return feeCreate.isPresent() diff --git a/java/google/registry/flows/domain/DomainApplicationCreateFlow.java b/java/google/registry/flows/domain/DomainApplicationCreateFlow.java index 233ae2f2a..7cb9a8bf0 100644 --- a/java/google/registry/flows/domain/DomainApplicationCreateFlow.java +++ b/java/google/registry/flows/domain/DomainApplicationCreateFlow.java @@ -211,8 +211,11 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow { checkAllowedAccessToTld(clientId, tld); } Registry registry = Registry.get(tld); + boolean isAnchorTenant = + isAnchorTenant(domainName, Optional.empty(), authInfo.getPw().getValue(), Optional.empty()); FeesAndCredits feesAndCredits = - pricingLogic.getCreatePrice(registry, targetId, now, command.getPeriod().getValue()); + pricingLogic.getCreatePrice( + registry, targetId, now, command.getPeriod().getValue(), isAnchorTenant); verifyUnitIsYears(command.getPeriod()); int years = command.getPeriod().getValue(); validateRegistrationPeriod(years); @@ -220,8 +223,6 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow { LaunchCreateExtension launchCreate = eppInput.getSingleExtension(LaunchCreateExtension.class).get(); validateLaunchCreateExtension(launchCreate, registry, domainName, now); - boolean isAnchorTenant = - isAnchorTenant(domainName, Optional.empty(), authInfo.getPw().getValue(), Optional.empty()); // Superusers can create reserved domains, force creations on domains that require a claims // notice without specifying a claims key, and override blocks on registering premium domains. if (!isSuperuser) { diff --git a/java/google/registry/flows/domain/DomainCreateFlow.java b/java/google/registry/flows/domain/DomainCreateFlow.java index 71e16f879..894d2421f 100644 --- a/java/google/registry/flows/domain/DomainCreateFlow.java +++ b/java/google/registry/flows/domain/DomainCreateFlow.java @@ -308,7 +308,8 @@ public class DomainCreateFlow implements TransactionalFlow { .build()); Optional feeCreate = eppInput.getSingleExtension(FeeCreateCommandExtension.class); - FeesAndCredits feesAndCredits = pricingLogic.getCreatePrice(registry, targetId, now, years); + FeesAndCredits feesAndCredits = + pricingLogic.getCreatePrice(registry, targetId, now, years, isAnchorTenant); validateFeeChallenge(targetId, registry.getTldStr(), clientId, now, feeCreate, feesAndCredits); Optional secDnsCreate = validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class)); diff --git a/java/google/registry/flows/domain/DomainFlowUtils.java b/java/google/registry/flows/domain/DomainFlowUtils.java index c03f1d81b..85843db84 100644 --- a/java/google/registry/flows/domain/DomainFlowUtils.java +++ b/java/google/registry/flows/domain/DomainFlowUtils.java @@ -621,7 +621,10 @@ public class DomainFlowUtils { builder.setReasonIfSupported("reserved"); } else { builder.setAvailIfSupported(true); - fees = pricingLogic.getCreatePrice(registry, domainNameString, now, years).getFees(); + // TODO(b/117145844): Once allocation token support for domain check flow is implemented, + // we should be able to calculate the correct price here. + fees = + pricingLogic.getCreatePrice(registry, domainNameString, now, years, false).getFees(); } break; case RENEW: diff --git a/java/google/registry/flows/domain/DomainPricingLogic.java b/java/google/registry/flows/domain/DomainPricingLogic.java index 4b4620ad0..22e900756 100644 --- a/java/google/registry/flows/domain/DomainPricingLogic.java +++ b/java/google/registry/flows/domain/DomainPricingLogic.java @@ -54,7 +54,8 @@ public final class DomainPricingLogic { /** Returns a new create price for the pricer. */ public FeesAndCredits getCreatePrice( - Registry registry, String domainName, DateTime date, int years) throws EppException { + Registry registry, String domainName, DateTime date, int years, boolean isAnchorTenant) + throws EppException { CurrencyUnit currency = registry.getCurrency(); // Get the vanilla create cost. @@ -65,7 +66,8 @@ public final class DomainPricingLogic { Fee eapFee = registry.getEapFeeFor(date); FeesAndCredits.Builder feesBuilder = new FeesAndCredits.Builder().setCurrency(currency).addFeeOrCredit(createFeeOrCredit); - if (!eapFee.hasZeroCost()) { + // Don't charge anchor tenants EAP fees. + if (!isAnchorTenant && !eapFee.hasZeroCost()) { feesBuilder.addFeeOrCredit(eapFee); } diff --git a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java index 33f417273..1698920c9 100644 --- a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java @@ -270,7 +270,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase().add(createBillingEvent).add(renewBillingEvent); // If EAP is applied, a billing event for EAP should be present. - if (!eapFee.isZero()) { + // EAP fees are bypassed for anchor tenant domains. + if (!isAnchorTenant && !eapFee.isZero()) { BillingEvent.OneTime eapBillingEvent = new BillingEvent.OneTime.Builder() .setReason(Reason.FEE_EARLY_ACCESS) @@ -1012,6 +1013,22 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase