diff --git a/java/google/registry/flows/domain/DomainPricingLogic.java b/java/google/registry/flows/domain/DomainPricingLogic.java index 3fd6928c7..5e81e04a1 100644 --- a/java/google/registry/flows/domain/DomainPricingLogic.java +++ b/java/google/registry/flows/domain/DomainPricingLogic.java @@ -31,6 +31,7 @@ import google.registry.model.domain.fee.BaseFee; import google.registry.model.domain.fee.BaseFee.FeeType; import google.registry.model.domain.fee.Fee; import google.registry.model.registry.Registry; +import java.math.BigDecimal; import java.util.Optional; import javax.inject.Inject; import org.joda.money.CurrencyUnit; @@ -56,9 +57,10 @@ public final class DomainPricingLogic { throws EppException { CurrencyUnit currency = registry.getCurrency(); - // Get the vanilla create cost. - BaseFee createFeeOrCredit = - Fee.create(getDomainCreateCost(domainName, date, years).getAmount(), FeeType.CREATE); + // Get the vanilla create cost, or 0 for anchor tenants. + BigDecimal domainCreateCost = + isAnchorTenant ? BigDecimal.ZERO : getDomainCreateCost(domainName, date, years).getAmount(); + BaseFee createFeeOrCredit = Fee.create(domainCreateCost, FeeType.CREATE); // Create fees for the cost and the EAP fee, if any. Fee eapFee = registry.getEapFeeFor(date); diff --git a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java index e816cf8e2..a0eb98895 100644 --- a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java @@ -214,16 +214,18 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase expectedBillingFlags) throws Exception { DomainBase domain = reloadResourceByForeignKey(); - // Calculate the total cost. - Money cost = - isDomainPremium(getUniqueIdFromCommand(), clock.nowUtc()) - ? Money.of(USD, 200) - : Money.of(USD, 26); + boolean isAnchorTenant = expectedBillingFlags.contains(ANCHOR_TENANT); + // Calculate the total creation cost. + Money creationCost = + isAnchorTenant + ? Money.of(USD, 0) + : isDomainPremium(getUniqueIdFromCommand(), clock.nowUtc()) + ? Money.of(USD, 200) + : Money.of(USD, 26); Money eapFee = Money.of( Registry.get(domainTld).getCurrency(), Registry.get(domainTld).getEapFeeFor(clock.nowUtc()).getCost()); - boolean isAnchorTenant = expectedBillingFlags.contains(ANCHOR_TENANT); DateTime billingTime = isAnchorTenant ? clock.nowUtc().plus(Registry.get(domainTld).getAnchorTenantAddGracePeriodLength()) @@ -244,7 +246,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase