-
Notifications
You must be signed in to change notification settings - Fork 573
/
Copy pathDiscount.cs
160 lines (139 loc) · 5.55 KB
/
Discount.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
namespace Stripe
{
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class Discount : StripeEntity<Discount>, IHasId, IHasObject
{
/// <summary>
/// Unique identifier for the object.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }
/// <summary>
/// String representing the object's type. Objects of the same type share the same value.
/// </summary>
[JsonProperty("object")]
public string Object { get; set; }
/// <summary>
/// The Checkout session that this coupon is applied to, if it is applied to a particular
/// session in payment mode. Will not be present for subscription mode.
/// </summary>
[JsonProperty("checkout_session")]
public string CheckoutSession { get; set; }
/// <summary>
/// Hash describing the coupon applied to create this discount.
/// </summary>
[JsonProperty("coupon")]
public Coupon Coupon { get; set; }
#region Expandable Customer
/// <summary>
/// (ID of the Customer)
/// The ID of the customer associated with this discount.
/// </summary>
[JsonIgnore]
public string CustomerId
{
get => this.InternalCustomer?.Id;
set => this.InternalCustomer = SetExpandableFieldId(value, this.InternalCustomer);
}
/// <summary>
/// (Expanded)
/// The ID of the customer associated with this discount.
/// </summary>
[JsonIgnore]
public Customer Customer
{
get => this.InternalCustomer?.ExpandedObject;
set => this.InternalCustomer = SetExpandableFieldObject(value, this.InternalCustomer);
}
[JsonProperty("customer")]
[JsonConverter(typeof(ExpandableFieldConverter<Customer>))]
internal ExpandableField<Customer> InternalCustomer { get; set; }
#endregion
/// <summary>
/// Whether this object is deleted or not.
/// </summary>
[JsonProperty("deleted", NullValueHandling = NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
/// <summary>
/// If the coupon has a <c>duration</c> of <c>repeating</c>, the date that this discount
/// will end. If the coupon has a <c>duration</c> of <c>once</c> or forever, this attribute
/// will be null.
/// </summary>
[JsonProperty("end")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime? End { get; set; }
/// <summary>
/// The invoice that the discount’s coupon was applied to, if it was applied directly to a
/// particular invoice.
/// </summary>
[JsonProperty("invoice")]
public string Invoice { get; set; }
/// <summary>
/// The invoice item id (or invoice line item id for invoice line items of
/// type=‘subscription’) that the discount’s coupon was applied to, if it was applied
/// directly to a particular invoice item or invoice line item.
/// </summary>
[JsonProperty("invoice_item")]
public string InvoiceItem { get; set; }
#region Expandable PromotionCode
/// <summary>
/// (ID of the PromotionCode)
/// The promotion code applied to create this discount.
/// </summary>
[JsonIgnore]
public string PromotionCodeId
{
get => this.InternalPromotionCode?.Id;
set => this.InternalPromotionCode = SetExpandableFieldId(value, this.InternalPromotionCode);
}
/// <summary>
/// (Expanded)
/// The promotion code applied to create this discount.
/// </summary>
[JsonIgnore]
public PromotionCode PromotionCode
{
get => this.InternalPromotionCode?.ExpandedObject;
set => this.InternalPromotionCode = SetExpandableFieldObject(value, this.InternalPromotionCode);
}
[JsonProperty("promotion_code")]
[JsonConverter(typeof(ExpandableFieldConverter<PromotionCode>))]
internal ExpandableField<PromotionCode> InternalPromotionCode { get; set; }
#endregion
/// <summary>
/// Date that the coupon was applied.
/// </summary>
[JsonProperty("start")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime? Start { get; set; }
#region Expandable Subscription
/// <summary>
/// (ID of the Subscription)
/// The subscription that this coupon is applied to, if it is applied to a particular
/// subscription.
/// </summary>
[JsonIgnore]
public string SubscriptionId
{
get => this.InternalSubscription?.Id;
set => this.InternalSubscription = SetExpandableFieldId(value, this.InternalSubscription);
}
/// <summary>
/// (Expanded)
/// The subscription that this coupon is applied to, if it is applied to a particular
/// subscription.
/// </summary>
[JsonIgnore]
public Subscription Subscription
{
get => this.InternalSubscription?.ExpandedObject;
set => this.InternalSubscription = SetExpandableFieldObject(value, this.InternalSubscription);
}
[JsonProperty("subscription")]
[JsonConverter(typeof(ExpandableFieldConverter<Subscription>))]
internal ExpandableField<Subscription> InternalSubscription { get; set; }
#endregion
}
}