Example #1
0
        public void TestValidPhoneIdContactNoMatchParsing()
        {
            string json = this.LoadJsonFromFile("PhoneIdContactValidNoMatchResponse_AsSent.txt");

            PhoneIdContactResponse response = this.CreateParser().ParsePhoneIdContactResponse(json);

            Assert.AreEqual(response.ReferenceId, "013890689D26010BE1D4494700000010");
            Assert.AreEqual(response.ResourceUri, string.Empty);
            Assert.AreNotEqual(response.RawResponse, null);
            Assert.AreEqual(response.SubResource, "contact");

            Assert.AreEqual(response.Errors.Count, 1);
            Assert.AreEqual(response.Errors[0].Code, TeleSignErrorCode.ContactDataNotFound);
            Assert.AreEqual(response.Errors[0].Description, "PhoneID Contact Data Not Found");

            Assert.AreEqual(response.Status.UpdatedOn, DateTime.Parse("2012-07-16T15:29:34.508037Z").ToUniversalTime());
            Assert.AreEqual(response.Status.Code, TransactionStatusCode.Success);
            Assert.AreEqual(response.Status.Description, "Transaction successfully completed");

            Assert.AreEqual(response.OriginalNumber.CompletePhoneNumber, "13107409700");
            Assert.AreEqual(response.OriginalNumber.CountryCode, "1");
            Assert.AreEqual(response.OriginalNumber.PhoneNumber, "3107409700");

            Assert.AreEqual(response.CallCleansedNumber.CleanseCode, CleansingCode.NoChange);
            Assert.AreEqual(response.CallCleansedNumber.MaxLength, 10);
            Assert.AreEqual(response.CallCleansedNumber.MinLength, 10);
            Assert.AreEqual(response.CallCleansedNumber.CountryCode, "1");
            Assert.AreEqual(response.CallCleansedNumber.PhoneNumber, "3107409700");

            Assert.AreEqual(response.SmsCleansedNumber.CleanseCode, CleansingCode.NoChange);
            Assert.AreEqual(response.SmsCleansedNumber.MaxLength, 10);
            Assert.AreEqual(response.SmsCleansedNumber.MinLength, 10);
            Assert.AreEqual(response.SmsCleansedNumber.CountryCode, "1");
            Assert.AreEqual(response.SmsCleansedNumber.PhoneNumber, "3107409700");

            Assert.AreEqual(response.PhoneType.PhoneType, PhoneType.FixedLine);
            Assert.AreEqual(response.PhoneType.Description, "FIXED_LINE");

            Assert.AreEqual(response.Location.City, "Los Angeles");
            Assert.AreEqual(response.Location.State, "CA");
            Assert.AreEqual(response.Location.Zip, "90066");
            Assert.AreEqual(response.Location.MetroCode, "4480");
            Assert.AreEqual(response.Location.County, "Los Angeles");

            Assert.AreEqual(response.Location.Country.Name, "United States");
            Assert.AreEqual(response.Location.Country.Iso2, "US");
            Assert.AreEqual(response.Location.Country.Iso3, "USA");

            Assert.AreEqual(response.Location.Coordinates.Longitude, -118.42302);
            Assert.AreEqual(response.Location.Coordinates.Latitude, 33.99791);

            Assert.AreEqual(response.Location.TimeZoneRange.Name, "America/Los_Angeles");
            Assert.AreEqual(response.Location.TimeZoneRange.UtcOffsetMin, "-8");
            Assert.AreEqual(response.Location.TimeZoneRange.UtcOffsetMax, "-8");
        }
Example #2
0
        public static void PhoneIdContact(string[] args)
        {
            CheckArgument.ArrayLengthIs(args, 1, "args");
            string phoneNumber = args[0];

            PhoneIdService         service  = new PhoneIdService(GetConfiguration());
            PhoneIdContactResponse response = service.ContactLookup(phoneNumber);

            Console.WriteLine("Phone Number: {0}", phoneNumber);
            Console.WriteLine("Name        : {0}", response.Contact.FullName);
            Console.WriteLine("Address     :\r\n{0}", response.Contact.GetFullAddress());
        }
Example #3
0
        public static void MapContactLocation(string[] args)
        {
            CheckArgument.ArrayLengthIs(args, 1, "args");
            string phoneNumber = args[0];

            PhoneIdService         service  = new PhoneIdService(GetConfiguration());
            PhoneIdContactResponse response = service.ContactLookup(phoneNumber);

            string address = response.Contact.GetFullAddressOnSingleLine();

            Console.WriteLine("Google Mapping: {0}", address);

            string url = string.Format(
                "http://maps.google.com/maps?q={0}",
                address);

            Process.Start(url);
        }
Example #4
0
        public void TestValidPhoneIdContactMatchParsing()
        {
            string json = this.LoadJsonFromFile("PhoneIdContactValidMatchResponse_AsSent.txt");

            PhoneIdContactResponse response = this.CreateParser().ParsePhoneIdContactResponse(json);

            Assert.AreEqual(response.Errors.Count, 0);
            Assert.AreEqual(response.ReferenceId, "0138906A9011010BE1D4494B0000000E");
            Assert.AreEqual(response.ResourceUri, string.Empty);
            Assert.AreNotEqual(response.RawResponse, null);
            Assert.AreEqual(response.SubResource, "contact");

            Assert.AreEqual(response.Status.UpdatedOn, DateTime.Parse("2012-07-16T15:31:45.476050Z").ToUniversalTime());
            Assert.AreEqual(response.Status.Code, TransactionStatusCode.Success);
            Assert.AreEqual(response.Status.Description, "Transaction successfully completed");

            Assert.AreEqual(response.OriginalNumber.CompletePhoneNumber, "16502530000");
            Assert.AreEqual(response.OriginalNumber.CountryCode, "1");
            Assert.AreEqual(response.OriginalNumber.PhoneNumber, "6502530000");

            Assert.AreEqual(response.CallCleansedNumber.CleanseCode, CleansingCode.NoChange);
            Assert.AreEqual(response.CallCleansedNumber.MaxLength, 10);
            Assert.AreEqual(response.CallCleansedNumber.MinLength, 10);
            Assert.AreEqual(response.CallCleansedNumber.CountryCode, "1");
            Assert.AreEqual(response.CallCleansedNumber.PhoneNumber, "6502530000");

            Assert.AreEqual(response.SmsCleansedNumber.CleanseCode, CleansingCode.NoChange);
            Assert.AreEqual(response.SmsCleansedNumber.MaxLength, 10);
            Assert.AreEqual(response.SmsCleansedNumber.MinLength, 10);
            Assert.AreEqual(response.SmsCleansedNumber.CountryCode, "1");
            Assert.AreEqual(response.SmsCleansedNumber.PhoneNumber, "6502530000");

            Assert.AreEqual(response.PhoneType.PhoneType, PhoneType.FixedLine);
            Assert.AreEqual(response.PhoneType.Description, "FIXED_LINE");

            Assert.AreEqual(response.Location.City, "Mountain View");
            Assert.AreEqual(response.Location.State, "CA");
            Assert.AreEqual(response.Location.Zip, "94041");
            Assert.AreEqual(response.Location.MetroCode, "7400");
            Assert.AreEqual(response.Location.County, "Santa Clara");

            Assert.AreEqual(response.Location.Country.Name, "United States");
            Assert.AreEqual(response.Location.Country.Iso2, "US");
            Assert.AreEqual(response.Location.Country.Iso3, "USA");

            Assert.AreEqual(response.Location.Coordinates.Longitude, -122.079);
            Assert.AreEqual(response.Location.Coordinates.Latitude, 37.39199);

            Assert.AreEqual(response.Location.TimeZoneRange.Name, "America/Los_Angeles");
            Assert.AreEqual(response.Location.TimeZoneRange.UtcOffsetMin, "-8");
            Assert.AreEqual(response.Location.TimeZoneRange.UtcOffsetMax, "-8");

            Assert.AreEqual(response.Contact.FirstName, "GOOGLE INC");
            Assert.AreEqual(response.Contact.LastName, string.Empty);
            Assert.AreEqual(response.Contact.AddressLines.Count, 1);
            Assert.AreEqual(response.Contact.AddressLines[0], "1600 AMPHITHEATRE PKWY");
            Assert.AreEqual(response.Contact.Address, "1600 AMPHITHEATRE PKWY");
            Assert.AreEqual(response.Contact.City, "MOUNTAIN VIEW");
            Assert.AreEqual(response.Contact.StateProvince, "CA");
            Assert.AreEqual(response.Contact.Country, "US");
            Assert.AreEqual(response.Contact.ZipPostalCode, "940431351");
        }