-
Notifications
You must be signed in to change notification settings - Fork 566
/
Customer.cs
280 lines (244 loc) · 11.2 KB
/
Customer.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
// File generated from our OpenAPI spec
namespace Stripe
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
/// <summary>
/// This object represents a customer of your business. It lets you create recurring charges
/// and track payments that belong to the same customer.
///
/// Related guide: <a href="https://stripe.com/docs/payments/save-during-payment">Save a
/// card during payment</a>.
/// </summary>
public class Customer : StripeEntity<Customer>, IHasId, IHasMetadata, 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 customer's address.
/// </summary>
[JsonProperty("address")]
public Address Address { get; set; }
/// <summary>
/// Current balance, if any, being stored on the customer. If negative, the customer has
/// credit to apply to their next invoice. If positive, the customer has an amount owed that
/// will be added to their next invoice. The balance does not refer to any unpaid invoices;
/// it solely takes into account amounts that have yet to be successfully applied to any
/// invoice. This balance is only taken into account as invoices are finalized.
/// </summary>
[JsonProperty("balance")]
public long Balance { get; set; }
/// <summary>
/// The current funds being held by Stripe on behalf of the customer. These funds can be
/// applied towards payment intents with source "cash_balance".The
/// settings[reconciliation_mode] field describes whether these funds are applied to such
/// payment intents manually or automatically.
/// </summary>
[JsonProperty("cash_balance")]
public CashBalance CashBalance { get; set; }
/// <summary>
/// Time at which the object was created. Measured in seconds since the Unix epoch.
/// </summary>
[JsonProperty("created")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTime Created { get; set; } = Stripe.Infrastructure.DateTimeUtils.UnixEpoch;
/// <summary>
/// Three-letter <a href="https://stripe.com/docs/currencies">ISO code for the currency</a>
/// the customer can be charged in for recurring billing purposes.
/// </summary>
[JsonProperty("currency")]
public string Currency { get; set; }
/// <summary>
/// The default three-letter <a href="https://stripe.com/docs/currencies">ISO code for the
/// currency</a> that the customer will be charged in for billing purposes.
/// </summary>
[JsonProperty("default_currency")]
public string DefaultCurrency { get; set; }
#region Expandable DefaultSource
/// <summary>
/// (ID of the IPaymentSource)
/// ID of the default payment source for the customer.
///
/// If you are using payment methods created via the PaymentMethods API, see the <a
/// href="https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method">invoice_settings.default_payment_method</a>
/// field instead.
/// </summary>
[JsonIgnore]
public string DefaultSourceId
{
get => this.InternalDefaultSource?.Id;
set => this.InternalDefaultSource = SetExpandableFieldId(value, this.InternalDefaultSource);
}
/// <summary>
/// (Expanded)
/// ID of the default payment source for the customer.
///
/// If you are using payment methods created via the PaymentMethods API, see the <a
/// href="https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method">invoice_settings.default_payment_method</a>
/// field instead.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public IPaymentSource DefaultSource
{
get => this.InternalDefaultSource?.ExpandedObject;
set => this.InternalDefaultSource = SetExpandableFieldObject(value, this.InternalDefaultSource);
}
[JsonProperty("default_source")]
[JsonConverter(typeof(ExpandableFieldConverter<IPaymentSource>))]
internal ExpandableField<IPaymentSource> InternalDefaultSource { get; set; }
#endregion
/// <summary>
/// Whether this object is deleted or not.
/// </summary>
[JsonProperty("deleted", NullValueHandling = NullValueHandling.Ignore)]
public bool? Deleted { get; set; }
/// <summary>
/// When the customer's latest invoice is billed by charging automatically,
/// <c>delinquent</c> is <c>true</c> if the invoice's latest charge failed. When the
/// customer's latest invoice is billed by sending an invoice, <c>delinquent</c> is
/// <c>true</c> if the invoice isn't paid by its due date.
///
/// If an invoice is marked uncollectible by <a
/// href="https://stripe.com/docs/billing/automatic-collection">dunning</a>,
/// <c>delinquent</c> doesn't get reset to <c>false</c>.
/// </summary>
[JsonProperty("delinquent")]
public bool? Delinquent { get; set; }
/// <summary>
/// An arbitrary string attached to the object. Often useful for displaying to users.
/// </summary>
[JsonProperty("description")]
public string Description { get; set; }
/// <summary>
/// Describes the current discount active on the customer, if there is one.
/// </summary>
[JsonProperty("discount")]
public Discount Discount { get; set; }
/// <summary>
/// The customer's email address.
/// </summary>
[JsonProperty("email")]
public string Email { get; set; }
/// <summary>
/// The current multi-currency balances, if any, being stored on the customer.If positive in
/// a currency, the customer has a credit to apply to their next invoice denominated in that
/// currency.If negative, the customer has an amount owed that will be added to their next
/// invoice denominated in that currency. These balances do not refer to any unpaid
/// invoices.They solely track amounts that have yet to be successfully applied to any
/// invoice. A balance in a particular currency is only applied to any invoice as an invoice
/// in that currency is finalized.
/// </summary>
[JsonProperty("invoice_credit_balance")]
public Dictionary<string, long> InvoiceCreditBalance { get; set; }
/// <summary>
/// The prefix for the customer used to generate unique invoice numbers.
/// </summary>
[JsonProperty("invoice_prefix")]
public string InvoicePrefix { get; set; }
[JsonProperty("invoice_settings")]
public CustomerInvoiceSettings InvoiceSettings { get; set; }
/// <summary>
/// Has the value <c>true</c> if the object exists in live mode or the value <c>false</c> if
/// the object exists in test mode.
/// </summary>
[JsonProperty("livemode")]
public bool Livemode { get; set; }
/// <summary>
/// Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
/// attach to an object. This can be useful for storing additional information about the
/// object in a structured format.
/// </summary>
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
/// <summary>
/// The customer's full name or business name.
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// The suffix of the customer's next invoice number, e.g., 0001.
/// </summary>
[JsonProperty("next_invoice_sequence")]
public long NextInvoiceSequence { get; set; }
/// <summary>
/// The customer's phone number.
/// </summary>
[JsonProperty("phone")]
public string Phone { get; set; }
/// <summary>
/// The customer's preferred locales (languages), ordered by preference.
/// </summary>
[JsonProperty("preferred_locales")]
public List<string> PreferredLocales { get; set; }
/// <summary>
/// Mailing and shipping address for the customer. Appears on invoices emailed to this
/// customer.
/// </summary>
[JsonProperty("shipping")]
public Shipping Shipping { get; set; }
/// <summary>
/// The customer's payment sources, if any.
/// </summary>
[JsonProperty("sources")]
public StripeList<IPaymentSource> Sources { get; set; }
/// <summary>
/// The customer's current subscriptions, if any.
/// </summary>
[JsonProperty("subscriptions")]
public StripeList<Subscription> Subscriptions { get; set; }
[JsonProperty("tax")]
public CustomerTax Tax { get; set; }
/// <summary>
/// Describes the customer's tax exemption status. One of <c>none</c>, <c>exempt</c>, or
/// <c>reverse</c>. When set to <c>reverse</c>, invoice and receipt PDFs include the text
/// <strong>"Reverse charge"</strong>.
/// One of: <c>exempt</c>, <c>none</c>, or <c>reverse</c>.
/// </summary>
[JsonProperty("tax_exempt")]
public string TaxExempt { get; set; }
/// <summary>
/// The customer's tax IDs.
/// </summary>
[JsonProperty("tax_ids")]
public StripeList<TaxId> TaxIds { get; set; }
#region Expandable TestClock
/// <summary>
/// (ID of the TestHelpers.TestClock)
/// ID of the test clock this customer belongs to.
/// </summary>
[JsonIgnore]
public string TestClockId
{
get => this.InternalTestClock?.Id;
set => this.InternalTestClock = SetExpandableFieldId(value, this.InternalTestClock);
}
/// <summary>
/// (Expanded)
/// ID of the test clock this customer belongs to.
///
/// For more information, see the <a href="https://stripe.com/docs/expand">expand documentation</a>.
/// </summary>
[JsonIgnore]
public TestHelpers.TestClock TestClock
{
get => this.InternalTestClock?.ExpandedObject;
set => this.InternalTestClock = SetExpandableFieldObject(value, this.InternalTestClock);
}
[JsonProperty("test_clock")]
[JsonConverter(typeof(ExpandableFieldConverter<TestHelpers.TestClock>))]
internal ExpandableField<TestHelpers.TestClock> InternalTestClock { get; set; }
#endregion
}
}