Пример #1
0
        static void Main(string[] args)
        {
            string customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890";
            string apiKey     = "EXAMPLETE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";

            string phoneNumber = "phone_number";
            string verifyCode  = "12345";
            string ttsMessage  = string.Format("Hello, your code is {0}. Once again, your code is {1}. Goodbye.", verifyCode, verifyCode);

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("tts_message", ttsMessage);

            try
            {
                VerifyClient verifyClient = new VerifyClient(customerId, apiKey);
                RestClient.TelesignResponse telesignResponse = verifyClient.Voice(phoneNumber, parameters);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.WriteLine("Press any key to quit.");
            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            string customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890";
            string apiKey     = "EXAMPLETE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";

            string phoneNumber = "phone_number";
            string language    = "fr-FR";
            string ttsMessage  = "Votre code de vérification Widgets 'n' More est $$CODE$$.";

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("language", language);
            parameters.Add("tts_message", ttsMessage);

            try
            {
                VerifyClient verifyClient = new VerifyClient(customerId, apiKey);
                RestClient.TelesignResponse telesignResponse = verifyClient.Voice(phoneNumber, parameters);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.WriteLine("Press any key to quit.");
            Console.ReadKey();
        }
Пример #3
0
        public static void Main(string[] args)
        {
            string customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890";
            string apiKey     = "EXAMPLETE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";

            string phoneNumber = "phone_number";
            string verifyCode  = "12345";

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("verify_code", verifyCode);

            try
            {
                VerifyClient verifyClient = new VerifyClient(customerId, apiKey);
                RestClient.TelesignResponse telesignResponse = verifyClient.Sms(phoneNumber, parameters);

                string referenceId = telesignResponse.Json["reference_id"].ToString();

                Console.WriteLine("Please enter your verification code:");
                string code = Console.ReadLine().Trim();

                if (verifyCode == code)
                {
                    Console.WriteLine("Your code is correct.");

                    telesignResponse = verifyClient.Completion(referenceId);

                    if (telesignResponse.OK && telesignResponse.Json["status"]["code"].ToString() == "1900")
                    {
                        Console.WriteLine("Completion successfully reported.");
                    }
                    else
                    {
                        Console.WriteLine("Error reporting completion.");
                    }
                }
                else
                {
                    Console.WriteLine("Your code is incorrect.");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.WriteLine("Press any key to quit.");
            Console.ReadKey();
        }
Пример #4
0
        static void Main(string[] args)
        {
            string customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890";
            string apiKey     = "EXAMPLETE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";

            string phoneNumber = "phone_number";
            string verifyCode  = "12345";

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("verify_code", verifyCode);

            try
            {
                VerifyClient verifyClient = new VerifyClient(customerId, apiKey);
                RestClient.TelesignResponse telesignResponse = verifyClient.Voice(phoneNumber, parameters);

                Console.WriteLine("Please enter your verification code:");
                string code = Console.ReadLine().Trim();

                if (verifyCode == code)
                {
                    Console.WriteLine("Your code is correct.");
                }
                else
                {
                    Console.WriteLine("Your code is incorrect.");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.WriteLine("Press any key to quit.");
            Console.ReadKey();
        }
Пример #5
0
 public VerifyClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(VerifyClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Пример #6
0
 public VerifyClient(EndpointConfiguration endpointConfiguration) :
     base(VerifyClient.GetBindingForEndpoint(endpointConfiguration), VerifyClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Пример #7
0
 public VerifyClient() :
     base(VerifyClient.GetDefaultBinding(), VerifyClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.verify_cfm.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Пример #8
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(VerifyClient.GetEndpointAddress(EndpointConfiguration.verify_cfm));
 }
Пример #9
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(VerifyClient.GetBindingForEndpoint(EndpointConfiguration.verify_cfm));
 }