public void Initialize() { Client.apiKey = "WzJHJ6SoPnBVYu0ae4aIHA"; address = new Address() { company = "Simpler Postage Inc", street1 = "164 Townsend Street", street2 = "Unit 1", city = "San Francisco", state = "CA", country = "US", zip = "94107", phone = "1234567890" }; toAddress = new Dictionary<string, object>() { {"company", "Simpler Postage Inc"}, {"street1", "164 Townsend Street"}, {"street2", "Unit 1"}, {"city", "San Francisco"}, {"state", "CA"}, {"country", "US"}, {"zip", "94107"}, }; fromAddress = new Dictionary<string, object>() { {"name", "Andrew Tribone"}, {"street1", "480 Fell St"}, {"street2", "#3"}, {"city", "San Francisco"}, {"state", "CA"}, {"country", "US"}, {"zip", "94102"} }; shipment = Shipment.Create(new Dictionary<string, object>() { {"parcel", new Dictionary<string, object>() {{"length", 8}, {"width", 6}, {"height", 5}, {"weight", 10}}}, {"to_address", toAddress}, {"from_address", fromAddress}, {"reference", "ShipmentRef"} }); shipment.Buy(shipment.LowestRate()); parameters = new Dictionary<string, object>() { {"is_account_address", false}, {"address", address}, {"shipment", shipment}, {"min_datetime", DateTime.Now}, {"max_datetime", DateTime.Now} }; }
public void Initialize() { Client.apiKey = "cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi"; address = new Address() { company = "Simpler Postage Inc", street1 = "164 Townsend Street", street2 = "Unit 1", city = "San Francisco", state = "CA", country = "US", zip = "94107" }; }
public void TestCreateWithVerifications() { Dictionary<string, object> parameters = new Dictionary<string, object>() { { "company", "Simpler Postage Inc" }, { "street1", "164 Townsend Street" }, { "street2", "Unit 1" }, { "city", "San Francisco" }, { "state", "CA" }, { "country", "US" }, { "zip", "94107" }, { "verifications", new List<string>() { "delivery", "zip4" } } }; Address address = Address.Create(parameters); Assert.IsNotNull(address.verifications.delivery); Assert.IsNotNull(address.verifications.zip4); parameters = new Dictionary<string, object>() { { "company", "Simpler Postage Inc" }, { "street1", "123 Fake Street" }, { "zip", "94107" }, { "verifications", new List<string>() { "delivery", "zip4" } } }; address = Address.Create(parameters); Assert.AreEqual(address.verifications.delivery.success, false); }
public void TestInstanceCreateWithVerifications() { Address address = new Address() { company = "Simpler Postage Inc", street1 = "164 Townsend Street", street2 = "Unit 1", city = "San Francisco", state = "CA", country = "US", zip = "94107", verify = new List<string>() { "delivery", "zip4" } }; address.Create(); Assert.IsNotNull(address.verifications.delivery); Assert.IsNotNull(address.verifications.zip4); }
public void TestInstanceCreateWithStrictVerifications() { address = new Address() { company = "Simpler Postage Inc" }; address.Create(strictVerifications: new List<string> { "delivery", "zip4" }); }
public AddValStatus getAddValStauts(ServiceRequest serviceRequest) { AddValStatus addValStatus = new AddValStatus(); if (serviceRequest.vacant == true) { string UPS = RunStreetLevelValidation(serviceRequest); if (UPS == "false") { addValStatus.status = "false"; return(addValStatus); } addValStatus.status = "true"; return(addValStatus); } EasyPost.ClientManager.SetCurrent("wGW1bI8SYpamubvkDKNkFw"); EasyPost.Address address = new EasyPost.Address() { company = "", street1 = serviceRequest.Address, street2 = "", city = serviceRequest.City, state = serviceRequest.State, country = "US", zip = serviceRequest.Zip, verify = new List <string>() { "delivery" } }; address.Create(); if (address.verifications.delivery.success) { addValStatus.status = "true"; return(addValStatus); } else if (address.verifications.delivery.errors.Count == 1 && address.verifications.delivery.errors[0].message == "Address not found") { string UPS = RunStreetLevelValidation(serviceRequest); if (UPS == "false") { addValStatus.status = "false"; return(addValStatus); } addValStatus.status = "true"; return(addValStatus); } else if (address.verifications.delivery.errors.Count > 0) { List <string> errorsList = new List <string>(); for (int i = 0; i < address.verifications.delivery.errors.Count; i++) { errorsList.Add(address.verifications.delivery.errors[i].message); } addValStatus.status = "errors"; addValStatus.errorList = errorsList; return(addValStatus); } else { addValStatus = null; return(addValStatus); } }