mirror of
https://github.com/google/nomulus.git
synced 2025-07-01 08:43:34 +02:00
[]
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133597433
This commit is contained in:
parent
c30c5bc399
commit
0518f63aad
5 changed files with 76 additions and 40 deletions
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.flows.contact;
|
||||
|
||||
import static google.registry.flows.ResourceFlowUtils.denyPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||
import static google.registry.flows.contact.ContactFlowUtils.createLosingTransferPollMessage;
|
||||
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
|
||||
|
@ -38,6 +39,7 @@ import google.registry.model.eppinput.ResourceCommand;
|
|||
import google.registry.model.eppoutput.EppOutput;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.transfer.TransferData;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -71,15 +73,15 @@ public class ContactTransferCancelFlow extends LoggedInFlow implements Transacti
|
|||
throw new ResourceToMutateDoesNotExistException(ContactResource.class, targetId);
|
||||
}
|
||||
verifyOptionalAuthInfoForResource(authInfo, existingResource);
|
||||
if (existingResource.getTransferData().getTransferStatus() != TransferStatus.PENDING) {
|
||||
TransferData transferData = existingResource.getTransferData();
|
||||
if (transferData.getTransferStatus() != TransferStatus.PENDING) {
|
||||
throw new NotPendingTransferException(targetId);
|
||||
}
|
||||
if (!clientId.equals(existingResource.getTransferData().getGainingClientId())) {
|
||||
if (!clientId.equals(transferData.getGainingClientId())) {
|
||||
throw new NotTransferInitiatorException();
|
||||
}
|
||||
ContactResource newResource = existingResource.asBuilder()
|
||||
.clearPendingTransfer(TransferStatus.CLIENT_CANCELLED, now)
|
||||
.build();
|
||||
ContactResource newResource =
|
||||
denyPendingTransfer(existingResource, TransferStatus.CLIENT_CANCELLED, now);
|
||||
HistoryEntry historyEntry = historyBuilder
|
||||
.setType(HistoryEntry.Type.CONTACT_TRANSFER_CANCEL)
|
||||
.setModificationTime(now)
|
||||
|
@ -91,7 +93,7 @@ public class ContactTransferCancelFlow extends LoggedInFlow implements Transacti
|
|||
ofy().save().<Object>entities(newResource, historyEntry, losingPollMessage);
|
||||
// Delete the billing event and poll messages that were written in case the transfer would have
|
||||
// been implicitly server approved.
|
||||
ofy().delete().keys(existingResource.getTransferData().getServerApproveEntities());
|
||||
ofy().delete().keys(transferData.getServerApproveEntities());
|
||||
return createOutput(SUCCESS, createTransferResponse(targetId, newResource.getTransferData()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue