-
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.
- Loading branch information
Showing
12 changed files
with
107 additions
and
32 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
namespace Stripe | ||
{ | ||
using System.Runtime.Serialization; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
[JsonConverter(typeof(StringEnumConverter))] | ||
public enum PlanTierUpTo | ||
public class PlanTierUpTo : StringEnum | ||
{ | ||
/// <summary>Use this value to define a fallback tier.</summary> | ||
[EnumMember(Value = "inf")] | ||
Inf, | ||
public static readonly PlanTierUpTo Inf = new PlanTierUpTo("inf"); | ||
|
||
private PlanTierUpTo(string value) | ||
: base(value) | ||
{ | ||
} | ||
} | ||
} |
20 changes: 10 additions & 10 deletions
20
src/Stripe.net/Services/Subscriptions/SubscriptionBillingCycleAnchor.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,18 +1,18 @@ | ||
namespace Stripe | ||
{ | ||
using System.Runtime.Serialization; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
[JsonConverter(typeof(StringEnumConverter))] | ||
public enum SubscriptionBillingCycleAnchor | ||
public class SubscriptionBillingCycleAnchor : StringEnum | ||
{ | ||
/// <summary>Resets the subscription's billing cycle anchor to the current time.</summary> | ||
[EnumMember(Value = "now")] | ||
Now, | ||
public static readonly SubscriptionBillingCycleAnchor Now | ||
= new SubscriptionBillingCycleAnchor("now"); | ||
|
||
/// <summary>Leaves the subscription's billing cycle anchor unchanged.</summary> | ||
[EnumMember(Value = "unchanged")] | ||
Unchanged, | ||
public static readonly SubscriptionBillingCycleAnchor Unchanged | ||
= new SubscriptionBillingCycleAnchor("unchanged"); | ||
|
||
private SubscriptionBillingCycleAnchor(string value) | ||
: base(value) | ||
{ | ||
} | ||
} | ||
} |
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
15 changes: 7 additions & 8 deletions
15
src/Stripe.net/Services/Subscriptions/SubscriptionTrialEnd.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,14 +1,13 @@ | ||
namespace Stripe | ||
{ | ||
using System.Runtime.Serialization; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
[JsonConverter(typeof(StringEnumConverter))] | ||
public enum SubscriptionTrialEnd | ||
public class SubscriptionTrialEnd : StringEnum | ||
{ | ||
/// <summary>Special value used to end a customer's trial immediately.</summary> | ||
[EnumMember(Value = "now")] | ||
Now, | ||
public static readonly SubscriptionTrialEnd Now = new SubscriptionTrialEnd("now"); | ||
|
||
private SubscriptionTrialEnd(string value) | ||
: base(value) | ||
{ | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
namespace Stripe | ||
{ | ||
/// <summary> | ||
/// Abstract base class for string enum parameters. | ||
/// </summary> | ||
/// <remarks> | ||
/// This class is used to define request parameters that can only take certain string values. | ||
/// We use it instead of defining a regular <c>enum</c> with | ||
/// <see cref="System.Runtime.Serialization.EnumMemberAttribute"/> annotations for | ||
/// serialization because <c>enum</c> is really an integer under the hood. This can be | ||
/// problematic in some cases, like when a parameter can be an integer OR a string enum (e.g. | ||
/// <see cref="PlanTierOptions.UpTo"/>). | ||
/// </remarks> | ||
/// <example> | ||
/// This sample shows how to define a new string enum type. | ||
/// <code> | ||
/// public class FooBar : StringEnum | ||
/// { | ||
/// public static readonly FooBar Foo = new FooBar("foo"); | ||
/// public static readonly FooBar Bar = new FooBar("bar"); | ||
/// | ||
/// private FooBar(string value) : base(value) {} | ||
/// } | ||
/// </code> | ||
/// </example> | ||
public abstract class StringEnum | ||
{ | ||
/// <summary>Initializes a new instance of the <see cref="StringEnum"/> class.</summary> | ||
/// <param name="value">The serialized value for the instance.</param> | ||
protected StringEnum(string value) | ||
{ | ||
this.Value = value; | ||
} | ||
|
||
/// <summary>Gets or sets the serialized value.</summary> | ||
/// <returns>The serialized value.</returns> | ||
public string Value { get; protected set; } | ||
|
||
/// <summary>Returns the serialized value.</summary> | ||
/// <returns>The serialized value.</returns> | ||
public override string ToString() | ||
{ | ||
return this.Value; | ||
} | ||
} | ||
} |
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