Skip to content

Commit

Permalink
Make parent on OrderItem expandable
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Feb 14, 2019
1 parent d93be8a commit ce817cd
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/Stripe.net/Entities/Orders/OrderItem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Stripe
{
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class OrderItem : StripeEntity, IHasObject
{
Expand All @@ -25,11 +26,31 @@ public class OrderItem : StripeEntity, IHasObject
[JsonProperty("description")]
public string Description { get; set; }

#region Expandable Parent

/// <summary>
/// The ID of the associated object for this line item.
/// ID of the parent associated with this order item.
/// </summary>
[JsonIgnore]
public string ParentId { get; set; }

[JsonIgnore]
public Sku Parent { get; set; }

[JsonProperty("parent")]
public string Parent { get; set; }
internal object InternalParent
{
get
{
return this.Parent ?? (object)this.ParentId;
}

set
{
StringOrObject<Sku>.Map(value, s => this.ParentId = s, o => this.Parent = o);
}
}
#endregion

/// <summary>
/// A positive integer representing the number of instances of parent that are included in this order item. Applicable/present only if type is sku.
Expand Down

0 comments on commit ce817cd

Please sign in to comment.