Fix nits on flows:

Rename existingResource flows variable to be specific to EPP resource type and replace some explicit checks with helper methods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133774229
This commit is contained in:
cgoldfeder 2016-09-20 17:07:46 -07:00 committed by Ben McIlwain
parent df70da48a2
commit aed3c0f0d0
14 changed files with 125 additions and 156 deletions

View file

@ -31,6 +31,7 @@ import com.googlecode.objectify.Key;
import com.googlecode.objectify.Work;
import google.registry.flows.EppException.AuthorizationErrorException;
import google.registry.flows.EppException.InvalidAuthorizationInformationErrorException;
import google.registry.flows.exceptions.MissingTransferRequestAuthInfoException;
import google.registry.flows.exceptions.ResourceAlreadyExistsException;
import google.registry.flows.exceptions.ResourceStatusProhibitsOperationException;
import google.registry.flows.exceptions.ResourceToDeleteIsReferencedException;
@ -314,6 +315,15 @@ public class ResourceFlowUtils {
}
}
/** Check that the given AuthInfo is present and valid for a resource being transferred. */
public static void verifyRequiredAuthInfoForResourceTransfer(
Optional<AuthInfo> authInfo, ContactResource existingContact) throws EppException {
if (!authInfo.isPresent()) {
throw new MissingTransferRequestAuthInfoException();
}
verifyOptionalAuthInfoForResource(authInfo, existingContact);
}
/** Check that the given AuthInfo is valid for the given resource. */
public static void verifyAuthInfoForResource(AuthInfo authInfo, EppResource resource)
throws EppException {