Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ namespace Stripe.V2.Core
[STJS.JsonConverter(typeof(STJStripeEntityConverter))]
public class AccountLinkUseCase : StripeEntity<AccountLinkUseCase>
{
/// <summary>
/// Open Enum. The type of Account Link the user is requesting.
/// One of: <c>account_onboarding</c>, or <c>account_update</c>.
/// </summary>
[JsonProperty("type")]
[STJS.JsonPropertyName("type")]
public string Type { get; set; }

/// <summary>
/// Hash containing configuration options for an Account Link object that onboards a new
/// account.
Expand All @@ -31,5 +23,13 @@ public class AccountLinkUseCase : StripeEntity<AccountLinkUseCase>
[JsonProperty("account_update")]
[STJS.JsonPropertyName("account_update")]
public AccountLinkUseCaseAccountUpdate AccountUpdate { get; set; }

/// <summary>
/// Open Enum. The type of Account Link the user is requesting.
/// One of: <c>account_onboarding</c>, or <c>account_update</c>.
/// </summary>
[JsonProperty("type")]
[STJS.JsonPropertyName("type")]
public string Type { get; set; }
}
}
14 changes: 7 additions & 7 deletions src/Stripe.net/Entities/V2/Core/Events/EventReason.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ namespace Stripe.V2.Core
[STJS.JsonConverter(typeof(STJStripeEntityConverter))]
public class EventReason : StripeEntity<EventReason>
{
/// <summary>
/// Event reason type.
/// </summary>
[JsonProperty("type")]
[STJS.JsonPropertyName("type")]
public string Type { get; set; }

/// <summary>
/// Information on the API request that instigated the event.
/// </summary>
[JsonProperty("request")]
[STJS.JsonPropertyName("request")]
public EventReasonRequest Request { get; set; }

/// <summary>
/// Event reason type.
/// </summary>
[JsonProperty("type")]
[STJS.JsonPropertyName("type")]
public string Type { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,28 @@ public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions
switch (valueToSerialize)
{
case null:
// If this is an emptyable property that was explicitly set to null,
// write null even if the global ignore condition would skip it.
bool forceWriteNull = value is IHasSetTracking tracked
&& tracked.IsPropertySet(property.PropertyInfo.Name);
var ignoreCondition = property.IgnoreCondition
?? options.DefaultIgnoreCondition;

// Use property-level ignore condition if set, otherwise use global setting
var effectiveIgnoreCondition = property.IgnoreCondition ?? options.DefaultIgnoreCondition;
bool shouldWriteNull;
if (ignoreCondition == JsonIgnoreCondition.Always)
{
shouldWriteNull = false;
}
else if (ignoreCondition == JsonIgnoreCondition.WhenWritingNull)
{
// For emptyable properties on Options objects,
// write null only when explicitly set by the caller.
// For other types, respect the annotation and skip.
shouldWriteNull = value is IHasSetTracking tracked
&& tracked.IsPropertySet(property.PropertyInfo.Name);
}
else
{
shouldWriteNull = true;
}

if (forceWriteNull ||
(effectiveIgnoreCondition != JsonIgnoreCondition.WhenWritingNull &&
effectiveIgnoreCondition != JsonIgnoreCondition.Always))
if (shouldWriteNull)
{
writer.WritePropertyName(property.JsonPropertyName);
writer.WriteNullValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ public class AccountExternalAccountCardOptions : INestedOptions, IHasMetadata, I
[STJS.JsonPropertyName("exp_year")]
public long? ExpYear { get; set; }

[JsonProperty("name")]
[STJS.JsonPropertyName("name")]
public string Name { get; set; }

[JsonProperty("number")]
[STJS.JsonPropertyName("number")]
public string Number { get; set; }

/// <summary>
/// Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
/// attach to an object. This can be useful for storing additional information about the
Expand All @@ -69,5 +61,13 @@ public class AccountExternalAccountCardOptions : INestedOptions, IHasMetadata, I
[JsonProperty("metadata")]
[STJS.JsonPropertyName("metadata")]
public Dictionary<string, string> Metadata { get; set; }

[JsonProperty("name")]
[STJS.JsonPropertyName("name")]
public string Name { get; set; }

[JsonProperty("number")]
[STJS.JsonPropertyName("number")]
public string Number { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ public class AccountExternalAccountUpdateOptions : BaseOptions, IHasMetadata
/// <c>company</c>.
/// One of: <c>company</c>, or <c>individual</c>.
/// </summary>
[JsonProperty("account_holder_type")]
[JsonProperty("account_holder_type", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("account_holder_type")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public string AccountHolderType
{
get => this.accountHolderType;
Expand Down Expand Up @@ -121,8 +122,9 @@ public string AccountHolderType
/// object in a structured format. Individual keys can be unset by posting an empty value to
/// them. All keys can be unset by posting an empty value to <c>metadata</c>.
/// </summary>
[JsonProperty("metadata")]
[JsonProperty("metadata", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("metadata")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, string> Metadata
{
get => this.metadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public class AccountPersonAdditionalTosAcceptancesAccountOptions : INestedOption
/// The user agent of the browser from which the account representative accepted the service
/// agreement.
/// </summary>
[JsonProperty("user_agent")]
[JsonProperty("user_agent", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("user_agent")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public string UserAgent
{
get => this.userAgent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public class AccountPersonCreateOptions : BaseOptions, IHasMetadata
/// <summary>
/// The person's date of birth.
/// </summary>
[JsonProperty("dob")]
[JsonProperty("dob", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("dob")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public AccountPersonDobOptions Dob
{
get => this.dob;
Expand Down Expand Up @@ -95,8 +96,9 @@ public AccountPersonDobOptions Dob
/// <summary>
/// A list of alternate names or aliases that the person is known by.
/// </summary>
[JsonProperty("full_name_aliases")]
[JsonProperty("full_name_aliases", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("full_name_aliases")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public List<string> FullNameAliases
{
get => this.fullNameAliases;
Expand Down Expand Up @@ -170,8 +172,9 @@ public List<string> FullNameAliases
/// object in a structured format. Individual keys can be unset by posting an empty value to
/// them. All keys can be unset by posting an empty value to <c>metadata</c>.
/// </summary>
[JsonProperty("metadata")]
[JsonProperty("metadata", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("metadata")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, string> Metadata
{
get => this.metadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ public class AccountPersonRelationshipOptions : INestedOptions, IHasSetTracking
/// <summary>
/// The percent owned by the person of the account's legal entity.
/// </summary>
[JsonProperty("percent_ownership")]
[JsonProperty("percent_ownership", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("percent_ownership")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public decimal? PercentOwnership
{
get => this.percentOwnership;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public class AccountPersonUpdateOptions : BaseOptions, IHasMetadata
/// <summary>
/// The person's date of birth.
/// </summary>
[JsonProperty("dob")]
[JsonProperty("dob", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("dob")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public AccountPersonDobOptions Dob
{
get => this.dob;
Expand Down Expand Up @@ -95,8 +96,9 @@ public AccountPersonDobOptions Dob
/// <summary>
/// A list of alternate names or aliases that the person is known by.
/// </summary>
[JsonProperty("full_name_aliases")]
[JsonProperty("full_name_aliases", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("full_name_aliases")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public List<string> FullNameAliases
{
get => this.fullNameAliases;
Expand Down Expand Up @@ -170,8 +172,9 @@ public List<string> FullNameAliases
/// object in a structured format. Individual keys can be unset by posting an empty value to
/// them. All keys can be unset by posting an empty value to <c>metadata</c>.
/// </summary>
[JsonProperty("metadata")]
[JsonProperty("metadata", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("metadata")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, string> Metadata
{
get => this.metadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ public class AccountBusinessProfileOptions : INestedOptions, IHasSetTracking
/// <summary>
/// A publicly available website for handling support issues.
/// </summary>
[JsonProperty("support_url")]
[JsonProperty("support_url", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("support_url")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public string SupportUrl
{
get => this.supportUrl;
Expand Down
9 changes: 6 additions & 3 deletions src/Stripe.net/Services/Accounts/AccountCompanyOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ public class AccountCompanyOptions : INestedOptions, IHasSetTracking
/// One of: <c>qualified_entity_exceeds_ownership_threshold</c>, or
/// <c>qualifies_as_financial_institution</c>.
/// </summary>
[JsonProperty("ownership_exemption_reason")]
[JsonProperty("ownership_exemption_reason", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("ownership_exemption_reason")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public string OwnershipExemptionReason
{
get => this.ownershipExemptionReason;
Expand All @@ -152,8 +153,9 @@ public string OwnershipExemptionReason
/// <summary>
/// When the business was incorporated or registered.
/// </summary>
[JsonProperty("registration_date")]
[JsonProperty("registration_date", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("registration_date")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public AccountCompanyRegistrationDateOptions RegistrationDate
{
get => this.registrationDate;
Expand Down Expand Up @@ -197,8 +199,9 @@ public AccountCompanyRegistrationDateOptions RegistrationDate
/// <c>unincorporated_association</c>, <c>unincorporated_non_profit</c>, or
/// <c>unincorporated_partnership</c>.
/// </summary>
[JsonProperty("structure")]
[JsonProperty("structure", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("structure")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public string Structure
{
get => this.structure;
Expand Down
3 changes: 2 additions & 1 deletion src/Stripe.net/Services/Accounts/AccountCreateOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ public class AccountCreateOptions : BaseOptions, IHasMetadata
/// object in a structured format. Individual keys can be unset by posting an empty value to
/// them. All keys can be unset by posting an empty value to <c>metadata</c>.
/// </summary>
[JsonProperty("metadata")]
[JsonProperty("metadata", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("metadata")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, string> Metadata
{
get => this.metadata;
Expand Down
3 changes: 2 additions & 1 deletion src/Stripe.net/Services/Accounts/AccountGroupsOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ public class AccountGroupsOptions : INestedOptions, IHasSetTracking
/// href="https://docs.stripe.com/connect/platform-pricing-tools">See the Platform pricing
/// tool documentation</a> for details.
/// </summary>
[JsonProperty("payments_pricing")]
[JsonProperty("payments_pricing", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("payments_pricing")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public string PaymentsPricing
{
get => this.paymentsPricing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ public class AccountIndividualOptions : INestedOptions, IHasMetadata, IHasSetTra
/// <summary>
/// The individual's date of birth.
/// </summary>
[JsonProperty("dob")]
[JsonProperty("dob", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("dob")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public DobOptions Dob
{
get => this.dob;
Expand Down Expand Up @@ -84,8 +85,9 @@ public DobOptions Dob
/// <summary>
/// A list of alternate names or aliases that the individual is known by.
/// </summary>
[JsonProperty("full_name_aliases")]
[JsonProperty("full_name_aliases", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("full_name_aliases")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public List<string> FullNameAliases
{
get => this.fullNameAliases;
Expand Down Expand Up @@ -160,8 +162,9 @@ public List<string> FullNameAliases
/// object in a structured format. Individual keys can be unset by posting an empty value to
/// them. All keys can be unset by posting an empty value to <c>metadata</c>.
/// </summary>
[JsonProperty("metadata")]
[JsonProperty("metadata", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("metadata")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, string> Metadata
{
get => this.metadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ public class AccountIndividualRelationshipOptions : INestedOptions, IHasSetTrack
/// <summary>
/// The percent owned by the person of the account's legal entity.
/// </summary>
[JsonProperty("percent_ownership")]
[JsonProperty("percent_ownership", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("percent_ownership")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public decimal? PercentOwnership
{
get => this.percentOwnership;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public class AccountSettingsCardIssuingTosAcceptanceOptions : INestedOptions, IH
/// The user agent of the browser from which the account representative accepted the service
/// agreement.
/// </summary>
[JsonProperty("user_agent")]
[JsonProperty("user_agent", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("user_agent")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public string UserAgent
{
get => this.userAgent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ public class AccountSettingsCardPaymentsOptions : INestedOptions, IHasSetTrackin
/// <c>statement_descriptor_prefix_kana</c> is useful for maximizing descriptor space for
/// the dynamic portion.
/// </summary>
[JsonProperty("statement_descriptor_prefix_kana")]
[JsonProperty("statement_descriptor_prefix_kana", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("statement_descriptor_prefix_kana")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public string StatementDescriptorPrefixKana
{
get => this.statementDescriptorPrefixKana;
Expand All @@ -59,8 +60,9 @@ public string StatementDescriptorPrefixKana
/// <c>statement_descriptor_prefix_kanji</c> is useful for maximizing descriptor space for
/// the dynamic portion.
/// </summary>
[JsonProperty("statement_descriptor_prefix_kanji")]
[JsonProperty("statement_descriptor_prefix_kanji", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("statement_descriptor_prefix_kanji")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public string StatementDescriptorPrefixKanji
{
get => this.statementDescriptorPrefixKanji;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ public class AccountSettingsInvoicesOptions : INestedOptions, IHasSetTracking
/// The list of default Account Tax IDs to automatically include on invoices. Account Tax
/// IDs get added when an invoice is finalized.
/// </summary>
[JsonProperty("default_account_tax_ids")]
[JsonProperty("default_account_tax_ids", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("default_account_tax_ids")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public List<string> DefaultAccountTaxIds
{
get => this.defaultAccountTaxIds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public class AccountSettingsTreasuryTosAcceptanceOptions : INestedOptions, IHasS
/// The user agent of the browser from which the account representative accepted the service
/// agreement.
/// </summary>
[JsonProperty("user_agent")]
[JsonProperty("user_agent", NullValueHandling = NullValueHandling.Ignore)]
[STJS.JsonPropertyName("user_agent")]
[STJS.JsonIgnore(Condition = STJS.JsonIgnoreCondition.WhenWritingNull)]
public string UserAgent
{
get => this.userAgent;
Expand Down
Loading
Loading