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 PaymentIntent expandable on Invoice to fix deserialization issues #1580

Merged
merged 1 commit into from
Apr 15, 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
25 changes: 24 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,37 @@ internal object InternalDefaultSource
[JsonProperty("paid")]
public bool Paid { 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