public static FlexV1KeysPost200Response Run()
        {
            string encryptionType = "None";
            string targetOrigin   = "https://www.test.com";
            var    requestObj     = new GeneratePublicKeyRequest(
                EncryptionType: encryptionType,
                TargetOrigin: targetOrigin
                );

            string format = "legacy";

            try
            {
                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);

                var apiInstance = new KeyGenerationApi(clientConfig);
                FlexV1KeysPost200Response result = apiInstance.GeneratePublicKey(format, requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Esempio n. 2
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new GeneratePublicKeyRequest
            {
                EncryptionType = "None"
            };

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/flex/v1/keys",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new KeyGenerationApi(configurationSwagger);
                var result = apiInstance.GeneratePublicKey(requestObj);
                generateKeyResult = result;
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Esempio n. 3
0
        public ActionResult Checkout()
        {
            // Call the .NET CyberSource SDK to generate the Flex Key

            ViewBag.Jwk = "{\"kid\":\"HKJHKJ\"}";

            var requestObj = new GeneratePublicKeyRequest("RsaOaep256", "http://*****:*****@"\", "");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }

            return(View());
        }
Esempio n. 4
0
        public static FlexV1KeysPost200Response Run()
        {
            var requestObj = new GeneratePublicKeyRequest("None");

            try
            {
                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
                var apiInstance      = new KeyGenerationApi(clientConfig);

                var result = apiInstance.GeneratePublicKey(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
                return(null);
            }
        }
Esempio n. 5
0
        public ActionResult Checkout()
        {
            // Call the .NET CyberSource SDK to generate the Flex Key

            ViewBag.Jwk = "{\"kid\":\"HKJHKJ\"}";



            /**
             * Generating Capture Context Request Payload
             * Defining Encryption Type = RsaOaep
             * Defining TargetOrigin = http://localhost:65309
             *
             */
            var requestObj = new GeneratePublicKeyRequest("RsaOaep256", "http://localhost:65309");

            try
            {
                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
                var apiInstance      = new KeyGenerationApi(clientConfig);

                /**
                 * Initiating public Key request
                 * query paramiter set to format=JWT for Flex 11
                 */
                var result = apiInstance.GeneratePublicKey(requestObj, "JWT");
                Console.WriteLine(result);
                Console.WriteLine(result.KeyId);
                ViewBag.Jwk = result.KeyId;
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }

            return(View());
        }