From fd7820759dd8893384ae9b5fbd1a17cf8d053b2c Mon Sep 17 00:00:00 2001 From: gbrodman Date: Thu, 15 Aug 2024 15:06:32 -0400 Subject: [PATCH] Use token's renewalPrice if renewalBehavior is SPECIFIED (#2502) Previous PRs and token changes (see b/332928676) have made it so that SPECIFIED renewalPriceBehavior tokens must have a renewal price. As such, we can now use that renewalPrice when creating domains with SPECIFIED tokens. --- .../flows/domain/DomainCreateFlow.java | 8 +-- .../flows/domain/DomainCreateFlowTest.java | 64 +++---------------- 2 files changed, 13 insertions(+), 59 deletions(-) diff --git a/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java b/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java index 94d7166be..ea18605da 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java @@ -365,7 +365,7 @@ public final class DomainCreateFlow implements MutatingFlow { createAutorenewBillingEvent( domainHistoryId, registrationExpirationTime, - getRenewalPriceInfo(isAnchorTenant, allocationToken, feesAndCredits)); + getRenewalPriceInfo(isAnchorTenant, allocationToken)); PollMessage.Autorenew autorenewPollMessage = createAutorenewPollMessage(domainHistoryId, registrationExpirationTime); ImmutableSet.Builder entitiesToSave = new ImmutableSet.Builder<>(); @@ -688,9 +688,7 @@ public final class DomainCreateFlow implements MutatingFlow { * AllocationToken} is 'SPECIFIED'. */ static RenewalPriceInfo getRenewalPriceInfo( - boolean isAnchorTenant, - Optional allocationToken, - FeesAndCredits feesAndCredits) { + boolean isAnchorTenant, Optional allocationToken) { if (isAnchorTenant) { allocationToken.ifPresent( token -> @@ -701,7 +699,7 @@ public final class DomainCreateFlow implements MutatingFlow { } else if (allocationToken.isPresent() && allocationToken.get().getRenewalPriceBehavior() == RenewalPriceBehavior.SPECIFIED) { return RenewalPriceInfo.create( - RenewalPriceBehavior.SPECIFIED, feesAndCredits.getCreateCost()); + RenewalPriceBehavior.SPECIFIED, allocationToken.get().getRenewalPrice().get()); } else { return RenewalPriceInfo.create(RenewalPriceBehavior.DEFAULT, null); } diff --git a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java index a7b2f87e5..9928d2809 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java @@ -344,8 +344,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase