Skip to content

Commit

Permalink
[bug] Fix bad JSON property for estimated delivery date (#506)
Browse files Browse the repository at this point in the history
- Fix bad JSON property for estimated delivery date
- Update unit tests to verify correct JSON deserialization of time in transit data
  • Loading branch information
nwithan8 authored Aug 17, 2023
1 parent 9b25c14 commit eb55628
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
9 changes: 7 additions & 2 deletions EasyPost.Tests/ServicesTests/ShipmentServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ public async Task TestAllParameterHandOff()
const bool includeChildren = true;
const bool purchased = false;

Dictionary<string, object> filters = new Dictionary<string, object> {
Dictionary<string, object> filters = new Dictionary<string, object>
{
{ "include_children", includeChildren },
{ "purchased", purchased },
};
Expand Down Expand Up @@ -208,7 +209,8 @@ public async Task TestGetNextPageParameterHandOff()
const bool includeChildren = true;
const bool purchased = false;

Dictionary<string, object> filters = new Dictionary<string, object> {
Dictionary<string, object> filters = new Dictionary<string, object>
{
{ "include_children", includeChildren },
{ "purchased", purchased },
};
Expand Down Expand Up @@ -598,6 +600,9 @@ public async Task TestRetrieveEstimatedDeliveryDates()
foreach (var rate in ratesWithEstimatedDeliveryDates)
{
Assert.NotNull(rate.EasyPostTimeInTransitData);
Assert.NotNull(rate.EasyPostTimeInTransitData.EasyPostEstimatedDeliveryDate);
Assert.NotNull(rate.EasyPostTimeInTransitData.DaysInTransit);
Assert.NotNull(rate.EasyPostTimeInTransitData.PlannedShipDate);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ public async Task TestRetrieveEstimatedDeliveryDates()
foreach (var rate in ratesWithEstimatedDeliveryDates)
{
Assert.NotNull(rate.EasyPostTimeInTransitData);
Assert.NotNull(rate.EasyPostTimeInTransitData.EasyPostEstimatedDeliveryDate);
Assert.NotNull(rate.EasyPostTimeInTransitData.DaysInTransit);
Assert.NotNull(rate.EasyPostTimeInTransitData.PlannedShipDate);
}
}

Expand Down
6 changes: 2 additions & 4 deletions EasyPost/Models/API/RateWithEstimatedDeliveryDate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class RateWithEstimatedDeliveryDate
public TimeInTransitDetails? EasyPostTimeInTransitData { get; set; }

#endregion

}

/// <summary>
Expand All @@ -42,8 +41,8 @@ public class TimeInTransitDetails
/// <summary>
/// EasyPost's estimated delivery date for the associated <see cref="RateWithEstimatedDeliveryDate"/>.
/// </summary>
[JsonProperty("easypost_time_in_transit_data")]
public string? EasyPostEstimatedDeliveryDate { get; set; }
[JsonProperty("easypost_estimated_delivery_date")]
public DateTime? EasyPostEstimatedDeliveryDate { get; set; }

/// <summary>
/// The planned departure date for the shipment.
Expand All @@ -52,6 +51,5 @@ public class TimeInTransitDetails
public DateTime? PlannedShipDate { get; set; }

#endregion

}
}

0 comments on commit eb55628

Please sign in to comment.