mirror of
https://github.com/google/nomulus
synced 2026-01-09 15:43:52 +00:00
Add extra logic for all relevant flows
This CL enhances various domain flows (check, create, delete, renew, restore, transfer, update) so that they invoke the appropriate methods on the object implementing the TLD's RegistryExtraFlowLogic (if any). TldSpecificLogicProxy is also updated to invoke RegistryExtraFlowLogic proxy (if any) to fetch the appropriate price. The tests use a made-up extra flow logic object which can be attached to a test TLD to make sure that the proper routines are being invoked. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=132486734
This commit is contained in:
@@ -26,6 +26,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import com.googlecode.objectify.Key;
|
||||
@@ -75,6 +76,7 @@ public class DomainRestoreRequestFlow extends OwnedResourceMutateFlow<DomainReso
|
||||
protected FeeTransformCommandExtension feeUpdate;
|
||||
protected Money restoreCost;
|
||||
protected Money renewCost;
|
||||
protected Optional<RegistryExtraFlowLogic> extraFlowLogic;
|
||||
|
||||
@Inject DomainRestoreRequestFlow() {}
|
||||
|
||||
@@ -82,6 +84,7 @@ public class DomainRestoreRequestFlow extends OwnedResourceMutateFlow<DomainReso
|
||||
protected final void initResourceCreateOrMutateFlow() throws EppException {
|
||||
registerExtensions(RgpUpdateExtension.class);
|
||||
registerExtensions(FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER);
|
||||
extraFlowLogic = RegistryExtraFlowLogicProxy.newInstanceForDomain(existingResource);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,6 +158,13 @@ public class DomainRestoreRequestFlow extends OwnedResourceMutateFlow<DomainReso
|
||||
.build();
|
||||
|
||||
ofy().save().<Object>entities(restoreEvent, autorenewEvent, autorenewPollMessage, renewEvent);
|
||||
|
||||
// Handle extra flow logic, if any.
|
||||
if (extraFlowLogic.isPresent()) {
|
||||
extraFlowLogic.get().performAdditionalDomainRestoreLogic(
|
||||
existingResource, getClientId(), now, eppInput);
|
||||
}
|
||||
|
||||
return existingResource.asBuilder()
|
||||
.setRegistrationExpirationTime(newExpirationTime)
|
||||
.setDeletionTime(END_OF_TIME)
|
||||
@@ -171,6 +181,10 @@ public class DomainRestoreRequestFlow extends OwnedResourceMutateFlow<DomainReso
|
||||
// Update the relevant {@link ForeignKey} to cache the new deletion time.
|
||||
ofy().save().entity(ForeignKeyIndex.create(newResource, newResource.getDeletionTime()));
|
||||
ofy().delete().key(existingResource.getDeletePollMessage());
|
||||
|
||||
if (extraFlowLogic.isPresent()) {
|
||||
extraFlowLogic.get().commitAdditionalLogicChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user