/// Calling the Authentication SDK to Generate Request Headers necessary for Authentication
        public void CallAuthenticationHeaders(string requestType, string requestTarget, string requestJsonData = null)
        {
            requestTarget = Uri.EscapeUriString(requestTarget);

            var merchantConfig = Configuration.MerchantConfigDictionaryObj != null
                ? new MerchantConfig(Configuration.MerchantConfigDictionaryObj)
                : new MerchantConfig();

            merchantConfig.RequestType     = requestType;
            merchantConfig.RequestTarget   = requestTarget;
            merchantConfig.RequestJsonData = requestJsonData;

            var authorize = new Authorize(merchantConfig);

            //these are the Request Headers to be sent along with the HTTP Request
            var authenticationHeaders = new Dictionary <string, string>();

            if (merchantConfig.IsJwtTokenAuthType)
            {
                //generate token and set JWT token headers
                var jwtToken = authorize.GetToken();
                authenticationHeaders.Add("Authorization", jwtToken.BearerToken);
            }
            else if (merchantConfig.IsHttpSignAuthType)
            {
                //generate signature and set HTTP Signature headers
                var httpSign = authorize.GetSignature();
                authenticationHeaders.Add("v-c-merchant-id", httpSign.MerchantId);
                authenticationHeaders.Add("Date", httpSign.GmtDateTime);
                authenticationHeaders.Add("Host", httpSign.HostName);
                authenticationHeaders.Add("Signature", httpSign.SignatureParam);

                if (merchantConfig.IsPostRequest || merchantConfig.IsPutRequest || merchantConfig.IsPatchRequest)
                {
                    authenticationHeaders.Add("Digest", httpSign.Digest);
                }
            }

            if (!string.IsNullOrEmpty(Configuration.ClientId))
            {
                authenticationHeaders.Add("v-c-client-id", Configuration.ClientId);
            }

            // if (!string.IsNullOrEmpty(Configuration.SolutionId))
            // {
            //     authenticationHeaders.Add("v-c-solution-id", Configuration.SolutionId);
            // }

            if (Configuration.Proxy == null && merchantConfig.UseProxy != null)
            {
                if (bool.Parse(merchantConfig.UseProxy))
                {
                    int proxyPortTest;

                    if (!string.IsNullOrWhiteSpace(merchantConfig.ProxyAddress) && int.TryParse(merchantConfig.ProxyPort, out proxyPortTest))
                    {
                        WebProxy proxy = new WebProxy(merchantConfig.ProxyAddress, proxyPortTest);

                        if (!string.IsNullOrWhiteSpace(merchantConfig.ProxyUsername) && !string.IsNullOrWhiteSpace(merchantConfig.ProxyPassword))
                        {
                            proxy.Credentials = new NetworkCredential(merchantConfig.ProxyUsername, merchantConfig.ProxyPassword);
                        }

                        Configuration.AddWebProxy(proxy);
                    }
                }
            }

            //Set the Configuration
            Configuration.DefaultHeader = authenticationHeaders;
            RestClient = new RestClient("https://" + merchantConfig.HostName);

            if (Configuration.Proxy != null)
            {
                RestClient.Proxy = Configuration.Proxy;
            }
        }
        /// Calling the Authentication SDK to Generate Request Headers necessary for Authentication
        public void CallAuthenticationHeaders(string requestType, string requestTarget, string requestJsonData = null)
        {
            requestTarget = Uri.EscapeUriString(requestTarget);

            var merchantConfig = Configuration.MerchantConfigDictionaryObj != null
                ? new MerchantConfig(Configuration.MerchantConfigDictionaryObj)
                : new MerchantConfig();

            merchantConfig.RequestType     = requestType;
            merchantConfig.RequestTarget   = requestTarget;
            merchantConfig.RequestJsonData = requestJsonData;

            var authorize = new Authorize(merchantConfig);

            //these are the Request Headers to be sent along with the HTTP Request
            var authenticationHeaders = new Dictionary <string, string>();

            if (merchantConfig.IsJwtTokenAuthType)
            {
                //generate token and set JWT token headers
                var jwtToken = authorize.GetToken();
                authenticationHeaders.Add("Authorization", jwtToken.BearerToken);
            }
            else if (merchantConfig.IsHttpSignAuthType)
            {
                //generate signature and set HTTP Signature headers
                var httpSign = authorize.GetSignature();
                authenticationHeaders.Add("v-c-merchant-id", httpSign.MerchantId);
                authenticationHeaders.Add("Date", httpSign.GmtDateTime);
                authenticationHeaders.Add("Host", httpSign.HostName);
                authenticationHeaders.Add("Signature", httpSign.SignatureParam);

                if (merchantConfig.IsPostRequest || merchantConfig.IsPutRequest || merchantConfig.IsPatchRequest)
                {
                    authenticationHeaders.Add("Digest", httpSign.Digest);
                }
            }

            // Pull WebProxy settings from configuration.
            if (Configuration.Proxy == null && !string.IsNullOrWhiteSpace(merchantConfig.ProxyAddress))
            {
                // TODO:  Suggest population of other WebProxy parameters:
                // ByPassArrayList, ByPassList, ByPassProxyOnLocal, Credentials, UseDefaultCredentials.
                // Requires update of AuthenticationSdk.core.MerchantConfig

                Uri proxyUri = new Uri(merchantConfig.ProxyAddress);
                var webProxy = new WebProxy(proxyUri);
                int port     = Convert.ToInt32(merchantConfig.ProxyPort);
                if (!string.IsNullOrWhiteSpace(merchantConfig.ProxyPort) &&
                    proxyUri.Port != port && port > 0)
                {
                    webProxy = new WebProxy(proxyUri.ToString(), port);
                }

                Configuration.AddWebProxy(webProxy);
            }

            //Set the Configuration
            Configuration.DefaultHeader = authenticationHeaders;
            RestClient = new RestClient("https://" + merchantConfig.HostName);

            if (Configuration.Proxy != null)
            {
                RestClient.Proxy = Configuration.Proxy;
            }
        }