diff --git a/src/Stripe.net/Entities/Issuing/Cardholders/Cardholder.cs b/src/Stripe.net/Entities/Issuing/Cardholders/Cardholder.cs index 6770a597a1..fd5d903867 100644 --- a/src/Stripe.net/Entities/Issuing/Cardholders/Cardholder.cs +++ b/src/Stripe.net/Entities/Issuing/Cardholders/Cardholder.cs @@ -13,6 +13,9 @@ public class Cardholder : StripeEntity, IHasId, IHasMetadata, IHasObject [JsonProperty("object")] public string Object { get; set; } + [JsonProperty("authorization_controls")] + public AuthorizationControls AuthorizationControls { get; set; } + [JsonProperty("billing")] public Billing Billing { get; set; } diff --git a/src/Stripe.net/Entities/Issuing/Authorizations/AuthorizationControls.cs b/src/Stripe.net/Entities/Issuing/Cards/AuthorizationControls.cs similarity index 50% rename from src/Stripe.net/Entities/Issuing/Authorizations/AuthorizationControls.cs rename to src/Stripe.net/Entities/Issuing/Cards/AuthorizationControls.cs index 7393bdcce6..488839e524 100644 --- a/src/Stripe.net/Entities/Issuing/Authorizations/AuthorizationControls.cs +++ b/src/Stripe.net/Entities/Issuing/Cards/AuthorizationControls.cs @@ -1,22 +1,38 @@ namespace Stripe.Issuing { + using System; using System.Collections.Generic; using Newtonsoft.Json; public class AuthorizationControls : StripeEntity { + /// + /// Categories of authorizations permitted on this card. + /// [JsonProperty("allowed_categories")] public List AllowedCategories { get; set; } + /// + /// Categories of authorizations to always decline on this card. + /// [JsonProperty("blocked_categories")] public List BlockedCategories { get; set; } + /// + /// Limit the spending with rules based on time intervals and categories. + /// + [JsonProperty("spending_limits")] + public List SpendingLimits { get; set; } + + [Obsolete("This is now unsupported")] [JsonProperty("currency")] public string Currency { get; set; } + [Obsolete("Use SpendingLimits")] [JsonProperty("max_amount")] public long? MaxAmount { get; set; } + [Obsolete("Use SpendingLimits")] [JsonProperty("max_approvals")] public long? MaxApprovals { get; set; } } diff --git a/src/Stripe.net/Entities/Issuing/Cards/SpendingLimit.cs b/src/Stripe.net/Entities/Issuing/Cards/SpendingLimit.cs new file mode 100644 index 0000000000..f0a0693c52 --- /dev/null +++ b/src/Stripe.net/Entities/Issuing/Cards/SpendingLimit.cs @@ -0,0 +1,28 @@ +namespace Stripe.Issuing +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class SpendingLimit : StripeEntity + { + /// + /// Maximum amount allowed to spend per time interval. + /// + [JsonProperty("amount")] + public long? Amount { get; set; } + + /// + /// Categories on which to apply the spending limit. Leave this empty to limit all charges. + /// + [JsonProperty("categories")] + public List Categories { get; set; } + + /// + /// The time interval with which to apply this spending limit towards. Allowed values are + /// per_authorization, daily, weekly, monthly, yearly, + /// or all_time. + /// + [JsonProperty("interval")] + public string Interval { get; set; } + } +} diff --git a/src/Stripe.net/Services/Issuing/Cardholders/CardholderCreateOptions.cs b/src/Stripe.net/Services/Issuing/Cardholders/CardholderCreateOptions.cs index ba571d2ea3..1721583dc3 100644 --- a/src/Stripe.net/Services/Issuing/Cardholders/CardholderCreateOptions.cs +++ b/src/Stripe.net/Services/Issuing/Cardholders/CardholderCreateOptions.cs @@ -5,6 +5,9 @@ namespace Stripe.Issuing public class CardholderCreateOptions : CardholderSharedOptions { + /// + /// The type of cardholder. Possible values are individual or business_entity. + /// [JsonProperty("type")] public string Type { get; set; } } diff --git a/src/Stripe.net/Services/Issuing/Cardholders/CardholderListOptions.cs b/src/Stripe.net/Services/Issuing/Cardholders/CardholderListOptions.cs index 57513469a9..ffa3f5ff3f 100644 --- a/src/Stripe.net/Services/Issuing/Cardholders/CardholderListOptions.cs +++ b/src/Stripe.net/Services/Issuing/Cardholders/CardholderListOptions.cs @@ -4,15 +4,35 @@ namespace Stripe.Issuing public class CardholderListOptions : ListOptionsWithCreated { + /// + /// Only return cardholders that have the given email address. + /// [JsonProperty("email")] public string Email { get; set; } + /// + /// Only return the default cardholder. + /// + [JsonProperty("is_default")] + public bool? IsDefault { get; set; } + + /// + /// Only return cardholders that have the given phone number. + /// [JsonProperty("phone_number")] public string PhoneNumber { get; set; } + /// + /// Only return cardholders that have the given status. One of active, + /// inactive, or blocked. + /// [JsonProperty("status")] public string Status { get; set; } + /// + /// Only return cardholders that have the given type. One of individual or + /// business_entity. + /// [JsonProperty("type")] public string Type { get; set; } } diff --git a/src/Stripe.net/Services/Issuing/Cardholders/CardholderSharedOptions.cs b/src/Stripe.net/Services/Issuing/Cardholders/CardholderSharedOptions.cs index b62aa7a0b5..b1dc4feb26 100644 --- a/src/Stripe.net/Services/Issuing/Cardholders/CardholderSharedOptions.cs +++ b/src/Stripe.net/Services/Issuing/Cardholders/CardholderSharedOptions.cs @@ -5,21 +5,53 @@ namespace Stripe.Issuing public class CardholderSharedOptions : BaseOptions { + /// + /// Spending rules that give you control over how your cardholders can make charges. + /// + [JsonProperty("authorization_controls")] + public AuthorizationControlsOptions AuthorizationControls { get; set; } + + /// + /// The cardholder’s billing address. + /// [JsonProperty("billing")] public BillingOptions Billing { get; set; } + /// + /// The cardholder’s email address. + /// [JsonProperty("email")] public string Email { get; set; } + /// + /// Specifies whether to set this as the default cardholder. + /// + [JsonProperty("is_default")] + public bool? IsDefault { get; set; } + + /// + /// A set of key/value pairs that you can attach to a charge object. It can be useful for + /// storing additional information about the charge in a structured format. + /// [JsonProperty("metadata")] public Dictionary Metadata { get; set; } + /// + /// The cardholder’s name. This will be printed on cards issued to them. + /// [JsonProperty("name")] public string Name { get; set; } + /// + /// Maximum amount allowed to spend per time interval. + /// [JsonProperty("phone_number")] public string PhoneNumber { get; set; } + /// + /// Specifies whether to permit authorizations on this cardholder’s cards. Possible values + /// are active or inactive. + /// [JsonProperty("status")] public string Status { get; set; } } diff --git a/src/Stripe.net/Services/Issuing/Cards/AuthorizationControlsOptions.cs b/src/Stripe.net/Services/Issuing/Cards/AuthorizationControlsOptions.cs index 6a3e097581..b3bb9d22a6 100644 --- a/src/Stripe.net/Services/Issuing/Cards/AuthorizationControlsOptions.cs +++ b/src/Stripe.net/Services/Issuing/Cards/AuthorizationControlsOptions.cs @@ -1,19 +1,34 @@ namespace Stripe.Issuing { + using System; using System.Collections.Generic; using Newtonsoft.Json; public class AuthorizationControlsOptions : INestedOptions { + /// + /// Categories of authorizations permitted on this card. + /// [JsonProperty("allowed_categories")] public List AllowedCategories { get; set; } + /// + /// Categories of authorizations to always decline on this card. + /// [JsonProperty("blocked_categories")] public List BlockedCategories { get; set; } + /// + /// Limit the spending with rules based on time intervals and categories. + /// + [JsonProperty("spending_limits")] + public List SpendingLimits { get; set; } + + [Obsolete("Use SpendingLimits")] [JsonProperty("max_amount")] public long? MaxAmount { get; set; } + [Obsolete("Use SpendingLimits")] [JsonProperty("max_approvals")] public long? MaxApprovals { get; set; } } diff --git a/src/Stripe.net/Services/Issuing/Cards/SpendingLimitOptions.cs b/src/Stripe.net/Services/Issuing/Cards/SpendingLimitOptions.cs new file mode 100644 index 0000000000..3353b9b3af --- /dev/null +++ b/src/Stripe.net/Services/Issuing/Cards/SpendingLimitOptions.cs @@ -0,0 +1,28 @@ +namespace Stripe.Issuing +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class SpendingLimitOptions : INestedOptions + { + /// + /// Maximum amount allowed to spend per time interval. + /// + [JsonProperty("amount")] + public long? Amount { get; set; } + + /// + /// categories on which to apply the spending limit. Leave this empty to limit all charges. + /// + [JsonProperty("categories")] + public List Categories { get; set; } + + /// + /// The time interval with which to apply this spending limit towards. Allowed values are + /// per_authorization, daily, weekly, monthly, yearly, + /// or all_time. + /// + [JsonProperty("interval")] + public string Interval { get; set; } + } +} diff --git a/src/StripeTests/Services/Issuing/Cards/IssuingCardServiceTest.cs b/src/StripeTests/Services/Issuing/Cards/IssuingCardServiceTest.cs index e95a270739..4a85140a2f 100644 --- a/src/StripeTests/Services/Issuing/Cards/IssuingCardServiceTest.cs +++ b/src/StripeTests/Services/Issuing/Cards/IssuingCardServiceTest.cs @@ -26,7 +26,18 @@ public IssuingCardServiceTest(MockHttpClientFixture mockHttpClientFixture) { AuthorizationControls = new AuthorizationControlsOptions { - MaxAmount = 123, + SpendingLimits = new List + { + new SpendingLimitOptions + { + Amount = 1000, + Categories = new List + { + "financial_institutions", + }, + Interval = "all_time", + }, + }, }, Currency = "usd", Type = "virtual",