Skip to content

Commit

Permalink
Make PaymentIntent expandable on Invoice to fix deserialization issues
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Apr 15, 2019
1 parent 7ee3f88 commit 0a80a05
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/Stripe.net/Entities/Invoices/Invoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,39 @@ internal object InternalDefaultSource
[JsonProperty("paid")]
public bool Paid { get; set; }

[JsonProperty("payment_intent")]
public PaymentIntent PaymentIntent { get; set; }

#region Expandable PaymentIntent
/// <summary>
/// ID of the PaymentIntent associated with this invoice.
/// </summary>
[JsonIgnore]
public string PaymentIntentId { get; set; }

/// <summary>
/// The PaymentIntent associated with this invoice. The PaymentIntent is generated when the
/// invoice is finalized, and can then be used to pay the invoice. Note that voiding an
/// invoice will cancel the PaymentIntent.
/// </summary>
[JsonProperty("payment_intent")]
[JsonIgnore]
public PaymentIntent PaymentIntent { get; set; }

[JsonProperty("payment_intent")]
internal object InternalPaymentIntent
{
get
{
return this.PaymentIntent ?? (object)this.PaymentIntentId;
}

set
{
StringOrObject<PaymentIntent>.Map(value, s => this.PaymentIntentId = s, o => this.PaymentIntent = o);
}
}
#endregion

[JsonProperty("period_end")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime PeriodEnd { get; set; }
Expand Down

0 comments on commit 0a80a05

Please sign in to comment.