Ejemplo n.º 1
0
        public static int DoAuthorizationCancel(IServiceClient serviceClient, string authorizationRequestId)
        {
            int returnValue = 0;

            try
            {
                serviceClient.CancelAuthorizationRequest(authorizationRequestId);
                Console.WriteLine($"Authorization request {authorizationRequestId} was canceled.");
            }
            catch (EntityNotFound)
            {
                Console.WriteLine($"Cannot cancel authorization request {authorizationRequestId} as it cannot be found.");
                returnValue = 1;
            }
            catch (AuthorizationRequestCanceled)
            {
                Console.WriteLine($"Cannot cancel authorization request {authorizationRequestId} as it was already canceled.");
                returnValue = 1;
            }
            catch (AuthorizationResponseExists)
            {
                Console.WriteLine($"Cannot cancel authorization request {authorizationRequestId} as it has already been completed.");
                returnValue = 1;
            }
            return(returnValue);
        }