Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Add Surcharge model #580

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Next Release

- Fix pagination parameters for `GetNextPageOfChildren` function for User service
- Add `Surcharges` property to `Rate` class

## v6.7.0 (2024-07-24)

Expand Down
7 changes: 7 additions & 0 deletions EasyPost/Models/API/Beta/StatelessRate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using EasyPost._base;
using Newtonsoft.Json;

Expand Down Expand Up @@ -105,6 +106,12 @@ public class StatelessRate : EphemeralEasyPostObject
[JsonProperty("shipment_id")]
public string? ShipmentId { get; set; }

/// <summary>
/// The list of <see cref="Surcharge"/>s for this rate.
/// </summary>
[JsonProperty("surcharges")]
public List<Surcharge>? Surcharges { get; set; }

#endregion
}
}
8 changes: 7 additions & 1 deletion EasyPost/Models/API/Rate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using EasyPost._base;
using Newtonsoft.Json;

Expand Down Expand Up @@ -104,8 +105,13 @@ public class Rate : EasyPostObject
[JsonProperty("shipment_id")]
public string? ShipmentId { get; set; }

#endregion
/// <summary>
/// The list of <see cref="Surcharge"/>s for this rate.
/// </summary>
[JsonProperty("surcharges")]
public List<Surcharge>? Surcharges { get; set; }

#endregion
}
}
#pragma warning disable CA1724 // Naming conflicts with Parameters.Beta.Rate
45 changes: 45 additions & 0 deletions EasyPost/Models/API/Surcharge.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using EasyPost._base;
using Newtonsoft.Json;

namespace EasyPost.Models.API
{
/// <summary>
/// Class representing a surcharge for a <see cref="Rate"/> object.
/// </summary>
public class Surcharge : EphemeralEasyPostObject
{
#region JSON Properties

/// <summary>
/// The type of surcharge.
/// </summary>
[JsonProperty("type")]
public string? Type { get; set; }

/// <summary>
/// The amount of the surcharge.
/// </summary>
[JsonProperty("carrier")]
public string? Amount { get; set; }

/// <summary>
/// The list amount of the surcharge.
/// </summary>
[JsonProperty("list_amount")]
public string? ListAmount { get; set; }

/// <summary>
/// The retail amount of the surcharge.
/// </summary>
[JsonProperty("retail_amount")]
public string? RetailAmount { get; set; }

/// <summary>
/// The currency for the surcharge.
/// </summary>
[JsonProperty("currency")]
public string? Currency { get; set; }

#endregion
}
}
Loading