Example #1
0
        private static RequestValidationResult CancelRequestByLocalConfig(
            string targetUrl, string queueitToken, CancelEventConfig cancelConfig,
            string customerId, string secretKey, Dictionary <string, string> debugEntries, bool isDebug)
        {
            targetUrl = GenerateTargetUrl(targetUrl);

            if (isDebug)
            {
                debugEntries["SdkVersion"]   = UserInQueueService.SDK_VERSION;
                debugEntries["Runtime"]      = GetRuntime();
                debugEntries["TargetUrl"]    = targetUrl;
                debugEntries["QueueitToken"] = queueitToken;
                debugEntries["CancelConfig"] = cancelConfig != null?cancelConfig.ToString() : "NULL";

                debugEntries["OriginalUrl"] = GetHttpContextProvider().HttpRequest.Url.AbsoluteUri;
                LogExtraRequestDetails(debugEntries);
            }
            if (string.IsNullOrEmpty(targetUrl))
            {
                throw new ArgumentException("targeturl can not be null or empty.");
            }
            if (string.IsNullOrEmpty(customerId))
            {
                throw new ArgumentException("customerId can not be null or empty.");
            }
            if (string.IsNullOrEmpty(secretKey))
            {
                throw new ArgumentException("secretKey can not be null or empty.");
            }
            if (cancelConfig == null)
            {
                throw new ArgumentException("cancelEventConfig can not be null.");
            }
            if (string.IsNullOrEmpty(cancelConfig.EventId))
            {
                throw new ArgumentException("EventId from cancelEventConfig can not be null or empty.");
            }
            if (string.IsNullOrEmpty(cancelConfig.QueueDomain))
            {
                throw new ArgumentException("QueueDomain from cancelEventConfig can not be null or empty.");
            }

            var userInQueueService = GetUserInQueueService();
            var result             = userInQueueService.ValidateCancelRequest(targetUrl, cancelConfig, customerId, secretKey);

            result.IsAjaxResult = IsQueueAjaxCall();
            return(result);
        }