Пример #1
0
        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}
            };
        }
Пример #2
0
 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"
     };
 }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
 public void TestInstanceCreateWithStrictVerifications()
 {
     address = new Address() {
         company = "Simpler Postage Inc"
     };
     address.Create(strictVerifications: new List<string> { "delivery", "zip4" });
 }