mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 16:37:13 +02:00
Add TLD extra flow logic for update
This CL implements the TLD-specific extra flow logic for updates, with tests, based on the static helper classes of the previous CL. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=135683537
This commit is contained in:
parent
94c549d960
commit
718da70b71
5 changed files with 53 additions and 67 deletions
|
@ -42,7 +42,7 @@ import google.registry.model.eppcommon.AuthInfo;
|
||||||
import google.registry.model.eppinput.ResourceCommand;
|
import google.registry.model.eppinput.ResourceCommand;
|
||||||
import google.registry.model.eppoutput.EppOutput;
|
import google.registry.model.eppoutput.EppOutput;
|
||||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,10 +136,10 @@ public final class DomainInfoFlow extends LoggedInFlow {
|
||||||
Optional<RegistryExtraFlowLogic> extraLogicManager =
|
Optional<RegistryExtraFlowLogic> extraLogicManager =
|
||||||
RegistryExtraFlowLogicProxy.newInstanceForDomain(domain);
|
RegistryExtraFlowLogicProxy.newInstanceForDomain(domain);
|
||||||
if (extraLogicManager.isPresent()) {
|
if (extraLogicManager.isPresent()) {
|
||||||
List<String> flags = extraLogicManager.get().getExtensionFlags(
|
Set<String> flags = extraLogicManager.get().getExtensionFlags(
|
||||||
domain, clientId, now); // As-of date is always now for info commands.
|
domain, clientId, now); // As-of date is always now for info commands.
|
||||||
if (!flags.isEmpty()) {
|
if (!flags.isEmpty()) {
|
||||||
extensions.add(FlagsInfoResponseExtension.create(flags));
|
extensions.add(FlagsInfoResponseExtension.create(ImmutableList.copyOf(flags)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return forceEmptyToNull(extensions.build());
|
return forceEmptyToNull(extensions.build());
|
||||||
|
|
|
@ -19,7 +19,7 @@ import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.fee.BaseFee;
|
import google.registry.model.domain.fee.BaseFee;
|
||||||
import google.registry.model.eppinput.EppInput;
|
import google.registry.model.eppinput.EppInput;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,11 +28,19 @@ import org.joda.time.DateTime;
|
||||||
*/
|
*/
|
||||||
public interface RegistryExtraFlowLogic {
|
public interface RegistryExtraFlowLogic {
|
||||||
|
|
||||||
/** Gets the flags to be used in the EPP flags extension. This is used for EPP info commands. */
|
/**
|
||||||
public List<String> getExtensionFlags(
|
* Gets the flags to be used in the EPP flags extension.
|
||||||
|
*
|
||||||
|
* <p>This is used for EPP info commands.
|
||||||
|
*/
|
||||||
|
public Set<String> getExtensionFlags(
|
||||||
DomainResource domainResource, String clientId, DateTime asOfDate);
|
DomainResource domainResource, String clientId, DateTime asOfDate);
|
||||||
|
|
||||||
/** Computes the expected creation fee, for use in fee challenges and the like. */
|
/**
|
||||||
|
* Computes the expected creation fee.
|
||||||
|
*
|
||||||
|
* <p>For use in fee challenges and the like.
|
||||||
|
*/
|
||||||
public BaseFee getCreateFeeOrCredit(
|
public BaseFee getCreateFeeOrCredit(
|
||||||
String domainName,
|
String domainName,
|
||||||
String clientId,
|
String clientId,
|
||||||
|
@ -41,8 +49,10 @@ public interface RegistryExtraFlowLogic {
|
||||||
EppInput eppInput) throws EppException;
|
EppInput eppInput) throws EppException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs additional tasks required for a create command. Any changes should not be persisted to
|
* Performs additional tasks required for a create command.
|
||||||
* Datastore until commitAdditionalLogicChanges is called.
|
*
|
||||||
|
* <p>Any changes should not be persisted to Datastore until commitAdditionalLogicChanges is
|
||||||
|
* called.
|
||||||
*/
|
*/
|
||||||
public void performAdditionalDomainCreateLogic(
|
public void performAdditionalDomainCreateLogic(
|
||||||
DomainResource domain,
|
DomainResource domain,
|
||||||
|
@ -53,8 +63,10 @@ public interface RegistryExtraFlowLogic {
|
||||||
HistoryEntry historyEntry) throws EppException;
|
HistoryEntry historyEntry) throws EppException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs additional tasks required for a delete command. Any changes should not be persisted to
|
* Performs additional tasks required for a delete command.
|
||||||
* Datastore until commitAdditionalLogicChanges is called.
|
*
|
||||||
|
* <p>Any changes should not be persisted to Datastore until commitAdditionalLogicChanges is
|
||||||
|
* called.
|
||||||
*/
|
*/
|
||||||
public void performAdditionalDomainDeleteLogic(
|
public void performAdditionalDomainDeleteLogic(
|
||||||
DomainResource domain,
|
DomainResource domain,
|
||||||
|
@ -63,7 +75,11 @@ public interface RegistryExtraFlowLogic {
|
||||||
EppInput eppInput,
|
EppInput eppInput,
|
||||||
HistoryEntry historyEntry) throws EppException;
|
HistoryEntry historyEntry) throws EppException;
|
||||||
|
|
||||||
/** Computes the expected renewal fee, for use in fee challenges and the like. */
|
/**
|
||||||
|
* Computes the expected renewal fee.
|
||||||
|
*
|
||||||
|
* <p>For use in fee challenges and the like.
|
||||||
|
*/
|
||||||
public BaseFee getRenewFeeOrCredit(
|
public BaseFee getRenewFeeOrCredit(
|
||||||
DomainResource domain,
|
DomainResource domain,
|
||||||
String clientId,
|
String clientId,
|
||||||
|
@ -72,8 +88,10 @@ public interface RegistryExtraFlowLogic {
|
||||||
EppInput eppInput) throws EppException;
|
EppInput eppInput) throws EppException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs additional tasks required for a renew command. Any changes should not be persisted
|
* Performs additional tasks required for a renew command.
|
||||||
* to Datastore until commitAdditionalLogicChanges is called.
|
*
|
||||||
|
* <p>Any changes should not be persisted to Datastore until commitAdditionalLogicChanges is
|
||||||
|
* called.
|
||||||
*/
|
*/
|
||||||
public void performAdditionalDomainRenewLogic(
|
public void performAdditionalDomainRenewLogic(
|
||||||
DomainResource domain,
|
DomainResource domain,
|
||||||
|
@ -84,8 +102,10 @@ public interface RegistryExtraFlowLogic {
|
||||||
HistoryEntry historyEntry) throws EppException;
|
HistoryEntry historyEntry) throws EppException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs additional tasks required for a restore command. Any changes should not be persisted
|
* Performs additional tasks required for a restore command.
|
||||||
* to Datastore until commitAdditionalLogicChanges is called.
|
*
|
||||||
|
* <p>Any changes should not be persisted to Datastore until commitAdditionalLogicChanges is
|
||||||
|
* called.
|
||||||
*/
|
*/
|
||||||
public void performAdditionalDomainRestoreLogic(
|
public void performAdditionalDomainRestoreLogic(
|
||||||
DomainResource domain,
|
DomainResource domain,
|
||||||
|
@ -95,8 +115,10 @@ public interface RegistryExtraFlowLogic {
|
||||||
HistoryEntry historyEntry) throws EppException;
|
HistoryEntry historyEntry) throws EppException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs additional tasks required for a transfer command. Any changes should not be persisted
|
* Performs additional tasks required for a transfer command.
|
||||||
* to Datastore until commitAdditionalLogicChanges is called.
|
*
|
||||||
|
* <p>Any changes should not be persisted to Datastore until commitAdditionalLogicChanges is
|
||||||
|
* called.
|
||||||
*/
|
*/
|
||||||
public void performAdditionalDomainTransferLogic(
|
public void performAdditionalDomainTransferLogic(
|
||||||
DomainResource domain,
|
DomainResource domain,
|
||||||
|
@ -106,7 +128,11 @@ public interface RegistryExtraFlowLogic {
|
||||||
EppInput eppInput,
|
EppInput eppInput,
|
||||||
HistoryEntry historyEntry) throws EppException;
|
HistoryEntry historyEntry) throws EppException;
|
||||||
|
|
||||||
/** Computes the expected update fee, for use in fee challenges and the like. */
|
/**
|
||||||
|
* Computes the expected update fee.
|
||||||
|
*
|
||||||
|
* <p>For use in fee challenges and the like.
|
||||||
|
*/
|
||||||
public BaseFee getUpdateFeeOrCredit(
|
public BaseFee getUpdateFeeOrCredit(
|
||||||
DomainResource domain,
|
DomainResource domain,
|
||||||
String clientId,
|
String clientId,
|
||||||
|
@ -114,8 +140,10 @@ public interface RegistryExtraFlowLogic {
|
||||||
EppInput eppInput) throws EppException;
|
EppInput eppInput) throws EppException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs additional tasks required for an update command. Any changes should not be persisted
|
* Performs additional tasks required for an update command.
|
||||||
* to Datastore until commitAdditionalLogicChanges is called.
|
*
|
||||||
|
* <p>Any changes should not be persisted to Datastore until commitAdditionalLogicChanges is
|
||||||
|
* called.
|
||||||
*/
|
*/
|
||||||
public void performAdditionalDomainUpdateLogic(
|
public void performAdditionalDomainUpdateLogic(
|
||||||
DomainResource domain,
|
DomainResource domain,
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
|
||||||
<command>
|
|
||||||
<update>
|
|
||||||
<domain:update
|
|
||||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
|
||||||
<domain:name>example.tld</domain:name>
|
|
||||||
</domain:update>
|
|
||||||
</update>
|
|
||||||
<extension>
|
|
||||||
<flags:update xmlns:flags="urn:google:params:xml:ns:flags-0.1">
|
|
||||||
<flags:add>
|
|
||||||
<flags:flag>%FLAG%</flags:flag>
|
|
||||||
</flags:add>
|
|
||||||
</flags:update>
|
|
||||||
<fee:update xmlns:fee="urn:ietf:params:xml:ns:fee-0.6">
|
|
||||||
<fee:currency>USD</fee:currency>
|
|
||||||
<fee:fee>%FEE%</fee:fee>
|
|
||||||
</fee:update>
|
|
||||||
</extension>
|
|
||||||
<clTRID>ABC-12345</clTRID>
|
|
||||||
</command>
|
|
||||||
</epp>
|
|
|
@ -1,22 +0,0 @@
|
||||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
|
||||||
<command>
|
|
||||||
<update>
|
|
||||||
<domain:update
|
|
||||||
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
|
||||||
<domain:name>example.tld</domain:name>
|
|
||||||
</domain:update>
|
|
||||||
</update>
|
|
||||||
<extension>
|
|
||||||
<flags:update xmlns:flags="urn:google:params:xml:ns:flags-0.1">
|
|
||||||
<flags:rem>
|
|
||||||
<flags:flag>%FLAG%</flags:flag>
|
|
||||||
</flags:rem>
|
|
||||||
</flags:update>
|
|
||||||
<fee:update xmlns:fee="urn:ietf:params:xml:ns:fee-0.6">
|
|
||||||
<fee:currency>USD</fee:currency>
|
|
||||||
<fee:fee>%FEE%</fee:fee>
|
|
||||||
</fee:update>
|
|
||||||
</extension>
|
|
||||||
<clTRID>ABC-12345</clTRID>
|
|
||||||
</command>
|
|
||||||
</epp>
|
|
|
@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import com.google.common.base.Ascii;
|
import com.google.common.base.Ascii;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.domain.RegistryExtraFlowLogic;
|
import google.registry.flows.domain.RegistryExtraFlowLogic;
|
||||||
|
@ -34,6 +35,7 @@ import google.registry.model.eppinput.EppInput;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +59,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getExtensionFlags(
|
public Set<String> getExtensionFlags(
|
||||||
DomainResource domainResource, String clientId, DateTime asOfDate) {
|
DomainResource domainResource, String clientId, DateTime asOfDate) {
|
||||||
// Take the part before the period, split by dashes, and treat each part after the first as
|
// Take the part before the period, split by dashes, and treat each part after the first as
|
||||||
// a flag.
|
// a flag.
|
||||||
|
@ -65,7 +67,7 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
|
||||||
Splitter.on('-').splitToList(
|
Splitter.on('-').splitToList(
|
||||||
Iterables.getFirst(
|
Iterables.getFirst(
|
||||||
Splitter.on('.').split(domainResource.getFullyQualifiedDomainName()), ""));
|
Splitter.on('.').split(domainResource.getFullyQualifiedDomainName()), ""));
|
||||||
return components.subList(1, components.size());
|
return ImmutableSet.copyOf(components.subList(1, components.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseFee domainNameToFeeOrCredit(String domainName) {
|
BaseFee domainNameToFeeOrCredit(String domainName) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue