コード例 #1
0
        static void Main(string[] args)
        {
            string customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890";
            string apiKey     = "EXAMPLETE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";

            string externalId = "external_id";

            try
            {
                AppVerifyClient             appVerifyClient  = new AppVerifyClient(customerId, apiKey);
                RestClient.TelesignResponse telesignResponse = appVerifyClient.Status(externalId);

                if (telesignResponse.OK)
                {
                    Console.WriteLine(string.Format("AppVerify transaction with external_id {0} has status code {1} and status description {2}.",
                                                    externalId,
                                                    telesignResponse.Json["status"]["code"],
                                                    telesignResponse.Json["status"]["description"]));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            Console.WriteLine("Press any key to quit.");
            Console.ReadKey();
        }
コード例 #2
0
        public async Task TestAppVerifyClientStatusAsync()
        {
            var client = new AppVerifyClient(this.customerId,
                                             this.apiKey,
                                             string.Format("http://localhost:{0}", this.mockServer.Port));

            var externalId = new Guid().ToString();

            this.mockServer.AddRequestHandler(new MockHttpHandler($"/v1/mobile/verification/status/{externalId}", "GET", handlerLambda));

            await client.StatusAsync(externalId);

            Assert.AreEqual("GET", this.requests.Last().HttpMethod, "method is not as expected");
            Assert.AreEqual($"/v1/mobile/verification/status/{externalId}", this.requests.Last().RawUrl, "path is not as expected");
            Assert.IsNull(this.requestHeaders.Last()["Content-Type"]);
            Assert.AreEqual("HMAC-SHA256", this.requestHeaders.Last()["x-ts-auth-method"],
                            "x-ts-auth-method header is not as expected");

            Guid dummyGuid;

            Assert.IsTrue(Guid.TryParse(this.requestHeaders.Last()["x-ts-nonce"], out dummyGuid),
                          "x-ts-nonce header is not a valid UUID");

            DateTime dummyDateTime;

            Assert.IsTrue(DateTime.TryParse(this.requestHeaders.Last()["Date"], out dummyDateTime),
                          "Date header is not valid rfc2616 format");

            Assert.IsNotNull(this.requestHeaders.Last()["Authorization"]);
        }
コード例 #3
0
 public void TestAppVerifyClientConstructors()
 {
     var appVerifyClient = new AppVerifyClient(this.customerId, this.apiKey);
 }