Пример #1
0
        public static RequestParameter ToRequestParameter(this RequestHeaders requestHeaders)
        {
            var accessTokenHeaderValue    = requestHeaders.FirstValue(SecurePayMasterPassToken);
            var checkoutUrlHeaderValue    = requestHeaders.FirstValue(SecurePayMasterPassCheckOutUrl);
            var consumerKeyHeaderValue    = requestHeaders.FirstValue(SecurePayMasterPassConsumerKey);
            var certThumbprintHeaderValue = requestHeaders.FirstValue(SecurePayMasterPassCertThumbprint);

            var sdk = new MasterPassOAuthSdk(consumerKeyHeaderValue, certThumbprintHeaderValue);
            var authorizationHeader = sdk.CreateAuthorizationHeader(checkoutUrlHeaderValue, accessTokenHeaderValue);

            var requestParameters = new RequestParameter()
            {
                Id      = MasterPassServiceId,
                Headers = new Dictionary <string, string>
                {
                    { AuthorizationHeaderKey, authorizationHeader },
                    { "x-secure-pay-url", checkoutUrlHeaderValue },
                    { "content-type", "application/xml" }
                },
                HttpMethod = HttpMethod.Get.Method
            };

            return(requestParameters);
        }