Exemplo n.º 1
0
 /// <summary>
 /// Purchase a label for this shipment with the given rate.
 /// </summary>
 /// <param name="rate">EasyPost.Rate object to puchase the shipment with.</param>
 public void Buy(Rate rate)
 {
     Buy(rate.id);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Purchase a label for this shipment with the given rate.
 /// </summary>
 /// <param name="rate">EasyPost.Rate object to puchase the shipment with.</param>
 public void Buy(Rate rate)
 {
     Buy(rate.carrier, rate.service);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Purchase a label for this shipment with the given rate.
 /// </summary>
 /// <param name="rate">EasyPost.Rate object to puchase the shipment with.</param>
 public void Buy(Rate rate)
 {
     Buy(rate.id);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Purchase a label for this shipment with the given rate.
 /// </summary>
 /// <param name="rate">EasyPost.Rate object to puchase the shipment with.</param>
 public void Buy(Rate rate)
 {
     Buy(rate.carrier, rate.service);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Purchase a label for this shipment with the given rate.
 /// </summary>
 /// <param name="rate">EasyPost.Rate object to puchase the shipment with.</param>
 /// <param name="insuranceValue">The value to insure the shipment for.</param>
 public void Buy(Rate rate, string insuranceValue = null)
 {
     Buy(rate.id, insuranceValue);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Purchase a label for this shipment with the given rate.
 /// </summary>
 /// <param name="rate">EasyPost.Rate object to puchase the shipment with.</param>
 /// <param name="insuranceValue">The value to insure the shipment for.</param>
 public void Buy(Client client, Rate rate, string insuranceValue = null)
 {
     Buy(client, rate.id, insuranceValue);
 }
Exemplo n.º 7
0
        public void TestLowestRate()
        {
            Rate lowestUSPS = new Rate() { rate = "1.0", carrier = "USPS", service = "ParcelSelect" };
            Rate highestUSPS = new Rate() { rate = "10.0", carrier = "USPS", service = "Priority" };
            Rate lowestUPS = new Rate() { rate = "2.0", carrier = "UPS", service = "ParcelSelect" };
            Rate highestUPS = new Rate() { rate = "20.0", carrier = "UPS", service = "Priority" };

            Shipment shipment = new Shipment() { rates = new List<Rate>() { highestUSPS, lowestUSPS, highestUPS, lowestUPS } };

            Rate rate = shipment.LowestRate();
            Assert.AreEqual(rate, lowestUSPS);

            rate = shipment.LowestRate(includeCarriers: new List<string>() { "UPS" });
            Assert.AreEqual(rate, lowestUPS);

            rate = shipment.LowestRate(includeServices: new List<string>() { "Priority" });
            Assert.AreEqual(rate, highestUSPS);

            rate = shipment.LowestRate(excludeCarriers: new List<string>() { "USPS" });
            Assert.AreEqual(rate, lowestUPS);

            rate = shipment.LowestRate(excludeServices: new List<string>() { "ParcelSelect" });
            Assert.AreEqual(rate, highestUSPS);

            rate = shipment.LowestRate(includeCarriers: new List<string>() { "FedEx" });
            Assert.IsNull(rate);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Purchase a label for this shipment with the given rate.
 /// </summary>
 /// <param name="rate">EasyPost.Rate object to puchase the shipment with.</param>
 public async Task BuyAsync(Rate rate) {
     await Task.Run(() => Buy(rate)).ConfigureAwait(false);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Purchase a label for this shipment with the given rate.
 /// </summary>
 /// <param name="rate">EasyPost.Rate object to puchase the shipment with.</param>
 public void Buy(Client client, Rate rate)
 {
     Buy(client, rate.carrier, rate.service);
 }