-
Notifications
You must be signed in to change notification settings - Fork 573
/
Copy pathCharge.cs
executable file
·382 lines (313 loc) · 12.6 KB
/
Charge.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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
namespace Stripe
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Stripe.Infrastructure;
public class Charge : StripeEntityWithId, ISupportMetadata
{
[JsonProperty("object")]
public string Object { get; set; }
/// <summary>
/// A positive integer in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a 0-decimal currency) representing how much to charge. The minimum amount is $0.50 US or equivalent in charge currency.
/// </summary>
[JsonProperty("amount")]
public int Amount { get; set; }
/// <summary>
/// Amount in cents refunded (can be less than the amount attribute on the charge if a partial refund was issued).
/// </summary>
[JsonProperty("amount_refunded")]
public int AmountRefunded { get; set; }
#region Expandable Application
public string ApplicationId { get; set; }
[JsonIgnore]
public Application Application { get; set; }
[JsonProperty("application")]
internal object InternalApplication
{
set
{
StringOrObject<Application>.Map(value, s => this.ApplicationId = s, o => this.Application = o);
}
}
#endregion
#region Expandable Application Fee
public string ApplicationFeeId { get; set; }
/// <summary>
/// The application fee (if any) for the charge. See the Connect documentation for details.
/// </summary>
[JsonIgnore]
public ApplicationFee ApplicationFee { get; set; }
[JsonProperty("application_fee")]
internal object InternalApplicationFee
{
set
{
StringOrObject<ApplicationFee>.Map(value, s => this.ApplicationFeeId = s, o => this.ApplicationFee = o);
}
}
#endregion
#region Expandable Balance Transaction
/// <summary>
/// ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes).
/// </summary>
public string BalanceTransactionId { get; set; }
[JsonIgnore]
public BalanceTransaction BalanceTransaction { get; set; }
[JsonProperty("balance_transaction")]
internal object InternalBalanceTransaction
{
set
{
StringOrObject<BalanceTransaction>.Map(value, s => this.BalanceTransactionId = s, o => this.BalanceTransaction = o);
}
}
#endregion
/// <summary>
/// If the charge was created without capturing, this boolean represents whether or not it is still uncaptured or has since been captured.
/// </summary>
[JsonProperty("captured")]
public bool? Captured { get; set; }
[JsonProperty("created")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime Created { get; set; }
/// <summary>
/// Three-letter ISO currency code representing the currency in which the charge was made.
/// </summary>
[JsonProperty("currency")]
public string Currency { get; set; }
#region Expandable Customer
/// <summary>
/// ID of the customer this charge is for if one exists.
/// </summary>
public string CustomerId { get; set; }
[JsonIgnore]
public Customer Customer { get; set; }
[JsonProperty("customer")]
internal object InternalCustomer
{
set
{
StringOrObject<Customer>.Map(value, s => this.CustomerId = s, o => this.Customer = o);
}
}
#endregion
[JsonProperty("description")]
public string Description { get; set; }
#region Expandable Destination
public string DestinationId { get; set; }
/// <summary>
/// The account (if any) the charge was made on behalf of, with an automatic transfer. See the Connect documentation for details.
/// </summary>
[JsonIgnore]
public Account Destination { get; set; }
[JsonProperty("destination")]
internal object InternalDestination
{
set
{
StringOrObject<Account>.Map(value, s => this.DestinationId = s, o => this.Destination = o);
}
}
#endregion
#region Expandable Dispute
public string DisputeId { get; set; }
/// <summary>
/// Details about the dispute if the charge has been disputed.
/// </summary>
[JsonIgnore]
public Dispute Dispute { get; set; }
[JsonProperty("dispute")]
internal object InternalDispute
{
set
{
StringOrObject<Dispute>.Map(value, s => this.DisputeId = s, o => this.Dispute = o);
}
}
#endregion
/// <summary>
/// Error code explaining reason for charge failure if available (see the errors section for a list of codes).
/// </summary>
[JsonProperty("failure_code")]
public string FailureCode { get; set; }
/// <summary>
/// Message to user further explaining reason for charge failure if available.
/// </summary>
[JsonProperty("failure_message")]
public string FailureMessage { get; set; }
/// <summary>
/// Hash with information on fraud assessments for the charge. Assessments reported by you have the key user_report and, if set, possible values of safe and fraudulent. Assessments from Stripe have the key stripe_report and, if set, the value fraudulent.
/// </summary>
[JsonProperty("fraud_details")]
public Dictionary<string, string> FraudDetails { get; set; }
#region Expandable Invoice
/// <summary>
/// ID of the invoice this charge is for if one exists.
/// </summary>
public string InvoiceId { get; set; }
[JsonIgnore]
public Invoice Invoice { get; set; }
[JsonProperty("invoice")]
internal object InternalInvoice
{
set
{
StringOrObject<Invoice>.Map(value, s => this.InvoiceId = s, o => this.Invoice = o);
}
}
#endregion
[JsonProperty("livemode")]
public bool Livemode { get; set; }
/// <summary>
/// A set of key/value pairs that you can attach to a charge object. It can be useful for storing additional information about the charge in a structured format.
/// </summary>
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
#region Expandable OnBehalfOf (Account)
/// <summary>
/// The account (if any) the charge was made on behalf of without triggering an automatic transfer. See the Connect documentation for details.
/// <para>To populate the OnBehalfOf entity, you need to set ExpandOnBehalfOf to true on your service before invoking a service method.</para>
/// </summary>
public string OnBehalfOfId { get; set; }
[JsonIgnore]
public Account OnBehalfOf { get; set; }
[JsonProperty("on_behalf_of")]
internal object InternalOnBehalfOf
{
set
{
StringOrObject<Account>.Map(value, s => this.OnBehalfOfId = s, o => this.OnBehalfOf = o);
}
}
#endregion
#region Expandable Order
/// <summary>
/// ID of the order this charge is for if one exists.
/// </summary>
public string OrderId { get; set; }
[JsonIgnore]
public Order Order { get; set; }
[JsonProperty("order")]
internal object InternalOrder
{
set
{
StringOrObject<Order>.Map(value, s => this.OrderId = s, o => this.Order = o);
}
}
#endregion
/// <summary>
/// Details about the level III data associated with the Charge.
/// This is a gated property and most integrations can not access it.
/// </summary>
[JsonProperty("level3")]
public ChargeLevel3 Level3 { get; set; }
/// <summary>
/// Details about whether the payment was accepted, and why.
/// </summary>
[JsonProperty("outcome")]
public Outcome Outcome { get; set; }
/// <summary>
/// true if the charge succeeded, or was successfully authorized for later capture.
/// </summary>
[JsonProperty("paid")]
public bool Paid { get; set; }
/// <summary>
/// This is the email address that the receipt for this charge was sent to.
/// </summary>
[JsonProperty("receipt_email")]
public string ReceiptEmail { get; set; }
/// <summary>
/// This is the transaction number that appears on email receipts sent for this charge.
/// </summary>
[JsonProperty("receipt_number")]
public string ReceiptNumber { get; set; }
/// <summary>
/// Whether or not the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false.
/// </summary>
[JsonProperty("refunded")]
public bool Refunded { get; set; }
/// <summary>
/// A list of refunds that have been applied to the charge.
/// </summary>
[JsonProperty("refunds")]
public StripeList<Refund> Refunds { get; set; }
#region Expandable Review
/// <summary>
/// ID of the review associated with this charge if one exists.
/// </summary>
public string ReviewId { get; set; }
[JsonIgnore]
public Review Review { get; set; }
[JsonProperty("review")]
internal object InternalReview
{
set
{
StringOrObject<Review>.Map(value, s => this.ReviewId = s, o => this.Review = o);
}
}
#endregion
/// <summary>
/// Shipping information for the charge.
/// </summary>
[JsonProperty("shipping")]
public Shipping Shipping { get; set; }
/// <summary>
/// For most Stripe users, the source of every charge is a credit or debit card. This hash is then the card object describing that card.
/// </summary>
[JsonProperty("source")]
public PaymentSource Source { get; set; }
#region Expandable Transfer
/// <summary>
/// The transfer ID which created this charge. Only present if the charge came from another Stripe account. See the Connect documentation for details.
/// </summary>
public string SourceTransferId { get; set; }
[JsonIgnore]
public Transfer SourceTransfer { get; set; }
[JsonProperty("source_transfer")]
internal object InternalSourceTransfer
{
set
{
StringOrObject<Transfer>.Map(value, s => this.SourceTransferId = s, o => this.SourceTransfer = o);
}
}
#endregion
/// <summary>
/// Extra information about a charge. This will appear on your customer’s credit card statement.
/// </summary>
[JsonProperty("statement_descriptor")]
public string StatementDescriptor { get; set; }
/// <summary>
/// The status of the payment is either succeeded, pending, or failed
/// </summary>
[JsonProperty("status")]
public string Status { get; set; }
#region Expandable Transfer
/// <summary>
/// ID of the transfer to the destination account (only applicable if the charge was created using the destination parameter).
/// </summary>
public string TransferId { get; set; }
[JsonIgnore]
public Transfer Transfer { get; set; }
[JsonProperty("transfer")]
internal object InternalTransfer
{
set
{
StringOrObject<Transfer>.Map(value, s => this.TransferId = s, o => this.Transfer = o);
}
}
#endregion
/// <summary>
/// A string that identifies this transaction as part of a group. See the Connect documentation for details.
/// </summary>
[JsonProperty("transfer_group")]
public string TransferGroup { get; set; }
// The properties below are for internal use only and not returned as part of standard API requests.
[JsonProperty("authorization_code")]
public string AuthorizationCode { get; set; }
}
}