|
| 1 | +namespace Stripe |
| 2 | +{ |
| 3 | + using System; |
| 4 | + using System.Collections.Generic; |
| 5 | + using Newtonsoft.Json; |
| 6 | + using Stripe.Infrastructure; |
| 7 | + |
| 8 | + public class SubscriptionSchedule : StripeEntity, IHasId, IHasMetadata, IHasObject |
| 9 | + { |
| 10 | + [JsonProperty("id")] |
| 11 | + public string Id { get; set; } |
| 12 | + |
| 13 | + [JsonProperty("object")] |
| 14 | + public string Object { get; set; } |
| 15 | + |
| 16 | + /// <summary> |
| 17 | + /// One of <see cref="Billing" />. When charging automatically, Stripe will attempt to pay |
| 18 | + /// this subscription at the end of the cycle using the default source attached to the |
| 19 | + /// customer. When sending an invoice, Stripe will email your customer an invoice with |
| 20 | + /// payment instructions. |
| 21 | + /// </summary> |
| 22 | + [JsonProperty("billing")] |
| 23 | + public Billing? Billing { get; set; } |
| 24 | + |
| 25 | + /// <summary> |
| 26 | + /// Define thresholds at which an invoice will be sent, and the subscription advanced to a |
| 27 | + /// new billing period |
| 28 | + /// </summary> |
| 29 | + [JsonProperty("billing_thresholds")] |
| 30 | + public SubscriptionBillingThresholds BillingThresholds { get; set; } |
| 31 | + |
| 32 | + /// <summary> |
| 33 | + /// Time at which the subscription schedule was canceled. Measured in seconds since the |
| 34 | + /// Unix epoch. |
| 35 | + /// </summary> |
| 36 | + [JsonProperty("canceled_at")] |
| 37 | + [JsonConverter(typeof(DateTimeConverter))] |
| 38 | + public DateTime? CanceledAt { get; set; } |
| 39 | + |
| 40 | + /// <summary> |
| 41 | + /// Time at which the subscription schedule was completed. Measured in seconds since the |
| 42 | + /// Unix epoch. |
| 43 | + /// </summary> |
| 44 | + [JsonProperty("completed_at")] |
| 45 | + [JsonConverter(typeof(DateTimeConverter))] |
| 46 | + public DateTime? CompletedAt { get; set; } |
| 47 | + |
| 48 | + /// <summary> |
| 49 | + /// Time at which the object was created. Measured in seconds since the Unix epoch. |
| 50 | + /// </summary> |
| 51 | + [JsonProperty("created")] |
| 52 | + [JsonConverter(typeof(DateTimeConverter))] |
| 53 | + public DateTime? Created { get; set; } |
| 54 | + |
| 55 | + /// <summary> |
| 56 | + /// Object representing the start and end dates for the current phase of the subscription |
| 57 | + /// schedule, if it is <code>active</code>. |
| 58 | + /// </summary> |
| 59 | + [JsonProperty("current_phase")] |
| 60 | + public SubscriptionScheduleCurrentPhase CurrentPhase { get; set; } |
| 61 | + |
| 62 | + // TODO: figure out how we document those |
| 63 | + #region Expandable Customer |
| 64 | + [JsonIgnore] |
| 65 | + public string CustomerId { get; set; } |
| 66 | + |
| 67 | + [JsonIgnore] |
| 68 | + public Customer Customer { get; set; } |
| 69 | + |
| 70 | + [JsonProperty("customer")] |
| 71 | + internal object InternalCustomer |
| 72 | + { |
| 73 | + get |
| 74 | + { |
| 75 | + return this.Customer ?? (object)this.CustomerId; |
| 76 | + } |
| 77 | + |
| 78 | + set |
| 79 | + { |
| 80 | + StringOrObject<Customer>.Map(value, s => this.CustomerId = s, o => this.Customer = o); |
| 81 | + } |
| 82 | + } |
| 83 | + #endregion |
| 84 | + |
| 85 | + /// <summary> |
| 86 | + /// TODO: Figure out docs. |
| 87 | + /// </summary> |
| 88 | + [JsonProperty("footer")] |
| 89 | + public SubscriptionScheduleInvoiceSettings InvoiceSettings { get; set; } |
| 90 | + |
| 91 | + /// <summary> |
| 92 | + /// Has the value <code>true</code> if the object exists in live mode or the value |
| 93 | + /// <code>false</code> if the object exists in test mode. |
| 94 | + /// </summary> |
| 95 | + [JsonProperty("livemode")] |
| 96 | + public bool Livemode { get; set; } |
| 97 | + |
| 98 | + /// <summary> |
| 99 | + /// A set of key/value pairs that you can attach to a subscription schedule object. |
| 100 | + /// </summary> |
| 101 | + [JsonProperty("metadata")] |
| 102 | + public Dictionary<string, string> Metadata { get; set; } |
| 103 | + |
| 104 | + /// <summary> |
| 105 | + /// Configuration for the subscription schedule’s phases. |
| 106 | + /// </summary> |
| 107 | + [JsonProperty("phases")] |
| 108 | + public List<SubscriptionSchedulePhase> Phases { get; set; } |
| 109 | + |
| 110 | + /// <summary> |
| 111 | + /// Time at which the subscription schedule was released. Measured in seconds since the |
| 112 | + /// Unix epoch. |
| 113 | + /// </summary> |
| 114 | + [JsonProperty("released_at")] |
| 115 | + [JsonConverter(typeof(DateTimeConverter))] |
| 116 | + public DateTime? ReleasedAt { get; set; } |
| 117 | + |
| 118 | + // TODO: figure out how we document those |
| 119 | + #region Expandable ReleasedSubscription |
| 120 | + [JsonIgnore] |
| 121 | + public string ReleasedSubscriptionId { get; set; } |
| 122 | + |
| 123 | + [JsonIgnore] |
| 124 | + public Subscription ReleasedSubscription { get; set; } |
| 125 | + |
| 126 | + [JsonProperty("released_subscription")] |
| 127 | + internal object InternalReleasedSubscription |
| 128 | + { |
| 129 | + get |
| 130 | + { |
| 131 | + return this.ReleasedSubscription ?? (object)this.ReleasedSubscriptionId; |
| 132 | + } |
| 133 | + |
| 134 | + set |
| 135 | + { |
| 136 | + StringOrObject<Subscription>.Map(value, s => this.ReleasedSubscriptionId = s, o => this.ReleasedSubscription = o); |
| 137 | + } |
| 138 | + } |
| 139 | + #endregion |
| 140 | + |
| 141 | + /// <summary> |
| 142 | + /// Behavior of the subscription schedule and underlying subscription when it ends. |
| 143 | + /// </summary> |
| 144 | + [JsonProperty("renewal_behavior")] |
| 145 | + public string RenewalBehavior { get; set; } |
| 146 | + |
| 147 | + /// <summary> |
| 148 | + /// Interval and duration at which the subscription schedule renews for when it ends if |
| 149 | + /// <code>renewal_behavior</code> is <code>renew</code>. |
| 150 | + /// </summary> |
| 151 | + [JsonProperty("renewal_interval")] |
| 152 | + public SubscriptionScheduleRenewalInterval RenewalInterval { get; set; } |
| 153 | + |
| 154 | + /// <summary> |
| 155 | + /// ID of the current revision of the subscription schedule. |
| 156 | + /// </summary> |
| 157 | + [JsonProperty("revision")] |
| 158 | + public string Revision { get; set; } |
| 159 | + |
| 160 | + /// <summary> |
| 161 | + /// Possible values are <code>active</code>, <code>canceled</code>, <code>completed</code>, |
| 162 | + /// <code>not_started</code>, <code>released</code> and <code>renewal_behavior</code>. |
| 163 | + /// </summary> |
| 164 | + [JsonProperty("status")] |
| 165 | + public string Status { get; set; } |
| 166 | + |
| 167 | + // TODO: figure out how we document those |
| 168 | + #region Expandable Subscription |
| 169 | + [JsonIgnore] |
| 170 | + public string SubscriptionId { get; set; } |
| 171 | + |
| 172 | + [JsonIgnore] |
| 173 | + public Subscription Subscription { get; set; } |
| 174 | + |
| 175 | + [JsonProperty("subscription")] |
| 176 | + internal object InternalSubscription |
| 177 | + { |
| 178 | + get |
| 179 | + { |
| 180 | + return this.Subscription ?? (object)this.SubscriptionId; |
| 181 | + } |
| 182 | + |
| 183 | + set |
| 184 | + { |
| 185 | + StringOrObject<Subscription>.Map(value, s => this.SubscriptionId = s, o => this.Subscription = o); |
| 186 | + } |
| 187 | + } |
| 188 | + #endregion |
| 189 | + } |
| 190 | +} |
0 commit comments