-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1892 from stripe/remi-add-spending-limits-card
Add better support for spending limits on Issuing Card
- Loading branch information
Showing
8 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/Stripe.net/Entities/Issuing/Authorizations/AuthorizationControls.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,49 @@ | ||
namespace Stripe.Issuing | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
// TODO: Rename to CardAuthorizationControls in a future major version and move to Card folder. | ||
public class AuthorizationControls : StripeEntity<AuthorizationControls> | ||
{ | ||
/// <summary> | ||
/// Categories of authorizations permitted for this card. | ||
/// </summary> | ||
[JsonProperty("allowed_categories")] | ||
public List<string> AllowedCategories { get; set; } | ||
|
||
/// <summary> | ||
/// Categories of authorizations to always decline for this card. | ||
/// </summary> | ||
[JsonProperty("blocked_categories")] | ||
public List<string> BlockedCategories { get; set; } | ||
|
||
[Obsolete("Use Card.Currency instead.")] | ||
[JsonProperty("currency")] | ||
public string Currency { get; set; } | ||
|
||
[Obsolete("Use SpendingLimits instead.")] | ||
[JsonProperty("max_amount")] | ||
public long? MaxAmount { get; set; } | ||
|
||
/// <summary> | ||
/// Maximum count of approved authorizations on this card. Counts all authorizations | ||
/// retroactively. | ||
/// </summary> | ||
[JsonProperty("max_approvals")] | ||
public long? MaxApprovals { get; set; } | ||
|
||
/// <summary> | ||
/// Limit the spending with rules based on time intervals and categories. | ||
/// </summary> | ||
[JsonProperty("spending_limits")] | ||
public List<CardAuthorizationControlsSpendingLimit> SpendingLimits { get; set; } | ||
|
||
/// <summary> | ||
/// Currency for the amounts within spending_limits. Locked to the currency of the card. | ||
/// </summary> | ||
[JsonProperty("spending_limits_currency")] | ||
public string SpendingLimitsCurrency { get; set; } | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/Stripe.net/Entities/Issuing/Authorizations/CardAuthorizationControlsSpendingLimit.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace Stripe.Issuing | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
public class CardAuthorizationControlsSpendingLimit : StripeEntity<CardAuthorizationControlsSpendingLimit> | ||
{ | ||
/// <summary> | ||
/// Maximum amount allowed to spend per time interval. | ||
/// </summary> | ||
[JsonProperty("amount")] | ||
public long Amount { get; set; } | ||
|
||
/// <summary> | ||
/// Categories on which to apply the spending limit. Leave this empty to limit all charges. | ||
/// </summary> | ||
[JsonProperty("categories")] | ||
public List<string> Categories { get; set; } | ||
|
||
/// <summary> | ||
/// The time interval with which to apply this spending limit towards. Allowed values are | ||
/// <c>per_authorization</c>, <c>daily</c>, <c>weekly</c>, <c>monthly</c>, <c>yearly</c>, | ||
/// or <c>all_time</c>. | ||
/// </summary> | ||
[JsonProperty("interval")] | ||
public string Interval { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/Stripe.net/Services/Issuing/Cards/AuthorizationControlsOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
namespace Stripe.Issuing | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
// TODO: Rename to CardAuthorizationControls in a future major version and move to Card folder. | ||
public class AuthorizationControlsOptions : INestedOptions | ||
{ | ||
/// <summary> | ||
/// Categories of authorizations permitted for this card. | ||
/// </summary> | ||
[JsonProperty("allowed_categories")] | ||
public List<string> AllowedCategories { get; set; } | ||
|
||
/// <summary> | ||
/// Categories of authorizations to always decline for this card. | ||
/// </summary> | ||
[JsonProperty("blocked_categories")] | ||
public List<string> BlockedCategories { get; set; } | ||
|
||
[Obsolete("Use SpendingLimits instead.")] | ||
[JsonProperty("max_amount")] | ||
public long? MaxAmount { get; set; } | ||
|
||
/// <summary> | ||
/// Maximum count of approved authorizations on this card. Counts all authorizations | ||
/// retroactively. | ||
/// </summary> | ||
[JsonProperty("max_approvals")] | ||
public long? MaxApprovals { get; set; } | ||
|
||
/// <summary> | ||
/// Limit the spending with rules based on time intervals and categories. | ||
/// </summary> | ||
[JsonProperty("spending_limits")] | ||
public List<CardAuthorizationControlsSpendingLimitOptions> SpendingLimits { get; set; } | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Stripe.net/Services/Issuing/Cards/CardAuthorizationControlsSpendingLimitOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace Stripe.Issuing | ||
{ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
public class CardAuthorizationControlsSpendingLimitOptions : INestedOptions | ||
{ | ||
/// <summary> | ||
/// Maximum amount allowed to spend per time interval. | ||
/// </summary> | ||
[JsonProperty("amount")] | ||
public long? Amount { get; set; } | ||
|
||
/// <summary> | ||
/// Categories on which to apply the spending limit. Leave this empty to limit all charges. | ||
/// </summary> | ||
[JsonProperty("categories")] | ||
public List<string> Categories { get; set; } | ||
|
||
/// <summary> | ||
/// The time interval with which to apply this spending limit towards. Allowed values are | ||
/// <c>per_authorization</c>, <c>daily</c>, <c>weekly</c>, <c>monthly</c>, <c>yearly</c>, | ||
/// or <c>all_time</c>. | ||
/// </summary> | ||
[JsonProperty("interval")] | ||
public string Interval { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters