mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Add extra flow logic hooks for transfer approve, cancel and reject
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=139217498
This commit is contained in:
parent
5262cd2854
commit
fb47d2563d
12 changed files with 150 additions and 6 deletions
|
@ -177,6 +177,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||||
newDomain.getTransferData(),
|
newDomain.getTransferData(),
|
||||||
newExpirationTime,
|
newExpirationTime,
|
||||||
historyEntry);
|
historyEntry);
|
||||||
|
handleExtraFlowLogic(tld, historyEntry, newDomain);
|
||||||
ofy().save().<ImmutableObject>entities(
|
ofy().save().<ImmutableObject>entities(
|
||||||
newDomain,
|
newDomain,
|
||||||
historyEntry,
|
historyEntry,
|
||||||
|
@ -192,4 +193,16 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||||
targetId, newDomain.getTransferData(), newDomain.getRegistrationExpirationTime()))
|
targetId, newDomain.getTransferData(), newDomain.getRegistrationExpirationTime()))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleExtraFlowLogic(
|
||||||
|
String tld, HistoryEntry historyEntry, DomainResource newDomain) throws EppException {
|
||||||
|
Optional<RegistryExtraFlowLogic> extraFlowLogic =
|
||||||
|
RegistryExtraFlowLogicProxy.newInstanceForTld(tld);
|
||||||
|
if (extraFlowLogic.isPresent()) {
|
||||||
|
extraFlowLogic.get().performAdditionalDomainTransferApproveLogic(
|
||||||
|
newDomain,
|
||||||
|
clientId,
|
||||||
|
historyEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
|
||||||
.build();
|
.build();
|
||||||
DomainResource newDomain =
|
DomainResource newDomain =
|
||||||
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now);
|
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now);
|
||||||
|
handleExtraFlowLogic(existingDomain.getTld(), historyEntry, existingDomain);
|
||||||
ofy().save().<ImmutableObject>entities(
|
ofy().save().<ImmutableObject>entities(
|
||||||
newDomain,
|
newDomain,
|
||||||
historyEntry,
|
historyEntry,
|
||||||
|
@ -107,4 +108,16 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
|
||||||
.setResData(createTransferResponse(targetId, newDomain.getTransferData(), null))
|
.setResData(createTransferResponse(targetId, newDomain.getTransferData(), null))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleExtraFlowLogic(
|
||||||
|
String tld, HistoryEntry historyEntry, DomainResource existingDomain) throws EppException {
|
||||||
|
Optional<RegistryExtraFlowLogic> extraFlowLogic =
|
||||||
|
RegistryExtraFlowLogicProxy.newInstanceForTld(tld);
|
||||||
|
if (extraFlowLogic.isPresent()) {
|
||||||
|
extraFlowLogic.get().performAdditionalDomainTransferCancelLogic(
|
||||||
|
existingDomain,
|
||||||
|
clientId,
|
||||||
|
historyEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
|
||||||
checkAllowedAccessToTld(clientId, existingDomain.getTld());
|
checkAllowedAccessToTld(clientId, existingDomain.getTld());
|
||||||
DomainResource newDomain =
|
DomainResource newDomain =
|
||||||
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now);
|
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now);
|
||||||
|
handleExtraFlowLogic(existingDomain.getTld(), historyEntry, existingDomain);
|
||||||
ofy().save().<ImmutableObject>entities(
|
ofy().save().<ImmutableObject>entities(
|
||||||
newDomain,
|
newDomain,
|
||||||
historyEntry,
|
historyEntry,
|
||||||
|
@ -105,4 +106,16 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
|
||||||
.setResData(createTransferResponse(targetId, newDomain.getTransferData(), null))
|
.setResData(createTransferResponse(targetId, newDomain.getTransferData(), null))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleExtraFlowLogic(
|
||||||
|
String tld, HistoryEntry historyEntry, DomainResource existingDomain) throws EppException {
|
||||||
|
Optional<RegistryExtraFlowLogic> extraFlowLogic =
|
||||||
|
RegistryExtraFlowLogicProxy.newInstanceForTld(tld);
|
||||||
|
if (extraFlowLogic.isPresent()) {
|
||||||
|
extraFlowLogic.get().performAdditionalDomainTransferRejectLogic(
|
||||||
|
existingDomain,
|
||||||
|
clientId,
|
||||||
|
historyEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,7 +382,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
||||||
Optional<RegistryExtraFlowLogic> extraFlowLogic =
|
Optional<RegistryExtraFlowLogic> extraFlowLogic =
|
||||||
RegistryExtraFlowLogicProxy.newInstanceForDomain(existingDomain);
|
RegistryExtraFlowLogicProxy.newInstanceForDomain(existingDomain);
|
||||||
if (extraFlowLogic.isPresent()) {
|
if (extraFlowLogic.isPresent()) {
|
||||||
extraFlowLogic.get().performAdditionalDomainTransferLogic(
|
extraFlowLogic.get().performAdditionalDomainTransferRequestLogic(
|
||||||
existingDomain,
|
existingDomain,
|
||||||
gainingClientId,
|
gainingClientId,
|
||||||
now,
|
now,
|
||||||
|
|
|
@ -126,8 +126,26 @@ public interface RegistryExtraFlowLogic {
|
||||||
EppInput eppInput,
|
EppInput eppInput,
|
||||||
HistoryEntry historyEntry) throws EppException;
|
HistoryEntry historyEntry) throws EppException;
|
||||||
|
|
||||||
/** Performs additional tasks required for a transfer command. */
|
/** Performs additional tasks required for a domain transfer approve command. */
|
||||||
public void performAdditionalDomainTransferLogic(
|
public void performAdditionalDomainTransferApproveLogic(
|
||||||
|
DomainResource domain,
|
||||||
|
String clientId,
|
||||||
|
HistoryEntry historyEntry) throws EppException;
|
||||||
|
|
||||||
|
/** Performs additional tasks required for a domain transfer cancel command. */
|
||||||
|
public void performAdditionalDomainTransferCancelLogic(
|
||||||
|
DomainResource domain,
|
||||||
|
String clientId,
|
||||||
|
HistoryEntry historyEntry) throws EppException;
|
||||||
|
|
||||||
|
/** Performs additional tasks required for a domain transfer reject command. */
|
||||||
|
public void performAdditionalDomainTransferRejectLogic(
|
||||||
|
DomainResource domain,
|
||||||
|
String clientId,
|
||||||
|
HistoryEntry historyEntry) throws EppException;
|
||||||
|
|
||||||
|
/** Performs additional tasks required for a transfer request command. */
|
||||||
|
public void performAdditionalDomainTransferRequestLogic(
|
||||||
DomainResource domain,
|
DomainResource domain,
|
||||||
String clientId,
|
String clientId,
|
||||||
DateTime asOfDate,
|
DateTime asOfDate,
|
||||||
|
|
|
@ -51,6 +51,8 @@ import google.registry.model.contact.ContactAuthInfo;
|
||||||
import google.registry.model.domain.DomainAuthInfo;
|
import google.registry.model.domain.DomainAuthInfo;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
|
import google.registry.model.domain.TestExtraLogicManager;
|
||||||
|
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
|
@ -93,6 +95,8 @@ public class DomainTransferApproveFlowTest
|
||||||
.build())
|
.build())
|
||||||
.build());
|
.build());
|
||||||
setClientIdForFlow("TheRegistrar");
|
setClientIdForFlow("TheRegistrar");
|
||||||
|
createTld("extra");
|
||||||
|
RegistryExtraFlowLogicProxy.setOverride("extra", TestExtraLogicManager.class);
|
||||||
setupDomainWithPendingTransfer();
|
setupDomainWithPendingTransfer();
|
||||||
clock.advanceOneMilli();
|
clock.advanceOneMilli();
|
||||||
}
|
}
|
||||||
|
@ -490,5 +494,12 @@ public class DomainTransferApproveFlowTest
|
||||||
|
|
||||||
// NB: No need to test pending delete status since pending transfers will get cancelled upon
|
// NB: No need to test pending delete status since pending transfers will get cancelled upon
|
||||||
// entering pending delete phase. So it's already handled in that test case.
|
// entering pending delete phase. So it's already handled in that test case.
|
||||||
}
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSuccess_extra() throws Exception {
|
||||||
|
setupDomainWithPendingTransfer("extra");
|
||||||
|
clock.advanceOneMilli();
|
||||||
|
thrown.expect(TestExtraLogicManagerSuccessException.class, "transfer approved");
|
||||||
|
doFailingTest("domain_transfer_approve_extra.xml");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ import google.registry.model.contact.ContactAuthInfo;
|
||||||
import google.registry.model.domain.DomainAuthInfo;
|
import google.registry.model.domain.DomainAuthInfo;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
|
import google.registry.model.domain.TestExtraLogicManager;
|
||||||
|
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.registrar.Registrar;
|
import google.registry.model.registrar.Registrar;
|
||||||
|
@ -297,4 +299,13 @@ public class DomainTransferCancelFlowTest
|
||||||
|
|
||||||
// NB: No need to test pending delete status since pending transfers will get cancelled upon
|
// NB: No need to test pending delete status since pending transfers will get cancelled upon
|
||||||
// entering pending delete phase. So it's already handled in that test case.
|
// entering pending delete phase. So it's already handled in that test case.
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSuccess_extra() throws Exception {
|
||||||
|
setupDomainWithPendingTransfer("extra");
|
||||||
|
clock.advanceOneMilli();
|
||||||
|
RegistryExtraFlowLogicProxy.setOverride("extra", TestExtraLogicManager.class);
|
||||||
|
thrown.expect(TestExtraLogicManagerSuccessException.class, "transfer cancelled");
|
||||||
|
doFailingTest("domain_transfer_cancel_extra.xml");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ import google.registry.model.contact.ContactAuthInfo;
|
||||||
import google.registry.model.domain.DomainAuthInfo;
|
import google.registry.model.domain.DomainAuthInfo;
|
||||||
import google.registry.model.domain.DomainResource;
|
import google.registry.model.domain.DomainResource;
|
||||||
import google.registry.model.domain.GracePeriod;
|
import google.registry.model.domain.GracePeriod;
|
||||||
|
import google.registry.model.domain.TestExtraLogicManager;
|
||||||
|
import google.registry.model.domain.TestExtraLogicManager.TestExtraLogicManagerSuccessException;
|
||||||
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
import google.registry.model.eppcommon.AuthInfo.PasswordAuth;
|
||||||
import google.registry.model.eppcommon.Trid;
|
import google.registry.model.eppcommon.Trid;
|
||||||
import google.registry.model.poll.PendingActionNotificationResponse;
|
import google.registry.model.poll.PendingActionNotificationResponse;
|
||||||
|
@ -259,4 +261,13 @@ public class DomainTransferRejectFlowTest
|
||||||
|
|
||||||
// NB: No need to test pending delete status since pending transfers will get cancelled upon
|
// NB: No need to test pending delete status since pending transfers will get cancelled upon
|
||||||
// entering pending delete phase. So it's already handled in that test case.
|
// entering pending delete phase. So it's already handled in that test case.
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSuccess_extra() throws Exception {
|
||||||
|
setupDomainWithPendingTransfer("extra");
|
||||||
|
clock.advanceOneMilli();
|
||||||
|
RegistryExtraFlowLogicProxy.setOverride("extra", TestExtraLogicManager.class);
|
||||||
|
thrown.expect(TestExtraLogicManagerSuccessException.class, "transfer rejected");
|
||||||
|
doFailingTest("domain_transfer_reject_extra.xml");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
11
javatests/google/registry/flows/domain/testdata/domain_transfer_approve_extra.xml
vendored
Normal file
11
javatests/google/registry/flows/domain/testdata/domain_transfer_approve_extra.xml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<command>
|
||||||
|
<transfer op="approve">
|
||||||
|
<domain:transfer
|
||||||
|
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||||
|
<domain:name>example.extra</domain:name>
|
||||||
|
</domain:transfer>
|
||||||
|
</transfer>
|
||||||
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
11
javatests/google/registry/flows/domain/testdata/domain_transfer_cancel_extra.xml
vendored
Normal file
11
javatests/google/registry/flows/domain/testdata/domain_transfer_cancel_extra.xml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<command>
|
||||||
|
<transfer op="cancel">
|
||||||
|
<domain:transfer
|
||||||
|
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||||
|
<domain:name>example.extra</domain:name>
|
||||||
|
</domain:transfer>
|
||||||
|
</transfer>
|
||||||
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
11
javatests/google/registry/flows/domain/testdata/domain_transfer_reject_extra.xml
vendored
Normal file
11
javatests/google/registry/flows/domain/testdata/domain_transfer_reject_extra.xml
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<command>
|
||||||
|
<transfer op="reject">
|
||||||
|
<domain:transfer
|
||||||
|
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||||
|
<domain:name>example.extra</domain:name>
|
||||||
|
</domain:transfer>
|
||||||
|
</transfer>
|
||||||
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
|
@ -254,9 +254,30 @@ public class TestExtraLogicManager implements RegistryExtraFlowLogic {
|
||||||
throw new TestExtraLogicManagerSuccessException("restored");
|
throw new TestExtraLogicManagerSuccessException("restored");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Performs additional tasks required for a transfer command. */
|
/** Performs additional tasks required for a transfer approve command. */
|
||||||
@Override
|
@Override
|
||||||
public void performAdditionalDomainTransferLogic(
|
public void performAdditionalDomainTransferApproveLogic(
|
||||||
|
DomainResource domain, String clientId, HistoryEntry historyEntry) throws EppException {
|
||||||
|
throw new TestExtraLogicManagerSuccessException("transfer approved");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Performs additional tasks required for a transfer cancel command. */
|
||||||
|
@Override
|
||||||
|
public void performAdditionalDomainTransferCancelLogic(
|
||||||
|
DomainResource domain, String clientId, HistoryEntry historyEntry) throws EppException {
|
||||||
|
throw new TestExtraLogicManagerSuccessException("transfer cancelled");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Performs additional tasks required for a transfer reject command. */
|
||||||
|
@Override
|
||||||
|
public void performAdditionalDomainTransferRejectLogic(
|
||||||
|
DomainResource domain, String clientId, HistoryEntry historyEntry) throws EppException {
|
||||||
|
throw new TestExtraLogicManagerSuccessException("transfer rejected");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Performs additional tasks required for a transfer request command. */
|
||||||
|
@Override
|
||||||
|
public void performAdditionalDomainTransferRequestLogic(
|
||||||
DomainResource domainResource,
|
DomainResource domainResource,
|
||||||
String clientId,
|
String clientId,
|
||||||
DateTime asOfDate,
|
DateTime asOfDate,
|
||||||
|
|
Loading…
Add table
Reference in a new issue