diff --git a/java/google/registry/flows/domain/DomainRenewFlow.java b/java/google/registry/flows/domain/DomainRenewFlow.java index 9dd78e06a..47bacfacb 100644 --- a/java/google/registry/flows/domain/DomainRenewFlow.java +++ b/java/google/registry/flows/domain/DomainRenewFlow.java @@ -29,7 +29,6 @@ import static google.registry.model.domain.DomainResource.extendRegistrationWith import static google.registry.model.domain.fee.Fee.FEE_RENEW_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER; import static google.registry.model.eppoutput.Result.Code.SUCCESS; import static google.registry.model.ofy.ObjectifyService.ofy; -import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost; import static google.registry.util.DateTimeUtils.leapSafeAddYears; import com.google.common.base.Optional; @@ -43,6 +42,7 @@ import google.registry.flows.FlowModule.ClientId; import google.registry.flows.FlowModule.TargetId; import google.registry.flows.LoggedInFlow; import google.registry.flows.TransactionalFlow; +import google.registry.flows.domain.TldSpecificLogicProxy.EppCommandOperations; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingEvent.OneTime; import google.registry.model.billing.BillingEvent.Reason; @@ -122,10 +122,12 @@ public final class DomainRenewFlow extends LoggedInFlow implements Transactional DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now); verifyRenewAllowed(authInfo, existingDomain, command); int years = command.getPeriod().getValue(); - Money renewCost = getDomainRenewCost(targetId, now, years); FeeTransformCommandExtension feeRenew = eppInput.getFirstExtensionOfClasses(FEE_RENEW_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER); - validateFeeChallenge(targetId, existingDomain.getTld(), now, feeRenew, renewCost); + EppCommandOperations commandOperations = TldSpecificLogicProxy.getRenewPrice( + Registry.get(existingDomain.getTld()), targetId, clientId, now, years, eppInput); + validateFeeChallenge( + targetId, existingDomain.getTld(), now, feeRenew, commandOperations.getTotalCost()); HistoryEntry historyEntry = historyBuilder .setType(HistoryEntry.Type.DOMAIN_RENEW) .setPeriod(command.getPeriod()) @@ -140,7 +142,7 @@ public final class DomainRenewFlow extends LoggedInFlow implements Transactional String tld = existingDomain.getTld(); // Bill for this explicit renew itself. BillingEvent.OneTime explicitRenewEvent = - createRenewBillingEvent(tld, renewCost, years, historyEntry); + createRenewBillingEvent(tld, commandOperations.getTotalCost(), years, historyEntry); // Create a new autorenew billing event and poll message starting at the new expiration time. BillingEvent.Recurring newAutorenewEvent = newAutorenewBillingEvent(existingDomain) .setEventTime(newExpirationTime) @@ -171,7 +173,7 @@ public final class DomainRenewFlow extends LoggedInFlow implements Transactional return createOutput( SUCCESS, DomainRenewData.create(targetId, newExpirationTime), - createResponseExtensions(renewCost, feeRenew)); + createResponseExtensions(commandOperations.getTotalCost(), feeRenew)); } private void verifyRenewAllowed( diff --git a/javatests/google/registry/flows/domain/DomainRenewFlowTest.java b/javatests/google/registry/flows/domain/DomainRenewFlowTest.java index 4b83381ea..78450105f 100644 --- a/javatests/google/registry/flows/domain/DomainRenewFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainRenewFlowTest.java @@ -613,11 +613,20 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase - example.flags + create-42.flags 2000-04-03 - 5 + 1 + + + USD + %FEE% + + ABC-12345 diff --git a/javatests/google/registry/model/domain/TestExtraLogicManager.java b/javatests/google/registry/model/domain/TestExtraLogicManager.java index 6969129ca..81c46b965 100644 --- a/javatests/google/registry/model/domain/TestExtraLogicManager.java +++ b/javatests/google/registry/model/domain/TestExtraLogicManager.java @@ -58,6 +58,15 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic { } } + /** + * Gets the flags to be used in the EPP flags extension for info commands. + * + *

The test extra logic manager uses domain names differently for info commands than for other + * flows. In other flows, the test logic needs returns (via the success exception) the flags found + * in the incoming message. But for info commands, there aren't any incoming flags, only outgoing + * ones. So we need to specify the flags using a dummy domain name; those flags can then be + * inserted into the outgoing info response. + */ @Override public Set getExtensionFlags( DomainResource domainResource, String clientId, DateTime asOfDate) {