diff --git a/src/Stripe.net/Entities/Accounts/Account.cs b/src/Stripe.net/Entities/Accounts/Account.cs
index e7668fa3b3..928cd77e07 100644
--- a/src/Stripe.net/Entities/Accounts/Account.cs
+++ b/src/Stripe.net/Entities/Accounts/Account.cs
@@ -19,6 +19,7 @@ public class Account : StripeEntity, IHasId, IHasMetadata, IHasObject, IPaymentS
/// (ID of a ) A logo for this account (at least 128px x 128px).
/// Expandable.
///
+ [JsonIgnore]
public string BusinessLogoId { get; set; }
///
@@ -30,6 +31,11 @@ public class Account : StripeEntity, IHasId, IHasMetadata, IHasObject, IPaymentS
[JsonProperty("business_logo")]
internal object InternalBusinessLogo
{
+ get
+ {
+ return this.BusinessLogo ?? (object)this.BusinessLogoId;
+ }
+
set
{
StringOrObject.Map(value, s => this.BusinessLogoId = s, o => this.BusinessLogo = o);
@@ -68,7 +74,7 @@ internal object InternalBusinessLogo
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("details_submitted")]
diff --git a/src/Stripe.net/Entities/Accounts/LegalEntityVerification.cs b/src/Stripe.net/Entities/Accounts/LegalEntityVerification.cs
index f3247bea31..1bcc7c999e 100644
--- a/src/Stripe.net/Entities/Accounts/LegalEntityVerification.cs
+++ b/src/Stripe.net/Entities/Accounts/LegalEntityVerification.cs
@@ -18,6 +18,7 @@ public class LegalEntityVerification : StripeEntity
/// document, either a passport or local ID card.
/// Expandable.
///
+ [JsonIgnore]
public string DocumentId { get; set; }
///
@@ -30,6 +31,11 @@ public class LegalEntityVerification : StripeEntity
[JsonProperty("document")]
internal object InternalDocument
{
+ get
+ {
+ return this.Document ?? (object)this.DocumentId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DocumentId = s, o => this.Document = o);
@@ -44,6 +50,7 @@ internal object InternalDocument
/// document, either a passport or local ID card.
/// Expandable.
///
+ [JsonIgnore]
public string DocumentBackId { get; set; }
///
@@ -56,6 +63,11 @@ internal object InternalDocument
[JsonProperty("document_back")]
internal object InternalDocumentBack
{
+ get
+ {
+ return this.DocumentBack ?? (object)this.DocumentBackId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DocumentBackId = s, o => this.DocumentBack = o);
diff --git a/src/Stripe.net/Entities/ApplePayDomains/ApplePayDomain.cs b/src/Stripe.net/Entities/ApplePayDomains/ApplePayDomain.cs
index acd46ffe89..32beaf7efc 100644
--- a/src/Stripe.net/Entities/ApplePayDomains/ApplePayDomain.cs
+++ b/src/Stripe.net/Entities/ApplePayDomains/ApplePayDomain.cs
@@ -19,7 +19,7 @@ public class ApplePayDomain : StripeEntity, IHasId, IHasObject
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("domain_name")]
diff --git a/src/Stripe.net/Entities/ApplicationFeeRefunds/ApplicationFeeRefund.cs b/src/Stripe.net/Entities/ApplicationFeeRefunds/ApplicationFeeRefund.cs
index 5bfeafe09a..544f7b991e 100644
--- a/src/Stripe.net/Entities/ApplicationFeeRefunds/ApplicationFeeRefund.cs
+++ b/src/Stripe.net/Entities/ApplicationFeeRefunds/ApplicationFeeRefund.cs
@@ -17,6 +17,7 @@ public class ApplicationFeeRefund : StripeEntity, IHasId, IHasMetadata, IHasObje
public long Amount { get; set; }
#region Expandable Balance Transaction
+ [JsonIgnore]
public string BalanceTransactionId { get; set; }
[JsonIgnore]
@@ -25,6 +26,11 @@ public class ApplicationFeeRefund : StripeEntity, IHasId, IHasMetadata, IHasObje
[JsonProperty("balance_transaction")]
internal object InternalBalanceTransaction
{
+ get
+ {
+ return this.BalanceTransaction ?? (object)this.BalanceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.BalanceTransactionId = s, o => this.BalanceTransaction = o);
@@ -40,6 +46,7 @@ internal object InternalBalanceTransaction
public string Currency { get; set; }
#region Expandable Fee
+ [JsonIgnore]
public string FeeId { get; set; }
[JsonIgnore]
@@ -48,6 +55,11 @@ internal object InternalBalanceTransaction
[JsonProperty("fee")]
internal object InternalFee
{
+ get
+ {
+ return this.Fee ?? (object)this.FeeId;
+ }
+
set
{
StringOrObject.Map(value, s => this.FeeId = s, o => this.Fee = o);
diff --git a/src/Stripe.net/Entities/ApplicationFees/ApplicationFee.cs b/src/Stripe.net/Entities/ApplicationFees/ApplicationFee.cs
index b95c731592..994232414a 100644
--- a/src/Stripe.net/Entities/ApplicationFees/ApplicationFee.cs
+++ b/src/Stripe.net/Entities/ApplicationFees/ApplicationFee.cs
@@ -13,6 +13,7 @@ public class ApplicationFee : StripeEntity, IHasId, IHasObject, IBalanceTransact
public string Object { get; set; }
#region Expandable Account
+ [JsonIgnore]
public string AccountId { get; set; }
[JsonIgnore]
@@ -21,6 +22,11 @@ public class ApplicationFee : StripeEntity, IHasId, IHasObject, IBalanceTransact
[JsonProperty("account")]
internal object InternalAccount
{
+ get
+ {
+ return this.Account ?? (object)this.AccountId;
+ }
+
set
{
StringOrObject.Map(value, s => this.AccountId = s, o => this.Account = o);
@@ -35,6 +41,7 @@ internal object InternalAccount
public long AmountRefunded { get; set; }
#region Expandable Application
+ [JsonIgnore]
public string ApplicationId { get; set; }
[JsonIgnore]
@@ -43,6 +50,11 @@ internal object InternalAccount
[JsonProperty("application")]
internal object InternalApplication
{
+ get
+ {
+ return this.Application ?? (object)this.ApplicationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ApplicationId = s, o => this.Application = o);
@@ -51,6 +63,7 @@ internal object InternalApplication
#endregion
#region Expandable Balance Transaction
+ [JsonIgnore]
public string BalanceTransactionId { get; set; }
[JsonIgnore]
@@ -59,6 +72,11 @@ internal object InternalApplication
[JsonProperty("balance_transaction")]
internal object InternalBalanceTransaction
{
+ get
+ {
+ return this.BalanceTransaction ?? (object)this.BalanceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.BalanceTransactionId = s, o => this.BalanceTransaction = o);
@@ -67,6 +85,7 @@ internal object InternalBalanceTransaction
#endregion
#region Expandable Charge
+ [JsonIgnore]
public string ChargeId { get; set; }
[JsonIgnore]
@@ -75,6 +94,11 @@ internal object InternalBalanceTransaction
[JsonProperty("charge")]
internal object InternalCharge
{
+ get
+ {
+ return this.Charge ?? (object)this.ChargeId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ChargeId = s, o => this.Charge = o);
@@ -93,6 +117,7 @@ internal object InternalCharge
public bool Livemode { get; set; }
#region Expandable Originating Transaction
+ [JsonIgnore]
public string OriginatingTransactionId { get; set; }
[JsonIgnore]
@@ -101,6 +126,11 @@ internal object InternalCharge
[JsonProperty("originating_transaction")]
internal object InternalOriginatingTransaction
{
+ get
+ {
+ return this.OriginatingTransaction ?? (object)this.OriginatingTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.OriginatingTransactionId = s, o => this.OriginatingTransaction = o);
diff --git a/src/Stripe.net/Entities/BalanceTransactions/BalanceTransaction.cs b/src/Stripe.net/Entities/BalanceTransactions/BalanceTransaction.cs
index b473e1a1cc..9b043385fd 100644
--- a/src/Stripe.net/Entities/BalanceTransactions/BalanceTransaction.cs
+++ b/src/Stripe.net/Entities/BalanceTransactions/BalanceTransaction.cs
@@ -43,6 +43,7 @@ public class BalanceTransaction : StripeEntity, IHasId, IHasObject
public long Net { get; set; }
#region Expandable Source
+ [JsonIgnore]
public string SourceId { get; set; }
[JsonIgnore]
@@ -51,6 +52,11 @@ public class BalanceTransaction : StripeEntity, IHasId, IHasObject
[JsonProperty("source")]
internal object InternalSource
{
+ get
+ {
+ return this.Source ?? (object)this.SourceId;
+ }
+
set
{
StringOrObject.Map(value, s => this.SourceId = s, o => this.Source = o);
diff --git a/src/Stripe.net/Entities/BankAccounts/BankAccount.cs b/src/Stripe.net/Entities/BankAccounts/BankAccount.cs
index 08245033cc..58e880f080 100644
--- a/src/Stripe.net/Entities/BankAccounts/BankAccount.cs
+++ b/src/Stripe.net/Entities/BankAccounts/BankAccount.cs
@@ -14,6 +14,7 @@ public class BankAccount : StripeEntity, IHasId, IHasMetadata, IHasObject, IExte
public string Object { get; set; }
#region Expandable Account
+ [JsonIgnore]
public string AccountId { get; set; }
[JsonIgnore]
@@ -22,6 +23,11 @@ public class BankAccount : StripeEntity, IHasId, IHasMetadata, IHasObject, IExte
[JsonProperty("account")]
internal object InternalAccount
{
+ get
+ {
+ return this.Account ?? (object)this.AccountId;
+ }
+
set
{
StringOrObject.Map(value, s => this.AccountId = s, o => this.Account = o);
@@ -45,6 +51,7 @@ internal object InternalAccount
public string Currency { get; set; }
#region Expandable Customer
+ [JsonIgnore]
public string CustomerId { get; set; }
[JsonIgnore]
@@ -53,6 +60,11 @@ internal object InternalAccount
[JsonProperty("customer")]
internal object InternalCustomer
{
+ get
+ {
+ return this.Customer ?? (object)this.CustomerId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CustomerId = s, o => this.Customer = o);
@@ -66,7 +78,7 @@ internal object InternalCustomer
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("fingerprint")]
diff --git a/src/Stripe.net/Entities/Cards/Card.cs b/src/Stripe.net/Entities/Cards/Card.cs
index c17aec2686..f0a85814c2 100644
--- a/src/Stripe.net/Entities/Cards/Card.cs
+++ b/src/Stripe.net/Entities/Cards/Card.cs
@@ -13,6 +13,7 @@ public class Card : StripeEntity, IHasId, IHasMetadata, IHasObject, IExternalAcc
public string Object { get; set; }
#region Expandable Account
+ [JsonIgnore]
public string AccountId { get; set; }
[JsonIgnore]
@@ -21,6 +22,11 @@ public class Card : StripeEntity, IHasId, IHasMetadata, IHasObject, IExternalAcc
[JsonProperty("account")]
internal object InternalAccount
{
+ get
+ {
+ return this.Account ?? (object)this.AccountId;
+ }
+
set
{
StringOrObject.Map(value, s => this.AccountId = s, o => this.Account = o);
@@ -65,6 +71,7 @@ internal object InternalAccount
public string Currency { get; set; }
#region Expandable Customer
+ [JsonIgnore]
public string CustomerId { get; set; }
[JsonIgnore]
@@ -73,6 +80,11 @@ internal object InternalAccount
[JsonProperty("customer")]
internal object InternalCustomer
{
+ get
+ {
+ return this.Customer ?? (object)this.CustomerId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CustomerId = s, o => this.Customer = o);
@@ -89,7 +101,7 @@ internal object InternalCustomer
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("dynamic_last4")]
@@ -117,6 +129,7 @@ internal object InternalCustomer
public string Name { get; set; }
#region Expandable Recipient
+ [JsonIgnore]
public string RecipientId { get; set; }
[JsonIgnore]
@@ -125,6 +138,11 @@ internal object InternalCustomer
[JsonProperty("recipient")]
internal object InternalRecipient
{
+ get
+ {
+ return this.Recipient ?? (object)this.RecipientId;
+ }
+
set
{
StringOrObject.Map(value, s => this.RecipientId = s, o => this.Recipient = o);
diff --git a/src/Stripe.net/Entities/Charges/Charge.cs b/src/Stripe.net/Entities/Charges/Charge.cs
index eefc31cacb..252947591c 100644
--- a/src/Stripe.net/Entities/Charges/Charge.cs
+++ b/src/Stripe.net/Entities/Charges/Charge.cs
@@ -26,6 +26,7 @@ public class Charge : StripeEntity, IHasId, IHasMetadata, IHasObject, IBalanceTr
public long AmountRefunded { get; set; }
#region Expandable Application
+ [JsonIgnore]
public string ApplicationId { get; set; }
[JsonIgnore]
@@ -34,6 +35,11 @@ public class Charge : StripeEntity, IHasId, IHasMetadata, IHasObject, IBalanceTr
[JsonProperty("application")]
internal object InternalApplication
{
+ get
+ {
+ return this.Application ?? (object)this.ApplicationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ApplicationId = s, o => this.Application = o);
@@ -42,6 +48,7 @@ internal object InternalApplication
#endregion
#region Expandable Application Fee
+ [JsonIgnore]
public string ApplicationFeeId { get; set; }
///
@@ -53,6 +60,11 @@ internal object InternalApplication
[JsonProperty("application_fee")]
internal object InternalApplicationFee
{
+ get
+ {
+ return this.ApplicationFee ?? (object)this.ApplicationFeeId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ApplicationFeeId = s, o => this.ApplicationFee = o);
@@ -65,6 +77,7 @@ internal object InternalApplicationFee
///
/// ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes).
///
+ [JsonIgnore]
public string BalanceTransactionId { get; set; }
[JsonIgnore]
@@ -73,6 +86,11 @@ internal object InternalApplicationFee
[JsonProperty("balance_transaction")]
internal object InternalBalanceTransaction
{
+ get
+ {
+ return this.BalanceTransaction ?? (object)this.BalanceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.BalanceTransactionId = s, o => this.BalanceTransaction = o);
@@ -101,6 +119,7 @@ internal object InternalBalanceTransaction
///
/// ID of the customer this charge is for if one exists.
///
+ [JsonIgnore]
public string CustomerId { get; set; }
[JsonIgnore]
@@ -109,6 +128,11 @@ internal object InternalBalanceTransaction
[JsonProperty("customer")]
internal object InternalCustomer
{
+ get
+ {
+ return this.Customer ?? (object)this.CustomerId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CustomerId = s, o => this.Customer = o);
@@ -120,6 +144,7 @@ internal object InternalCustomer
public string Description { get; set; }
#region Expandable Destination
+ [JsonIgnore]
public string DestinationId { get; set; }
///
@@ -131,6 +156,11 @@ internal object InternalCustomer
[JsonProperty("destination")]
internal object InternalDestination
{
+ get
+ {
+ return this.Destination ?? (object)this.DestinationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DestinationId = s, o => this.Destination = o);
@@ -139,6 +169,7 @@ internal object InternalDestination
#endregion
#region Expandable Dispute
+ [JsonIgnore]
public string DisputeId { get; set; }
///
@@ -150,6 +181,11 @@ internal object InternalDestination
[JsonProperty("dispute")]
internal object InternalDispute
{
+ get
+ {
+ return this.Dispute ?? (object)this.DisputeId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DisputeId = s, o => this.Dispute = o);
@@ -180,6 +216,7 @@ internal object InternalDispute
///
/// ID of the invoice this charge is for if one exists.
///
+ [JsonIgnore]
public string InvoiceId { get; set; }
[JsonIgnore]
@@ -188,6 +225,11 @@ internal object InternalDispute
[JsonProperty("invoice")]
internal object InternalInvoice
{
+ get
+ {
+ return this.Invoice ?? (object)this.InvoiceId;
+ }
+
set
{
StringOrObject.Map(value, s => this.InvoiceId = s, o => this.Invoice = o);
@@ -210,6 +252,7 @@ internal object InternalInvoice
/// The account (if any) the charge was made on behalf of without triggering an automatic transfer. See the Connect documentation for details.
/// To populate the OnBehalfOf entity, you need to set ExpandOnBehalfOf to true on your service before invoking a service method.
///
+ [JsonIgnore]
public string OnBehalfOfId { get; set; }
[JsonIgnore]
@@ -218,6 +261,11 @@ internal object InternalInvoice
[JsonProperty("on_behalf_of")]
internal object InternalOnBehalfOf
{
+ get
+ {
+ return this.OnBehalfOf ?? (object)this.OnBehalfOfId;
+ }
+
set
{
StringOrObject.Map(value, s => this.OnBehalfOfId = s, o => this.OnBehalfOf = o);
@@ -230,6 +278,7 @@ internal object InternalOnBehalfOf
///
/// ID of the order this charge is for if one exists.
///
+ [JsonIgnore]
public string OrderId { get; set; }
[JsonIgnore]
@@ -238,6 +287,11 @@ internal object InternalOnBehalfOf
[JsonProperty("order")]
internal object InternalOrder
{
+ get
+ {
+ return this.Order ?? (object)this.OrderId;
+ }
+
set
{
StringOrObject.Map(value, s => this.OrderId = s, o => this.Order = o);
@@ -269,6 +323,7 @@ internal object InternalOrder
///
/// ID of the payment intent this charge is for if one exists.
///
+ [JsonIgnore]
public string PaymentIntentId { get; set; }
[JsonIgnore]
@@ -277,6 +332,11 @@ internal object InternalOrder
[JsonProperty("payment_intent")]
internal object InternalPaymentIntent
{
+ get
+ {
+ return this.PaymentIntent ?? (object)this.PaymentIntentId;
+ }
+
set
{
StringOrObject.Map(value, s => this.PaymentIntentId = s, o => this.PaymentIntent = o);
@@ -313,6 +373,7 @@ internal object InternalPaymentIntent
///
/// ID of the review associated with this charge if one exists.
///
+ [JsonIgnore]
public string ReviewId { get; set; }
[JsonIgnore]
@@ -321,6 +382,11 @@ internal object InternalPaymentIntent
[JsonProperty("review")]
internal object InternalReview
{
+ get
+ {
+ return this.Review ?? (object)this.ReviewId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ReviewId = s, o => this.Review = o);
@@ -346,6 +412,7 @@ internal object InternalReview
///
/// The transfer ID which created this charge. Only present if the charge came from another Stripe account. See the Connect documentation for details.
///
+ [JsonIgnore]
public string SourceTransferId { get; set; }
[JsonIgnore]
@@ -354,6 +421,11 @@ internal object InternalReview
[JsonProperty("source_transfer")]
internal object InternalSourceTransfer
{
+ get
+ {
+ return this.SourceTransfer ?? (object)this.SourceTransferId;
+ }
+
set
{
StringOrObject.Map(value, s => this.SourceTransferId = s, o => this.SourceTransfer = o);
@@ -378,6 +450,7 @@ internal object InternalSourceTransfer
///
/// ID of the transfer to the destination account (only applicable if the charge was created using the destination parameter).
///
+ [JsonIgnore]
public string TransferId { get; set; }
[JsonIgnore]
@@ -386,6 +459,11 @@ internal object InternalSourceTransfer
[JsonProperty("transfer")]
internal object InternalTransfer
{
+ get
+ {
+ return this.Transfer ?? (object)this.TransferId;
+ }
+
set
{
StringOrObject.Map(value, s => this.TransferId = s, o => this.Transfer = o);
diff --git a/src/Stripe.net/Entities/Charges/Outcome.cs b/src/Stripe.net/Entities/Charges/Outcome.cs
index a2f6321e83..17a8ab712f 100644
--- a/src/Stripe.net/Entities/Charges/Outcome.cs
+++ b/src/Stripe.net/Entities/Charges/Outcome.cs
@@ -34,14 +34,20 @@ public class Outcome : StripeEntity
///
/// The ID of the Radar rule that matched the payment, if applicable.
///
+ [JsonIgnore]
public string RuleId { get; set; }
[JsonIgnore]
public OutcomeRule Rule { get; set; }
[JsonProperty("rule")]
- internal object InternalOutcomeRule
+ internal object InternalRule
{
+ get
+ {
+ return this.Rule ?? (object)this.RuleId;
+ }
+
set
{
StringOrObject.Map(value, s => this.RuleId = s, o => this.Rule = o);
diff --git a/src/Stripe.net/Entities/Coupons/Coupon.cs b/src/Stripe.net/Entities/Coupons/Coupon.cs
index b0108855b7..efb10589bf 100644
--- a/src/Stripe.net/Entities/Coupons/Coupon.cs
+++ b/src/Stripe.net/Entities/Coupons/Coupon.cs
@@ -26,7 +26,7 @@ public class Coupon : StripeEntity, IHasId, IHasMetadata, IHasObject
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("duration")]
diff --git a/src/Stripe.net/Entities/Customers/Customer.cs b/src/Stripe.net/Entities/Customers/Customer.cs
index 17282d10fd..b4989554c3 100644
--- a/src/Stripe.net/Entities/Customers/Customer.cs
+++ b/src/Stripe.net/Entities/Customers/Customer.cs
@@ -43,6 +43,11 @@ public class Customer : StripeEntity, IHasId, IHasMetadata, IHasObject
[JsonProperty("default_source")]
internal object InternalDefaultSource
{
+ get
+ {
+ return this.DefaultSource ?? (object)this.DefaultSourceId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DefaultSourceId = s, o => this.DefaultSource = o);
@@ -60,7 +65,7 @@ internal object InternalDefaultSource
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
///
diff --git a/src/Stripe.net/Entities/Discounts/Discount.cs b/src/Stripe.net/Entities/Discounts/Discount.cs
index 52a61d1f63..2e82c2c339 100644
--- a/src/Stripe.net/Entities/Discounts/Discount.cs
+++ b/src/Stripe.net/Entities/Discounts/Discount.cs
@@ -13,6 +13,7 @@ public class Discount : StripeEntity, IHasObject
public Coupon Coupon { get; set; }
#region Expandable Customer
+ [JsonIgnore]
public string CustomerId { get; set; }
[JsonIgnore]
@@ -21,6 +22,11 @@ public class Discount : StripeEntity, IHasObject
[JsonProperty("customer")]
internal object InternalCustomer
{
+ get
+ {
+ return this.Customer ?? (object)this.CustomerId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CustomerId = s, o => this.Customer = o);
@@ -31,7 +37,7 @@ internal object InternalCustomer
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("end")]
@@ -43,6 +49,7 @@ internal object InternalCustomer
public DateTime? Start { get; set; }
#region Expandable Subscription
+ [JsonIgnore]
public string SubscriptionId { get; set; }
[JsonIgnore]
@@ -51,6 +58,11 @@ internal object InternalCustomer
[JsonProperty("subscription")]
internal object InternalSubscription
{
+ get
+ {
+ return this.Subscription ?? (object)this.SubscriptionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.SubscriptionId = s, o => this.Subscription = o);
diff --git a/src/Stripe.net/Entities/Disputes/Dispute.cs b/src/Stripe.net/Entities/Disputes/Dispute.cs
index 7a62d71f53..67f97b3523 100644
--- a/src/Stripe.net/Entities/Disputes/Dispute.cs
+++ b/src/Stripe.net/Entities/Disputes/Dispute.cs
@@ -20,6 +20,7 @@ public class Dispute : StripeEntity, IHasId, IHasMetadata, IHasObject, IBalanceT
public List BalanceTransactions { get; set; }
#region Expandable Charge
+ [JsonIgnore]
public string ChargeId { get; set; }
[JsonIgnore]
@@ -28,6 +29,11 @@ public class Dispute : StripeEntity, IHasId, IHasMetadata, IHasObject, IBalanceT
[JsonProperty("charge")]
internal object InternalCharge
{
+ get
+ {
+ return this.Charge ?? (object)this.ChargeId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ChargeId = s, o => this.Charge = o);
diff --git a/src/Stripe.net/Entities/Disputes/Evidence.cs b/src/Stripe.net/Entities/Disputes/Evidence.cs
index 135e5c96c4..d8f5f3d392 100644
--- a/src/Stripe.net/Entities/Disputes/Evidence.cs
+++ b/src/Stripe.net/Entities/Disputes/Evidence.cs
@@ -18,6 +18,7 @@ public class Evidence : StripeEntity
/// customer.
/// Expandable.
///
+ [JsonIgnore]
public string CancellationPolicyId { get; set; }
///
@@ -29,6 +30,11 @@ public class Evidence : StripeEntity
[JsonProperty("cancellation_policy")]
internal object InternalCancellationPolicy
{
+ get
+ {
+ return this.CancellationPolicy ?? (object)this.CancellationPolicyId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CancellationPolicyId = s, o => this.CancellationPolicy = o);
@@ -51,6 +57,7 @@ internal object InternalCancellationPolicy
/// service.
/// Expandable.
///
+ [JsonIgnore]
public string CustomerCommunicationId { get; set; }
///
@@ -64,6 +71,11 @@ internal object InternalCancellationPolicy
[JsonProperty("customer_communication")]
internal object InternalCustomerCommunication
{
+ get
+ {
+ return this.CustomerCommunication ?? (object)this.CustomerCommunicationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CustomerCommunicationId = s, o => this.CustomerCommunication = o);
@@ -87,6 +99,7 @@ internal object InternalCustomerCommunication
/// signature.
/// Expandable.
///
+ [JsonIgnore]
public string CustomerSignatureId { get; set; }
///
@@ -98,6 +111,11 @@ internal object InternalCustomerCommunication
[JsonProperty("customer_signature")]
internal object InternalCustomerSignature
{
+ get
+ {
+ return this.CustomerSignature ?? (object)this.CustomerSignatureId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CustomerSignatureId = s, o => this.CustomerSignature = o);
@@ -114,6 +132,7 @@ internal object InternalCustomerSignature
/// payments are separate.
/// Expandable.
///
+ [JsonIgnore]
public string DuplicateChargeDocumentationId { get; set; }
///
@@ -127,6 +146,11 @@ internal object InternalCustomerSignature
[JsonProperty("duplicate_charge_documentation")]
internal object InternalDuplicateChargeDocumentation
{
+ get
+ {
+ return this.DuplicateChargeDocumentation ?? (object)this.DuplicateChargeDocumentationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DuplicateChargeDocumentationId = s, o => this.DuplicateChargeDocumentation = o);
@@ -150,6 +174,7 @@ internal object InternalDuplicateChargeDocumentation
/// of the charge.
/// Expandable.
///
+ [JsonIgnore]
public string ReceiptId { get; set; }
///
@@ -161,6 +186,11 @@ internal object InternalDuplicateChargeDocumentation
[JsonProperty("receipt")]
internal object InternalReceipt
{
+ get
+ {
+ return this.Receipt ?? (object)this.ReceiptId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ReceiptId = s, o => this.Receipt = o);
@@ -174,6 +204,7 @@ internal object InternalReceipt
/// (ID of a ) Your refund policy, as shown to the customer.
/// Expandable.
///
+ [JsonIgnore]
public string RefundPolicyId { get; set; }
///
@@ -185,6 +216,11 @@ internal object InternalReceipt
[JsonProperty("refund_policy")]
internal object InternalRefundPolicy
{
+ get
+ {
+ return this.RefundPolicy ?? (object)this.RefundPolicyId;
+ }
+
set
{
StringOrObject.Map(value, s => this.RefundPolicyId = s, o => this.RefundPolicy = o);
@@ -209,6 +245,7 @@ internal object InternalRefundPolicy
/// of written agreement.
/// Expandable.
///
+ [JsonIgnore]
public string ServiceDocumentationId { get; set; }
///
@@ -222,6 +259,11 @@ internal object InternalRefundPolicy
[JsonProperty("service_documentation")]
internal object InternalServiceDocumentation
{
+ get
+ {
+ return this.ServiceDocumentation ?? (object)this.ServiceDocumentationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ServiceDocumentationId = s, o => this.ServiceDocumentation = o);
@@ -247,6 +289,7 @@ internal object InternalServiceDocumentation
/// shipping address, if possible.
/// Expandable.
///
+ [JsonIgnore]
public string ShippingDocumentationId { get; set; }
///
@@ -261,6 +304,11 @@ internal object InternalServiceDocumentation
[JsonProperty("shipping_documentation")]
internal object InternalShippingDocumentation
{
+ get
+ {
+ return this.ShippingDocumentation ?? (object)this.ShippingDocumentationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ShippingDocumentationId = s, o => this.ShippingDocumentation = o);
@@ -277,6 +325,7 @@ internal object InternalShippingDocumentation
/// (ID of a ) Any additional evidence or statements.
/// Expandable.
///
+ [JsonIgnore]
public string UncategorizedFileId { get; set; }
///
@@ -288,6 +337,11 @@ internal object InternalShippingDocumentation
[JsonProperty("uncategorized_file")]
internal object InternalUncategorizedFile
{
+ get
+ {
+ return this.UncategorizedFile ?? (object)this.UncategorizedFileId;
+ }
+
set
{
StringOrObject.Map(value, s => this.UncategorizedFileId = s, o => this.UncategorizedFile = o);
diff --git a/src/Stripe.net/Entities/EphemeralKeys/EphemeralKey.cs b/src/Stripe.net/Entities/EphemeralKeys/EphemeralKey.cs
index 0c75e5c38d..4d02103cd9 100644
--- a/src/Stripe.net/Entities/EphemeralKeys/EphemeralKey.cs
+++ b/src/Stripe.net/Entities/EphemeralKeys/EphemeralKey.cs
@@ -32,7 +32,7 @@ public string RawJson
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("expires")]
diff --git a/src/Stripe.net/Entities/FileLinks/FileLink.cs b/src/Stripe.net/Entities/FileLinks/FileLink.cs
index 91a262edac..2d53056f45 100644
--- a/src/Stripe.net/Entities/FileLinks/FileLink.cs
+++ b/src/Stripe.net/Entities/FileLinks/FileLink.cs
@@ -45,6 +45,7 @@ public class FileLink : StripeEntity, IHasId, IHasMetadata, IHasObject
///
/// ID of the file object this link points to.
///
+ [JsonIgnore]
public string FileId { get; set; }
///
@@ -56,6 +57,11 @@ public class FileLink : StripeEntity, IHasId, IHasMetadata, IHasObject
[JsonProperty("file")]
internal object InternalFile
{
+ get
+ {
+ return this.File ?? (object)this.FileId;
+ }
+
set
{
StringOrObject.Map(value, s => this.FileId = s, o => this.File = o);
diff --git a/src/Stripe.net/Entities/InvoiceItems/InvoiceItem.cs b/src/Stripe.net/Entities/InvoiceItems/InvoiceItem.cs
index 819b2a66ef..05ffecfeb7 100644
--- a/src/Stripe.net/Entities/InvoiceItems/InvoiceItem.cs
+++ b/src/Stripe.net/Entities/InvoiceItems/InvoiceItem.cs
@@ -20,6 +20,7 @@ public class InvoiceItem : StripeEntity, IHasId, IHasMetadata, IHasObject
public string Currency { get; set; }
#region Expandable Customer
+ [JsonIgnore]
public string CustomerId { get; set; }
[JsonIgnore]
@@ -28,6 +29,11 @@ public class InvoiceItem : StripeEntity, IHasId, IHasMetadata, IHasObject
[JsonProperty("customer")]
internal object InternalCustomer
{
+ get
+ {
+ return this.Customer ?? (object)this.CustomerId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CustomerId = s, o => this.Customer = o);
@@ -42,7 +48,7 @@ internal object InternalCustomer
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("description")]
@@ -52,6 +58,7 @@ internal object InternalCustomer
public bool Discountable { get; set; }
#region Expandable Invoice
+ [JsonIgnore]
public string InvoiceId { get; set; }
[JsonIgnore]
@@ -60,6 +67,11 @@ internal object InternalCustomer
[JsonProperty("invoice")]
internal object InternalInvoice
{
+ get
+ {
+ return this.Invoice ?? (object)this.InvoiceId;
+ }
+
set
{
StringOrObject.Map(value, s => this.InvoiceId = s, o => this.Invoice = o);
@@ -86,6 +98,7 @@ internal object InternalInvoice
public long? Quantity { get; set; }
#region Expandable Subscription
+ [JsonIgnore]
public string SubscriptionId { get; set; }
[JsonIgnore]
@@ -94,6 +107,11 @@ internal object InternalInvoice
[JsonProperty("subscription")]
internal object InternalSubscription
{
+ get
+ {
+ return this.Subscription ?? (object)this.SubscriptionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.SubscriptionId = s, o => this.Subscription = o);
diff --git a/src/Stripe.net/Entities/Invoices/Invoice.cs b/src/Stripe.net/Entities/Invoices/Invoice.cs
index a493c5eeb3..93bcd66abb 100644
--- a/src/Stripe.net/Entities/Invoices/Invoice.cs
+++ b/src/Stripe.net/Entities/Invoices/Invoice.cs
@@ -44,6 +44,7 @@ public class Invoice : StripeEntity, IHasId, IHasMetadata, IHasObject
public string BillingReason { get; set; }
#region Expandable Charge
+ [JsonIgnore]
public string ChargeId { get; set; }
[JsonIgnore]
@@ -52,6 +53,11 @@ public class Invoice : StripeEntity, IHasId, IHasMetadata, IHasObject
[JsonProperty("charge")]
internal object InternalCharge
{
+ get
+ {
+ return this.Charge ?? (object)this.ChargeId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ChargeId = s, o => this.Charge = o);
@@ -63,6 +69,7 @@ internal object InternalCharge
public string Currency { get; set; }
#region Expandable Customer
+ [JsonIgnore]
public string CustomerId { get; set; }
[JsonIgnore]
@@ -71,6 +78,11 @@ internal object InternalCharge
[JsonProperty("customer")]
internal object InternalCustomer
{
+ get
+ {
+ return this.Customer ?? (object)this.CustomerId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CustomerId = s, o => this.Customer = o);
@@ -83,6 +95,7 @@ internal object InternalCustomer
public DateTime? Date { get; set; }
#region Expandable DefaultSource
+ [JsonIgnore]
public string DefaultSourceId { get; set; }
[JsonIgnore]
@@ -91,6 +104,11 @@ internal object InternalCustomer
[JsonProperty("default_source")]
internal object InternalDefaultSource
{
+ get
+ {
+ return this.DefaultSource ?? (object)this.DefaultSourceId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DefaultSourceId = s, o => this.DefaultSource = o);
@@ -167,6 +185,7 @@ internal object InternalDefaultSource
public string Status { get; set; }
#region Expandable Subscription
+ [JsonIgnore]
public string SubscriptionId { get; set; }
[JsonIgnore]
@@ -175,6 +194,11 @@ internal object InternalDefaultSource
[JsonProperty("subscription")]
internal object InternalSubscription
{
+ get
+ {
+ return this.Subscription ?? (object)this.SubscriptionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.SubscriptionId = s, o => this.Subscription = o);
diff --git a/src/Stripe.net/Entities/Issuing/Authorizations/Authorization.cs b/src/Stripe.net/Entities/Issuing/Authorizations/Authorization.cs
index 497a1dcd61..759c5cd54a 100644
--- a/src/Stripe.net/Entities/Issuing/Authorizations/Authorization.cs
+++ b/src/Stripe.net/Entities/Issuing/Authorizations/Authorization.cs
@@ -32,6 +32,7 @@ public class Authorization : StripeEntity, IHasId, IHasMetadata, IHasObject, IBa
public Card Card { get; set; }
#region Expandable Cardholder
+ [JsonIgnore]
public string CardholderId { get; set; }
[JsonIgnore]
@@ -40,6 +41,11 @@ public class Authorization : StripeEntity, IHasId, IHasMetadata, IHasObject, IBa
[JsonProperty("cardholder")]
internal object InternalCardholder
{
+ get
+ {
+ return this.Cardholder ?? (object)this.CardholderId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CardholderId = s, o => this.Cardholder = o);
diff --git a/src/Stripe.net/Entities/Issuing/Cards/CardDetails.cs b/src/Stripe.net/Entities/Issuing/Cards/CardDetails.cs
index cdd8b122b1..7d0c48399c 100644
--- a/src/Stripe.net/Entities/Issuing/Cards/CardDetails.cs
+++ b/src/Stripe.net/Entities/Issuing/Cards/CardDetails.cs
@@ -11,6 +11,7 @@ public class CardDetails : StripeEntity, IHasObject
public string Object { get; set; }
#region Expandable Card
+ [JsonIgnore]
public string CardId { get; set; }
[JsonIgnore]
@@ -19,6 +20,11 @@ public class CardDetails : StripeEntity, IHasObject
[JsonProperty("card")]
internal object InternalCard
{
+ get
+ {
+ return this.Card ?? (object)this.CardId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CardId = s, o => this.Card = o);
diff --git a/src/Stripe.net/Entities/Issuing/Disputes/Dispute.cs b/src/Stripe.net/Entities/Issuing/Disputes/Dispute.cs
index 3383080f46..1fb053f6e0 100644
--- a/src/Stripe.net/Entities/Issuing/Disputes/Dispute.cs
+++ b/src/Stripe.net/Entities/Issuing/Disputes/Dispute.cs
@@ -36,6 +36,7 @@ public class Dispute : StripeEntity, IHasId, IHasMetadata, IHasObject
public string Status { get; set; }
#region Expandable Transaction
+ [JsonIgnore]
public string TransactionId { get; set; }
[JsonIgnore]
@@ -44,6 +45,11 @@ public class Dispute : StripeEntity, IHasId, IHasMetadata, IHasObject
[JsonProperty("transaction")]
internal object InternalTransaction
{
+ get
+ {
+ return this.Transaction ?? (object)this.TransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.TransactionId = s, o => this.Transaction = o);
diff --git a/src/Stripe.net/Entities/Issuing/Disputes/EvidenceFraudulent.cs b/src/Stripe.net/Entities/Issuing/Disputes/EvidenceFraudulent.cs
index 63fc79f842..78b656683e 100644
--- a/src/Stripe.net/Entities/Issuing/Disputes/EvidenceFraudulent.cs
+++ b/src/Stripe.net/Entities/Issuing/Disputes/EvidenceFraudulent.cs
@@ -9,6 +9,7 @@ public class EvidenceFraudulent : StripeEntity
public string DisputeExplanation { get; set; }
#region Expandable UncategorizedFile
+ [JsonIgnore]
public string UncategorizedFileId { get; set; }
[JsonIgnore]
@@ -17,6 +18,11 @@ public class EvidenceFraudulent : StripeEntity
[JsonProperty("uncategorized_file")]
internal object InternalUncategorizedFile
{
+ get
+ {
+ return this.UncategorizedFile ?? (object)this.UncategorizedFileId;
+ }
+
set
{
StringOrObject.Map(value, s => this.UncategorizedFileId = s, o => this.UncategorizedFile = o);
diff --git a/src/Stripe.net/Entities/Issuing/Disputes/EvidenceOther.cs b/src/Stripe.net/Entities/Issuing/Disputes/EvidenceOther.cs
index a6084f5384..53a8f4dc51 100644
--- a/src/Stripe.net/Entities/Issuing/Disputes/EvidenceOther.cs
+++ b/src/Stripe.net/Entities/Issuing/Disputes/EvidenceOther.cs
@@ -9,6 +9,7 @@ public class EvidenceOther : StripeEntity
public string DisputeExplanation { get; set; }
#region Expandable UncategorizedFile
+ [JsonIgnore]
public string UncategorizedFileId { get; set; }
[JsonIgnore]
@@ -17,6 +18,11 @@ public class EvidenceOther : StripeEntity
[JsonProperty("uncategorized_file")]
internal object InternalUncategorizedFile
{
+ get
+ {
+ return this.UncategorizedFile ?? (object)this.UncategorizedFileId;
+ }
+
set
{
StringOrObject.Map(value, s => this.UncategorizedFileId = s, o => this.UncategorizedFile = o);
diff --git a/src/Stripe.net/Entities/Issuing/Transactions/Transaction.cs b/src/Stripe.net/Entities/Issuing/Transactions/Transaction.cs
index 85b8fcf4e7..8a60b23b1b 100644
--- a/src/Stripe.net/Entities/Issuing/Transactions/Transaction.cs
+++ b/src/Stripe.net/Entities/Issuing/Transactions/Transaction.cs
@@ -14,6 +14,7 @@ public class Transaction : StripeEntity, IHasId, IHasMetadata, IHasObject, IBala
public string Object { get; set; }
#region Expandable Authorization
+ [JsonIgnore]
public string AuthorizationId { get; set; }
[JsonIgnore]
@@ -22,6 +23,11 @@ public class Transaction : StripeEntity, IHasId, IHasMetadata, IHasObject, IBala
[JsonProperty("authorization")]
internal object InternalAuthorization
{
+ get
+ {
+ return this.Authorization ?? (object)this.AuthorizationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.AuthorizationId = s, o => this.Authorization = o);
@@ -30,6 +36,7 @@ internal object InternalAuthorization
#endregion
#region Expandable BalanceTransaction
+ [JsonIgnore]
public string BalanceTransactionId { get; set; }
[JsonIgnore]
@@ -38,6 +45,11 @@ internal object InternalAuthorization
[JsonProperty("balance_transaction")]
internal object InternalBalanceTransaction
{
+ get
+ {
+ return this.BalanceTransaction ?? (object)this.BalanceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.BalanceTransactionId = s, o => this.BalanceTransaction = o);
@@ -46,6 +58,7 @@ internal object InternalBalanceTransaction
#endregion
#region Expandable Card
+ [JsonIgnore]
public string CardId { get; set; }
[JsonIgnore]
@@ -54,6 +67,11 @@ internal object InternalBalanceTransaction
[JsonProperty("card")]
internal object InternalCard
{
+ get
+ {
+ return this.Card ?? (object)this.CardId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CardId = s, o => this.Card = o);
@@ -62,6 +80,7 @@ internal object InternalCard
#endregion
#region Expandable Cardholder
+ [JsonIgnore]
public string CardholderId { get; set; }
[JsonIgnore]
@@ -70,6 +89,11 @@ internal object InternalCard
[JsonProperty("cardholder")]
internal object InternalCardholder
{
+ get
+ {
+ return this.Cardholder ?? (object)this.CardholderId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CardholderId = s, o => this.Cardholder = o);
@@ -85,6 +109,7 @@ internal object InternalCardholder
public string Currency { get; set; }
#region Expandable Dispute
+ [JsonIgnore]
public string DisputeId { get; set; }
[JsonIgnore]
@@ -93,6 +118,11 @@ internal object InternalCardholder
[JsonProperty("dispute")]
internal object InternalDispute
{
+ get
+ {
+ return this.Dispute ?? (object)this.DisputeId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DisputeId = s, o => this.Dispute = o);
diff --git a/src/Stripe.net/Entities/Orders/Order.cs b/src/Stripe.net/Entities/Orders/Order.cs
index 99c4b196b6..16bbaacf36 100644
--- a/src/Stripe.net/Entities/Orders/Order.cs
+++ b/src/Stripe.net/Entities/Orders/Order.cs
@@ -37,6 +37,7 @@ public class Order : StripeEntity, IHasId, IHasMetadata, IHasObject
/// The ID of the payment used to pay for the order. Present if the order status is paid, fulfilled, or refunded.
/// Expandable
///
+ [JsonIgnore]
public string ChargeId { get; set; }
[JsonIgnore]
@@ -45,6 +46,11 @@ public class Order : StripeEntity, IHasId, IHasMetadata, IHasObject
[JsonProperty("charge")]
internal object InternalCharge
{
+ get
+ {
+ return this.Charge ?? (object)this.ChargeId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ChargeId = s, o => this.Charge = o);
@@ -78,6 +84,11 @@ internal object InternalCharge
[JsonProperty("customer")]
internal object InternalCustomer
{
+ get
+ {
+ return this.Customer ?? (object)this.CustomerId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CustomerId = s, o => this.Customer = o);
diff --git a/src/Stripe.net/Entities/Orders/OrderReturn.cs b/src/Stripe.net/Entities/Orders/OrderReturn.cs
index 378f49781f..315e7344fd 100644
--- a/src/Stripe.net/Entities/Orders/OrderReturn.cs
+++ b/src/Stripe.net/Entities/Orders/OrderReturn.cs
@@ -44,6 +44,7 @@ public class OrderReturn : StripeEntity, IHasId, IHasObject
/// The order that this return includes items from.
/// Expandable
///
+ [JsonIgnore]
public string OrderId { get; set; }
[JsonIgnore]
@@ -52,6 +53,11 @@ public class OrderReturn : StripeEntity, IHasId, IHasObject
[JsonProperty("order")]
internal object InternalOrder
{
+ get
+ {
+ return this.Order ?? (object)this.OrderId;
+ }
+
set
{
StringOrObject.Map(value, s => this.OrderId = s, o => this.Order = o);
@@ -73,6 +79,11 @@ internal object InternalOrder
[JsonProperty("refund")]
internal object InternalRefund
{
+ get
+ {
+ return this.Refund ?? (object)this.RefundId;
+ }
+
set
{
StringOrObject.Map(value, s => this.RefundId = s, o => this.Refund = o);
diff --git a/src/Stripe.net/Entities/PaymentIntents/PaymentIntent.cs b/src/Stripe.net/Entities/PaymentIntents/PaymentIntent.cs
index 6eeb87b3f4..a94c9ee8ea 100644
--- a/src/Stripe.net/Entities/PaymentIntents/PaymentIntent.cs
+++ b/src/Stripe.net/Entities/PaymentIntents/PaymentIntent.cs
@@ -26,6 +26,7 @@ public class PaymentIntent : StripeEntity, IHasId, IHasMetadata, IHasObject
public long? AmountReceived { get; set; }
#region Expandable Application
+ [JsonIgnore]
public string ApplicationId { get; set; }
[JsonIgnore]
@@ -34,6 +35,11 @@ public class PaymentIntent : StripeEntity, IHasId, IHasMetadata, IHasObject
[JsonProperty("application")]
internal object InternalApplication
{
+ get
+ {
+ return this.Application ?? (object)this.ApplicationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ApplicationId = s, o => this.Application = o);
@@ -71,6 +77,7 @@ internal object InternalApplication
public string Currency { get; set; }
#region Expandable Customer
+ [JsonIgnore]
public string CustomerId { get; set; }
[JsonIgnore]
@@ -79,6 +86,11 @@ internal object InternalApplication
[JsonProperty("customer")]
internal object InternalCustomer
{
+ get
+ {
+ return this.Customer ?? (object)this.CustomerId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CustomerId = s, o => this.Customer = o);
@@ -102,6 +114,7 @@ internal object InternalCustomer
public PaymentIntentSourceAction NextSourceAction { get; set; }
#region Expandable OnBehalfOf (Account)
+ [JsonIgnore]
public string OnBehalfOfId { get; set; }
[JsonIgnore]
@@ -110,6 +123,11 @@ internal object InternalCustomer
[JsonProperty("on_behalf_of")]
internal object InternalOnBehalfOf
{
+ get
+ {
+ return this.OnBehalfOf ?? (object)this.OnBehalfOfId;
+ }
+
set
{
StringOrObject.Map(value, s => this.OnBehalfOfId = s, o => this.OnBehalfOf = o);
@@ -121,6 +139,7 @@ internal object InternalOnBehalfOf
public string ReceiptEmail { get; set; }
#region Expandable Review
+ [JsonIgnore]
public string ReviewId { get; set; }
[JsonIgnore]
@@ -129,6 +148,11 @@ internal object InternalOnBehalfOf
[JsonProperty("review")]
internal object InternalReview
{
+ get
+ {
+ return this.Review ?? (object)this.ReviewId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ReviewId = s, o => this.Review = o);
@@ -140,6 +164,7 @@ internal object InternalReview
public Shipping Shipping { get; set; }
#region Expandable Source
+ [JsonIgnore]
public string SourceId { get; set; }
[JsonIgnore]
@@ -148,6 +173,11 @@ internal object InternalReview
[JsonProperty("source")]
internal object InternalSource
{
+ get
+ {
+ return this.Source ?? (object)this.SourceId;
+ }
+
set
{
StringOrObject.Map(value, s => this.SourceId = s, o => this.Source = o);
diff --git a/src/Stripe.net/Entities/PaymentIntents/PaymentIntentTransferData.cs b/src/Stripe.net/Entities/PaymentIntents/PaymentIntentTransferData.cs
index dd079173ed..333d68556a 100644
--- a/src/Stripe.net/Entities/PaymentIntents/PaymentIntentTransferData.cs
+++ b/src/Stripe.net/Entities/PaymentIntents/PaymentIntentTransferData.cs
@@ -9,6 +9,7 @@ public class PaymentIntentTransferData : StripeEntity
public long Amount { get; set; }
#region Expandable Destination (Account)
+ [JsonIgnore]
public string DestinationId { get; set; }
[JsonIgnore]
@@ -17,6 +18,11 @@ public class PaymentIntentTransferData : StripeEntity
[JsonProperty("destination")]
internal object InternalDestination
{
+ get
+ {
+ return this.Destination ?? (object)this.DestinationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DestinationId = s, o => this.Destination = o);
diff --git a/src/Stripe.net/Entities/Payouts/Payout.cs b/src/Stripe.net/Entities/Payouts/Payout.cs
index 47c26eb5fe..7ce20fec31 100644
--- a/src/Stripe.net/Entities/Payouts/Payout.cs
+++ b/src/Stripe.net/Entities/Payouts/Payout.cs
@@ -24,6 +24,7 @@ public class Payout : StripeEntity, IHasId, IHasMetadata, IHasObject, IBalanceTr
public bool Automatic { get; set; }
#region Expandable Balance Transaction
+ [JsonIgnore]
public string BalanceTransactionId { get; set; }
[JsonIgnore]
@@ -32,6 +33,11 @@ public class Payout : StripeEntity, IHasId, IHasMetadata, IHasObject, IBalanceTr
[JsonProperty("balance_transaction")]
internal object InternalBalanceTransaction
{
+ get
+ {
+ return this.BalanceTransaction ?? (object)this.BalanceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.BalanceTransactionId = s, o => this.BalanceTransaction = o);
@@ -50,6 +56,7 @@ internal object InternalBalanceTransaction
public string Description { get; set; }
#region Expandable Destination
+ [JsonIgnore]
public string DestinationId { get; set; }
[JsonIgnore]
@@ -58,6 +65,11 @@ internal object InternalBalanceTransaction
[JsonProperty("destination")]
internal object InternalDestination
{
+ get
+ {
+ return this.Destination ?? (object)this.DestinationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DestinationId = s, o => this.Destination = o);
@@ -78,6 +90,11 @@ internal object InternalDestination
[JsonProperty("failure_balance_transaction")]
internal object InternalFailureBalanceTransaction
{
+ get
+ {
+ return this.FailureBalanceTransaction ?? (object)this.FailureBalanceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.FailureBalanceTransactionId = s, o => this.FailureBalanceTransaction = o);
diff --git a/src/Stripe.net/Entities/Persons/Person.cs b/src/Stripe.net/Entities/Persons/Person.cs
index 72004d2cca..80f5482192 100644
--- a/src/Stripe.net/Entities/Persons/Person.cs
+++ b/src/Stripe.net/Entities/Persons/Person.cs
@@ -29,7 +29,7 @@ public class Person : StripeEntity, IHasId, IHasObject
[JsonConverter(typeof(DateTimeConverter))]
public DateTime Created { get; set; }
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("dob")]
diff --git a/src/Stripe.net/Entities/Plans/Plan.cs b/src/Stripe.net/Entities/Plans/Plan.cs
index 5648cca60b..7ed42eb66d 100644
--- a/src/Stripe.net/Entities/Plans/Plan.cs
+++ b/src/Stripe.net/Entities/Plans/Plan.cs
@@ -35,7 +35,7 @@ public class Plan : StripeEntity, IHasId, IHasMetadata, IHasObject
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("interval")]
@@ -59,6 +59,7 @@ public class Plan : StripeEntity, IHasId, IHasMetadata, IHasObject
/// ID of the product linked to this plan
/// You can expand the Product by setting the ExpandProduct property on the service to true
///
+ [JsonIgnore]
public string ProductId { get; set; }
[JsonIgnore]
@@ -67,6 +68,11 @@ public class Plan : StripeEntity, IHasId, IHasMetadata, IHasObject
[JsonProperty("product")]
internal object InternalProduct
{
+ get
+ {
+ return this.Product ?? (object)this.ProductId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ProductId = s, o => this.Product = o);
diff --git a/src/Stripe.net/Entities/Products/Product.cs b/src/Stripe.net/Entities/Products/Product.cs
index 9aaaed6e1b..b3b4ab2833 100644
--- a/src/Stripe.net/Entities/Products/Product.cs
+++ b/src/Stripe.net/Entities/Products/Product.cs
@@ -47,7 +47,7 @@ public class Product : StripeEntity, IHasId, IHasMetadata, IHasObject
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
///
diff --git a/src/Stripe.net/Entities/Recipients/Recipient.cs b/src/Stripe.net/Entities/Recipients/Recipient.cs
index 72b4afe504..83b3b26f82 100644
--- a/src/Stripe.net/Entities/Recipients/Recipient.cs
+++ b/src/Stripe.net/Entities/Recipients/Recipient.cs
@@ -24,6 +24,7 @@ public class Recipient : StripeEntity, IHasId, IHasMetadata, IHasObject
public DateTime Created { get; set; }
#region Expandable Default Card
+ [JsonIgnore]
public string DefaultCardId { get; set; }
[JsonIgnore]
@@ -32,6 +33,11 @@ public class Recipient : StripeEntity, IHasId, IHasMetadata, IHasObject
[JsonProperty("default_card")]
internal object InternalDefaultCard
{
+ get
+ {
+ return this.DefaultCard ?? (object)this.DefaultCardId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DefaultCardId = s, o => this.DefaultCard = o);
diff --git a/src/Stripe.net/Entities/Refunds/Refund.cs b/src/Stripe.net/Entities/Refunds/Refund.cs
index 57e9b033be..5e0c623b36 100644
--- a/src/Stripe.net/Entities/Refunds/Refund.cs
+++ b/src/Stripe.net/Entities/Refunds/Refund.cs
@@ -17,6 +17,7 @@ public class Refund : StripeEntity, IHasId, IHasMetadata, IHasObject, IBalanceTr
public long Amount { get; set; }
#region Expandable Balance Transaction
+ [JsonIgnore]
public string BalanceTransactionId { get; set; }
[JsonIgnore]
@@ -25,6 +26,11 @@ public class Refund : StripeEntity, IHasId, IHasMetadata, IHasObject, IBalanceTr
[JsonProperty("balance_transaction")]
internal object InternalBalanceTransaction
{
+ get
+ {
+ return this.BalanceTransaction ?? (object)this.BalanceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.BalanceTransactionId = s, o => this.BalanceTransaction = o);
@@ -33,6 +39,7 @@ internal object InternalBalanceTransaction
#endregion
#region Expandable Charge
+ [JsonIgnore]
public string ChargeId { get; set; }
[JsonIgnore]
@@ -41,6 +48,11 @@ internal object InternalBalanceTransaction
[JsonProperty("charge")]
internal object InternalCharge
{
+ get
+ {
+ return this.Charge ?? (object)this.ChargeId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ChargeId = s, o => this.Charge = o);
@@ -59,6 +71,7 @@ internal object InternalCharge
public string Description { get; set; }
#region Expandable Failure Balance Transaction
+ [JsonIgnore]
public string FailureBalanceTransactionId { get; set; }
[JsonIgnore]
@@ -67,6 +80,11 @@ internal object InternalCharge
[JsonProperty("failure_balance_transaction")]
internal object InternalFailureBalanceTransaction
{
+ get
+ {
+ return this.FailureBalanceTransaction ?? (object)this.FailureBalanceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.FailureBalanceTransactionId = s, o => this.FailureBalanceTransaction = o);
@@ -87,6 +105,7 @@ internal object InternalFailureBalanceTransaction
public string ReceiptNumber { get; set; }
#region Expandable Source Transfer Reversal
+ [JsonIgnore]
public string SourceTransferReversalId { get; set; }
[JsonIgnore]
@@ -95,6 +114,11 @@ internal object InternalFailureBalanceTransaction
[JsonProperty("source_transfer_reversal")]
internal object InternalSourceTransferReversal
{
+ get
+ {
+ return this.SourceTransferReversal ?? (object)this.SourceTransferReversalId;
+ }
+
set
{
StringOrObject.Map(value, s => this.SourceTransferReversalId = s, o => this.SourceTransferReversal = o);
@@ -106,6 +130,7 @@ internal object InternalSourceTransferReversal
public string Status { get; set; }
#region Expandable Transfer Reversal
+ [JsonIgnore]
public string TransferReversalId { get; set; }
[JsonIgnore]
@@ -114,6 +139,11 @@ internal object InternalSourceTransferReversal
[JsonProperty("transfer_reversal")]
internal object InternalTransferReversal
{
+ get
+ {
+ return this.TransferReversal ?? (object)this.TransferReversalId;
+ }
+
set
{
StringOrObject.Map(value, s => this.TransferReversalId = s, o => this.TransferReversal = o);
diff --git a/src/Stripe.net/Entities/Reviews/Review.cs b/src/Stripe.net/Entities/Reviews/Review.cs
index b8a55530c7..a05a73e375 100644
--- a/src/Stripe.net/Entities/Reviews/Review.cs
+++ b/src/Stripe.net/Entities/Reviews/Review.cs
@@ -14,6 +14,7 @@ public class Review : StripeEntity, IHasId, IHasObject
public string Object { get; set; }
#region Expandable Charge
+ [JsonIgnore]
public string ChargeId { get; set; }
[JsonIgnore]
@@ -22,6 +23,11 @@ public class Review : StripeEntity, IHasId, IHasObject
[JsonProperty("charge")]
internal object InternalCharge
{
+ get
+ {
+ return this.Charge ?? (object)this.ChargeId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ChargeId = s, o => this.Charge = o);
@@ -40,6 +46,7 @@ internal object InternalCharge
public bool Open { get; set; }
#region Expandable PaymentIntent
+ [JsonIgnore]
public string PaymentIntentId { get; set; }
[JsonIgnore]
@@ -48,6 +55,11 @@ internal object InternalCharge
[JsonProperty("payment_intent")]
internal object InternalPaymentIntent
{
+ get
+ {
+ return this.PaymentIntent ?? (object)this.PaymentIntentId;
+ }
+
set
{
StringOrObject.Map(value, s => this.PaymentIntentId = s, o => this.PaymentIntent = o);
diff --git a/src/Stripe.net/Entities/Skus/Sku.cs b/src/Stripe.net/Entities/Skus/Sku.cs
index 8a1b6fbd9e..86db879d8b 100644
--- a/src/Stripe.net/Entities/Skus/Sku.cs
+++ b/src/Stripe.net/Entities/Skus/Sku.cs
@@ -41,7 +41,7 @@ public class Sku : StripeEntity, IHasId, IHasMetadata, IHasObject
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
///
@@ -85,6 +85,7 @@ public class Sku : StripeEntity, IHasId, IHasMetadata, IHasObject
///
/// The ID of the product this SKU is associated with. The product must be currently active.
///
+ [JsonIgnore]
public string ProductId { get; set; }
[JsonIgnore]
@@ -93,6 +94,11 @@ public class Sku : StripeEntity, IHasId, IHasMetadata, IHasObject
[JsonProperty("product")]
internal object InternalProduct
{
+ get
+ {
+ return this.Product ?? (object)this.ProductId;
+ }
+
set
{
StringOrObject.Map(value, s => this.ProductId = s, o => this.Product = o);
diff --git a/src/Stripe.net/Entities/SubscriptionItems/SubscriptionItem.cs b/src/Stripe.net/Entities/SubscriptionItems/SubscriptionItem.cs
index 9583608ebe..f9c3e5969e 100644
--- a/src/Stripe.net/Entities/SubscriptionItems/SubscriptionItem.cs
+++ b/src/Stripe.net/Entities/SubscriptionItems/SubscriptionItem.cs
@@ -20,7 +20,7 @@ public class SubscriptionItem : StripeEntity, IHasId, IHasMetadata, IHasObject
///
/// Whether this object is deleted or not.
///
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("metadata")]
diff --git a/src/Stripe.net/Entities/Subscriptions/Subscription.cs b/src/Stripe.net/Entities/Subscriptions/Subscription.cs
index e78430a3c2..3f38d7e1be 100644
--- a/src/Stripe.net/Entities/Subscriptions/Subscription.cs
+++ b/src/Stripe.net/Entities/Subscriptions/Subscription.cs
@@ -46,6 +46,7 @@ public class Subscription : StripeEntity, IHasId, IHasMetadata, IHasObject
public DateTime? CurrentPeriodStart { get; set; }
#region Expandable Customer
+ [JsonIgnore]
public string CustomerId { get; set; }
[JsonIgnore]
@@ -54,6 +55,11 @@ public class Subscription : StripeEntity, IHasId, IHasMetadata, IHasObject
[JsonProperty("customer")]
internal object InternalCustomer
{
+ get
+ {
+ return this.Customer ?? (object)this.CustomerId;
+ }
+
set
{
StringOrObject.Map(value, s => this.CustomerId = s, o => this.Customer = o);
@@ -68,6 +74,7 @@ internal object InternalCustomer
public long? DaysUntilDue { get; set; }
#region Expandable DefaultSource
+ [JsonIgnore]
public string DefaultSourceId { get; set; }
[JsonIgnore]
@@ -76,6 +83,11 @@ internal object InternalCustomer
[JsonProperty("default_source")]
internal object InternalDefaultSource
{
+ get
+ {
+ return this.DefaultSource ?? (object)this.DefaultSourceId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DefaultSourceId = s, o => this.DefaultSource = o);
diff --git a/src/Stripe.net/Entities/Topups/Topup.cs b/src/Stripe.net/Entities/Topups/Topup.cs
index 925d4bb554..9eb70a4533 100644
--- a/src/Stripe.net/Entities/Topups/Topup.cs
+++ b/src/Stripe.net/Entities/Topups/Topup.cs
@@ -32,6 +32,11 @@ public class Topup : StripeEntity, IHasId, IHasMetadata, IHasObject, IBalanceTra
[JsonProperty("balance_transaction")]
internal object InternalBalanceTransaction
{
+ get
+ {
+ return this.BalanceTransaction ?? (object)this.BalanceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.BalanceTransactionId = s, o => this.BalanceTransaction = o);
diff --git a/src/Stripe.net/Entities/TransferReversals/TransferReversal.cs b/src/Stripe.net/Entities/TransferReversals/TransferReversal.cs
index 7872cfb6d8..46bc4f1957 100644
--- a/src/Stripe.net/Entities/TransferReversals/TransferReversal.cs
+++ b/src/Stripe.net/Entities/TransferReversals/TransferReversal.cs
@@ -17,6 +17,7 @@ public class TransferReversal : StripeEntity, IHasId, IHasMetadata, IHasObject,
public long Amount { get; set; }
#region Expandable Balance Transaction
+ [JsonIgnore]
public string BalanceTransactionId { get; set; }
[JsonIgnore]
@@ -25,6 +26,11 @@ public class TransferReversal : StripeEntity, IHasId, IHasMetadata, IHasObject,
[JsonProperty("balance_transaction")]
internal object InternalBalanceTransaction
{
+ get
+ {
+ return this.BalanceTransaction ?? (object)this.BalanceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.BalanceTransactionId = s, o => this.BalanceTransaction = o);
@@ -43,6 +49,7 @@ internal object InternalBalanceTransaction
public Dictionary Metadata { get; set; }
#region Expandable Transfer
+ [JsonIgnore]
public string TransferId { get; set; }
[JsonIgnore]
@@ -51,6 +58,11 @@ internal object InternalBalanceTransaction
[JsonProperty("transfer")]
internal object InternalTransfer
{
+ get
+ {
+ return this.Transfer ?? (object)this.TransferId;
+ }
+
set
{
StringOrObject.Map(value, s => this.TransferId = s, o => this.Transfer = o);
diff --git a/src/Stripe.net/Entities/Transfers/Transfer.cs b/src/Stripe.net/Entities/Transfers/Transfer.cs
index fe812acb32..db2792bb16 100644
--- a/src/Stripe.net/Entities/Transfers/Transfer.cs
+++ b/src/Stripe.net/Entities/Transfers/Transfer.cs
@@ -20,6 +20,7 @@ public class Transfer : StripeEntity, IHasId, IHasMetadata, IHasObject, IBalance
public long AmountReversed { get; set; }
#region Expandable Balance Transaction
+ [JsonIgnore]
public string BalanceTransactionId { get; set; }
[JsonIgnore]
@@ -28,6 +29,11 @@ public class Transfer : StripeEntity, IHasId, IHasMetadata, IHasObject, IBalance
[JsonProperty("balance_transaction")]
internal object InternalBalanceTransaction
{
+ get
+ {
+ return this.BalanceTransaction ?? (object)this.BalanceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.BalanceTransactionId = s, o => this.BalanceTransaction = o);
@@ -46,6 +52,7 @@ internal object InternalBalanceTransaction
public string Description { get; set; }
#region Expandable Destination
+ [JsonIgnore]
public string DestinationId { get; set; }
[JsonIgnore]
@@ -54,6 +61,11 @@ internal object InternalBalanceTransaction
[JsonProperty("destination")]
internal object InternalDestination
{
+ get
+ {
+ return this.Destination ?? (object)this.DestinationId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DestinationId = s, o => this.Destination = o);
@@ -62,6 +74,7 @@ internal object InternalDestination
#endregion
#region Expandable Destination Payment
+ [JsonIgnore]
public string DestinationPaymentId { get; set; }
[JsonIgnore]
@@ -70,6 +83,11 @@ internal object InternalDestination
[JsonProperty("destination_payment")]
internal object InternalDestinationPayment
{
+ get
+ {
+ return this.DestinationPayment ?? (object)this.DestinationPaymentId;
+ }
+
set
{
StringOrObject.Map(value, s => this.DestinationPaymentId = s, o => this.DestinationPayment = o);
@@ -90,6 +108,7 @@ internal object InternalDestinationPayment
public bool Reversed { get; set; }
#region Expandable Source Transaction
+ [JsonIgnore]
public string SourceTransactionId { get; set; }
[JsonIgnore]
@@ -98,6 +117,11 @@ internal object InternalDestinationPayment
[JsonProperty("source_transaction")]
internal object InternalSourceTransaction
{
+ get
+ {
+ return this.SourceTransaction ?? (object)this.SourceTransactionId;
+ }
+
set
{
StringOrObject.Map(value, s => this.SourceTransactionId = s, o => this.SourceTransaction = o);
diff --git a/src/Stripe.net/Entities/WebhookEndpoints/WebhookEndpoint.cs b/src/Stripe.net/Entities/WebhookEndpoints/WebhookEndpoint.cs
index 57633ce51c..1363db0575 100644
--- a/src/Stripe.net/Entities/WebhookEndpoints/WebhookEndpoint.cs
+++ b/src/Stripe.net/Entities/WebhookEndpoints/WebhookEndpoint.cs
@@ -23,7 +23,7 @@ public class WebhookEndpoint : StripeEntity, IHasId, IHasObject
[JsonConverter(typeof(DateTimeConverter))]
public DateTime Created { get; set; }
- [JsonProperty("deleted")]
+ [JsonProperty("deleted", NullValueHandling=NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
[JsonProperty("enabled_events")]
diff --git a/src/Stripe.net/Entities/_base/StripeEntity.cs b/src/Stripe.net/Entities/_base/StripeEntity.cs
index 2763fcd82a..ec1d1c0158 100644
--- a/src/Stripe.net/Entities/_base/StripeEntity.cs
+++ b/src/Stripe.net/Entities/_base/StripeEntity.cs
@@ -1,7 +1,47 @@
namespace Stripe
{
+ using System.Reflection;
+ using System.Runtime.CompilerServices;
+ using Newtonsoft.Json;
+
public abstract class StripeEntity : IStripeEntity
{
+ [JsonIgnore]
public StripeResponse StripeResponse { get; set; }
+
+ /// Reports a Stripe object as a string.
+ ///
+ /// A string representing the Stripe object, including its JSON serialization.
+ ///
+ ///
+ public override string ToString()
+ {
+ return string.Format(
+ "<{0}@{1} id={2}> JSON: {3}",
+ this.GetType().FullName,
+ RuntimeHelpers.GetHashCode(this),
+ this.GetIdString(),
+ this.ToJson());
+ }
+
+ /// Serializes the Stripe object as a JSON string.
+ /// An indented JSON string represensation of the object.
+ public string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ private object GetIdString()
+ {
+ foreach (var property in this.GetType().GetTypeInfo().DeclaredProperties)
+ {
+ if (property.Name == "Id")
+ {
+ return property.GetValue(this);
+ }
+ }
+
+ return null;
+ }
}
}
diff --git a/src/StripeTests/Infrastructure/ExpandableSerializationTest.cs b/src/StripeTests/Infrastructure/ExpandableSerializationTest.cs
new file mode 100644
index 0000000000..d97f7d8d3e
--- /dev/null
+++ b/src/StripeTests/Infrastructure/ExpandableSerializationTest.cs
@@ -0,0 +1,87 @@
+namespace StripeTests
+{
+ using Newtonsoft.Json;
+ using Stripe;
+ using Stripe.Infrastructure;
+ using Xunit;
+
+ public class ExpandableSerializationTest : BaseStripeTest
+ {
+ [Fact]
+ public void SerializeNotExpanded()
+ {
+ var obj = new TestTopLevelObject
+ {
+ NestedId = "id_not_expanded",
+ Nested = null,
+ };
+
+ var expected = "{\n \"nested\": \"id_not_expanded\"\n}";
+ Assert.Equal(expected, obj.ToJson().Replace("\r\n", "\n"));
+ }
+
+ [Fact]
+ public void SerializeExpanded()
+ {
+ var nested = new TestNestedObject
+ {
+ Id = "id_expanded",
+ Bar = 42,
+ };
+ var obj = new TestTopLevelObject
+ {
+ NestedId = nested.Id,
+ Nested = nested,
+ };
+
+ var expected =
+ "{\n \"nested\": {\n \"id\": \"id_expanded\",\n \"bar\": 42\n }\n}";
+ Assert.Equal(expected, obj.ToJson().Replace("\r\n", "\n"));
+ }
+
+ [Fact]
+ public void SerializeNull()
+ {
+ var obj = new TestTopLevelObject
+ {
+ NestedId = null,
+ Nested = null,
+ };
+
+ var expected = "{\n \"nested\": null\n}";
+ Assert.Equal(expected, obj.ToJson().Replace("\r\n", "\n"));
+ }
+
+ private class TestNestedObject : StripeEntity, IHasId
+ {
+ [JsonProperty("id")]
+ public string Id { get; set; }
+
+ [JsonProperty("bar")]
+ public int Bar { get; set; }
+ }
+
+ private class TestTopLevelObject : StripeEntity
+ {
+ [JsonIgnore]
+ public string NestedId { get; set; }
+
+ [JsonIgnore]
+ public TestNestedObject Nested { get; set; }
+
+ [JsonProperty("nested")]
+ internal object InternalNested
+ {
+ get
+ {
+ return this.Nested ?? (object)this.NestedId;
+ }
+
+ set
+ {
+ StringOrObject.Map(value, s => this.NestedId = s, o => this.Nested = o);
+ }
+ }
+ }
+ }
+}
diff --git a/src/StripeTests/Wholesome/DontSerializeNullDeletedAttrs.cs b/src/StripeTests/Wholesome/DontSerializeNullDeletedAttrs.cs
new file mode 100644
index 0000000000..827d79c6b6
--- /dev/null
+++ b/src/StripeTests/Wholesome/DontSerializeNullDeletedAttrs.cs
@@ -0,0 +1,74 @@
+#if NETCOREAPP
+namespace StripeTests
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Reflection;
+ using Newtonsoft.Json;
+ using Stripe;
+ using Xunit;
+
+ public class DontSerializeNullDeletedAttrs
+ {
+ private const string AssertionMessage =
+ "Found at least one invalid Deleted property. Make sure that the property " +
+ "has a JsonPropertyAttribute and that NullValueHandling is set to Ignore.";
+
+ [Fact]
+ public void Check()
+ {
+ List results = new List();
+
+ // Get all StripeEntity subclasses
+ var type = typeof(StripeEntity);
+ var assembly = type.GetTypeInfo().Assembly;
+ var entityClasses = assembly.DefinedTypes
+ .Where(t => t.IsClass && t.IsSubclassOf(type))
+ .Select(t => t.AsType());
+
+ foreach (Type entityClass in entityClasses)
+ {
+ foreach (PropertyInfo property in entityClass.GetProperties())
+ {
+ if (property.Name != "Deleted")
+ {
+ continue;
+ }
+
+ // Check that property has a JsonPropertyAttribute
+ var attribute = property.GetCustomAttribute();
+ if (attribute == null)
+ {
+ continue;
+ }
+
+ // Check that NullValueHanding is set to Ignore
+ if (attribute.NullValueHandling == NullValueHandling.Ignore)
+ {
+ continue;
+ }
+
+ results.Add($"{entityClass.Name}.{property.Name}");
+ }
+ }
+
+ if (results.Any())
+ {
+ // Sort results alphabetically
+ results = results.OrderBy(i => i).ToList();
+
+ // Display our own error message (because Assert.Empty truncates the results)
+ Console.WriteLine("Found invalid Deleted properties:");
+ foreach (string item in results)
+ {
+ Console.WriteLine($"- {item}");
+ }
+
+ // Actually fail test
+ Assert.True(false, AssertionMessage);
+ }
+ }
+ }
+}
+#endif