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

Make parent on OrderItem expandable #1516

Merged
merged 1 commit into from
Feb 14, 2019
Merged
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
15 changes: 13 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<OrderItem>, IHasObject
{
Expand All @@ -25,11 +26,21 @@ public class OrderItem : StripeEntity<OrderItem>, 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 => this.InternalParent.Id;

[JsonIgnore]
public Sku Parent => this.InternalParent.ExpandedObject;

[JsonProperty("parent")]
public string Parent { get; set; }
[JsonConverter(typeof(ExpandableFieldConverter<Sku>))]
internal ExpandableField<Sku> InternalParent { get; set; }
#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