async-stripe 0.41.0

API bindings for the Stripe HTTP API
Documentation
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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
// ======================================
// This file was automatically generated.
// ======================================

use crate::ids::{FinancialConnectionsAccountId};
use crate::params::{Expandable, Object, Timestamp};
use crate::resources::{BankConnectionsResourceAccountholder, FinancialConnectionsAccountOwnership};
use serde::{Deserialize, Serialize};

/// The resource representing a Stripe "BankConnectionsResourceLinkedAccount".
///
/// For more details see <https://stripe.com/docs/api/financial_connections/accounts/object>
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct FinancialConnectionsAccount {
    /// Unique identifier for the object.
    pub id: FinancialConnectionsAccountId,

    /// The account holder that this account belongs to.
    pub account_holder: Option<BankConnectionsResourceAccountholder>,

    /// The most recent information about the account's balance.
    pub balance: Option<BankConnectionsResourceBalance>,

    /// The state of the most recent attempt to refresh the account balance.
    pub balance_refresh: Option<BankConnectionsResourceBalanceRefresh>,

    /// The type of the account.
    ///
    /// Account category is further divided in `subcategory`.
    pub category: FinancialConnectionsAccountCategory,

    /// Time at which the object was created.
    ///
    /// Measured in seconds since the Unix epoch.
    pub created: Timestamp,

    /// A human-readable name that has been assigned to this account, either by the account holder or by the institution.
    pub display_name: Option<String>,

    /// The name of the institution that holds this account.
    pub institution_name: String,

    /// The last 4 digits of the account number.
    ///
    /// If present, this will be 4 numeric characters.
    pub last4: Option<String>,

    /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
    pub livemode: bool,

    /// The most recent information about the account's owners.
    pub ownership: Option<Expandable<FinancialConnectionsAccountOwnership>>,

    /// The state of the most recent attempt to refresh the account owners.
    pub ownership_refresh: Option<BankConnectionsResourceOwnershipRefresh>,

    /// The list of permissions granted by this account.
    pub permissions: Option<Vec<FinancialConnectionsAccountPermissions>>,

    /// The status of the link to the account.
    pub status: FinancialConnectionsAccountStatus,

    /// If `category` is `cash`, one of:
    ///
    ///  - `checking`
    ///  - `savings`
    ///  - `other`
    ///
    /// If `category` is `credit`, one of:
    ///
    ///  - `mortgage`
    ///  - `line_of_credit`
    ///  - `credit_card`
    ///  - `other`
    ///
    /// If `category` is `investment` or `other`, this will be `other`.
    pub subcategory: FinancialConnectionsAccountSubcategory,

    /// The list of data refresh subscriptions requested on this account.
    pub subscriptions: Option<Vec<FinancialConnectionsAccountSubscriptions>>,

    /// The [PaymentMethod type](https://stripe.com/docs/api/payment_methods/object#payment_method_object-type)(s) that can be created from this account.
    pub supported_payment_method_types: Vec<FinancialConnectionsAccountSupportedPaymentMethodTypes>,

    /// The state of the most recent attempt to refresh the account transactions.
    pub transaction_refresh: Option<BankConnectionsResourceTransactionRefresh>,
}

impl Object for FinancialConnectionsAccount {
    type Id = FinancialConnectionsAccountId;
    fn id(&self) -> Self::Id {
        self.id.clone()
    }
    fn object(&self) -> &'static str {
        "financial_connections.account"
    }
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct BankConnectionsResourceBalance {

    /// The time that the external institution calculated this balance.
    ///
    /// Measured in seconds since the Unix epoch.
    pub as_of: Timestamp,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub cash: Option<BankConnectionsResourceBalanceApiResourceCashBalance>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub credit: Option<BankConnectionsResourceBalanceApiResourceCreditBalance>,

    /// The balances owed to (or by) the account holder.
    ///
    /// Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
    ///
    /// Each value is a integer amount.
    ///
    /// A positive amount indicates money owed to the account holder.
    /// A negative amount indicates money owed by the account holder.
    pub current: i64,

    /// The `type` of the balance.
    ///
    /// An additional hash is included on the balance with a name matching this value.
    #[serde(rename = "type")]
    pub type_: BankConnectionsResourceBalanceType,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct BankConnectionsResourceBalanceApiResourceCashBalance {

    /// The funds available to the account holder.
    ///
    /// Typically this is the current balance less any holds.  Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.  Each value is a integer amount.
    /// A positive amount indicates money owed to the account holder.
    /// A negative amount indicates money owed by the account holder.
    pub available: Option<i64>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct BankConnectionsResourceBalanceApiResourceCreditBalance {

    /// The credit that has been used by the account holder.
    ///
    /// Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
    ///
    /// Each value is a integer amount.
    ///
    /// A positive amount indicates money owed to the account holder.
    /// A negative amount indicates money owed by the account holder.
    pub used: Option<i64>,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct BankConnectionsResourceBalanceRefresh {

    /// The time at which the last refresh attempt was initiated.
    ///
    /// Measured in seconds since the Unix epoch.
    pub last_attempted_at: Timestamp,

    /// Time at which the next balance refresh can be initiated.
    ///
    /// This value will be `null` when `status` is `pending`.
    /// Measured in seconds since the Unix epoch.
    pub next_refresh_available_at: Option<Timestamp>,

    /// The status of the last refresh attempt.
    pub status: BankConnectionsResourceBalanceRefreshStatus,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct BankConnectionsResourceOwnershipRefresh {

    /// The time at which the last refresh attempt was initiated.
    ///
    /// Measured in seconds since the Unix epoch.
    pub last_attempted_at: Timestamp,

    /// The status of the last refresh attempt.
    pub status: BankConnectionsResourceOwnershipRefreshStatus,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct BankConnectionsResourceTransactionRefresh {

    /// Unique identifier for the object.
    pub id: String,

    /// The time at which the last refresh attempt was initiated.
    ///
    /// Measured in seconds since the Unix epoch.
    pub last_attempted_at: Timestamp,

    /// Time at which the next transaction refresh can be initiated.
    ///
    /// This value will be `null` when `status` is `pending`.
    /// Measured in seconds since the Unix epoch.
    pub next_refresh_available_at: Option<Timestamp>,

    /// The status of the last refresh attempt.
    pub status: BankConnectionsResourceTransactionRefreshStatus,
}

/// An enum representing the possible values of an `BankConnectionsResourceBalanceRefresh`'s `status` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum BankConnectionsResourceBalanceRefreshStatus {
    Failed,
    Pending,
    Succeeded,
}

impl BankConnectionsResourceBalanceRefreshStatus {
    pub fn as_str(self) -> &'static str {
        match self {
            BankConnectionsResourceBalanceRefreshStatus::Failed => "failed",
            BankConnectionsResourceBalanceRefreshStatus::Pending => "pending",
            BankConnectionsResourceBalanceRefreshStatus::Succeeded => "succeeded",
        }
    }
}

impl AsRef<str> for BankConnectionsResourceBalanceRefreshStatus {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for BankConnectionsResourceBalanceRefreshStatus {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for BankConnectionsResourceBalanceRefreshStatus {
    fn default() -> Self {
        Self::Failed
    }
}

/// An enum representing the possible values of an `BankConnectionsResourceBalance`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum BankConnectionsResourceBalanceType {
    Cash,
    Credit,
}

impl BankConnectionsResourceBalanceType {
    pub fn as_str(self) -> &'static str {
        match self {
            BankConnectionsResourceBalanceType::Cash => "cash",
            BankConnectionsResourceBalanceType::Credit => "credit",
        }
    }
}

impl AsRef<str> for BankConnectionsResourceBalanceType {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for BankConnectionsResourceBalanceType {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for BankConnectionsResourceBalanceType {
    fn default() -> Self {
        Self::Cash
    }
}

/// An enum representing the possible values of an `BankConnectionsResourceOwnershipRefresh`'s `status` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum BankConnectionsResourceOwnershipRefreshStatus {
    Failed,
    Pending,
    Succeeded,
}

impl BankConnectionsResourceOwnershipRefreshStatus {
    pub fn as_str(self) -> &'static str {
        match self {
            BankConnectionsResourceOwnershipRefreshStatus::Failed => "failed",
            BankConnectionsResourceOwnershipRefreshStatus::Pending => "pending",
            BankConnectionsResourceOwnershipRefreshStatus::Succeeded => "succeeded",
        }
    }
}

impl AsRef<str> for BankConnectionsResourceOwnershipRefreshStatus {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for BankConnectionsResourceOwnershipRefreshStatus {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for BankConnectionsResourceOwnershipRefreshStatus {
    fn default() -> Self {
        Self::Failed
    }
}

/// An enum representing the possible values of an `BankConnectionsResourceTransactionRefresh`'s `status` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum BankConnectionsResourceTransactionRefreshStatus {
    Failed,
    Pending,
    Succeeded,
}

impl BankConnectionsResourceTransactionRefreshStatus {
    pub fn as_str(self) -> &'static str {
        match self {
            BankConnectionsResourceTransactionRefreshStatus::Failed => "failed",
            BankConnectionsResourceTransactionRefreshStatus::Pending => "pending",
            BankConnectionsResourceTransactionRefreshStatus::Succeeded => "succeeded",
        }
    }
}

impl AsRef<str> for BankConnectionsResourceTransactionRefreshStatus {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for BankConnectionsResourceTransactionRefreshStatus {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for BankConnectionsResourceTransactionRefreshStatus {
    fn default() -> Self {
        Self::Failed
    }
}

/// An enum representing the possible values of an `FinancialConnectionsAccount`'s `category` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum FinancialConnectionsAccountCategory {
    Cash,
    Credit,
    Investment,
    Other,
}

impl FinancialConnectionsAccountCategory {
    pub fn as_str(self) -> &'static str {
        match self {
            FinancialConnectionsAccountCategory::Cash => "cash",
            FinancialConnectionsAccountCategory::Credit => "credit",
            FinancialConnectionsAccountCategory::Investment => "investment",
            FinancialConnectionsAccountCategory::Other => "other",
        }
    }
}

impl AsRef<str> for FinancialConnectionsAccountCategory {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for FinancialConnectionsAccountCategory {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for FinancialConnectionsAccountCategory {
    fn default() -> Self {
        Self::Cash
    }
}

/// An enum representing the possible values of an `FinancialConnectionsAccount`'s `permissions` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum FinancialConnectionsAccountPermissions {
    Balances,
    Ownership,
    PaymentMethod,
    Transactions,
}

impl FinancialConnectionsAccountPermissions {
    pub fn as_str(self) -> &'static str {
        match self {
            FinancialConnectionsAccountPermissions::Balances => "balances",
            FinancialConnectionsAccountPermissions::Ownership => "ownership",
            FinancialConnectionsAccountPermissions::PaymentMethod => "payment_method",
            FinancialConnectionsAccountPermissions::Transactions => "transactions",
        }
    }
}

impl AsRef<str> for FinancialConnectionsAccountPermissions {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for FinancialConnectionsAccountPermissions {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for FinancialConnectionsAccountPermissions {
    fn default() -> Self {
        Self::Balances
    }
}

/// An enum representing the possible values of an `FinancialConnectionsAccount`'s `status` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum FinancialConnectionsAccountStatus {
    Active,
    Disconnected,
    Inactive,
}

impl FinancialConnectionsAccountStatus {
    pub fn as_str(self) -> &'static str {
        match self {
            FinancialConnectionsAccountStatus::Active => "active",
            FinancialConnectionsAccountStatus::Disconnected => "disconnected",
            FinancialConnectionsAccountStatus::Inactive => "inactive",
        }
    }
}

impl AsRef<str> for FinancialConnectionsAccountStatus {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for FinancialConnectionsAccountStatus {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for FinancialConnectionsAccountStatus {
    fn default() -> Self {
        Self::Active
    }
}

/// An enum representing the possible values of an `FinancialConnectionsAccount`'s `subcategory` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum FinancialConnectionsAccountSubcategory {
    Checking,
    CreditCard,
    LineOfCredit,
    Mortgage,
    Other,
    Savings,
}

impl FinancialConnectionsAccountSubcategory {
    pub fn as_str(self) -> &'static str {
        match self {
            FinancialConnectionsAccountSubcategory::Checking => "checking",
            FinancialConnectionsAccountSubcategory::CreditCard => "credit_card",
            FinancialConnectionsAccountSubcategory::LineOfCredit => "line_of_credit",
            FinancialConnectionsAccountSubcategory::Mortgage => "mortgage",
            FinancialConnectionsAccountSubcategory::Other => "other",
            FinancialConnectionsAccountSubcategory::Savings => "savings",
        }
    }
}

impl AsRef<str> for FinancialConnectionsAccountSubcategory {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for FinancialConnectionsAccountSubcategory {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for FinancialConnectionsAccountSubcategory {
    fn default() -> Self {
        Self::Checking
    }
}

/// An enum representing the possible values of an `FinancialConnectionsAccount`'s `subscriptions` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum FinancialConnectionsAccountSubscriptions {
    Transactions,
}

impl FinancialConnectionsAccountSubscriptions {
    pub fn as_str(self) -> &'static str {
        match self {
            FinancialConnectionsAccountSubscriptions::Transactions => "transactions",
        }
    }
}

impl AsRef<str> for FinancialConnectionsAccountSubscriptions {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for FinancialConnectionsAccountSubscriptions {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for FinancialConnectionsAccountSubscriptions {
    fn default() -> Self {
        Self::Transactions
    }
}

/// An enum representing the possible values of an `FinancialConnectionsAccount`'s `supported_payment_method_types` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum FinancialConnectionsAccountSupportedPaymentMethodTypes {
    Link,
    UsBankAccount,
}

impl FinancialConnectionsAccountSupportedPaymentMethodTypes {
    pub fn as_str(self) -> &'static str {
        match self {
            FinancialConnectionsAccountSupportedPaymentMethodTypes::Link => "link",
            FinancialConnectionsAccountSupportedPaymentMethodTypes::UsBankAccount => "us_bank_account",
        }
    }
}

impl AsRef<str> for FinancialConnectionsAccountSupportedPaymentMethodTypes {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl std::fmt::Display for FinancialConnectionsAccountSupportedPaymentMethodTypes {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.as_str().fmt(f)
    }
}
impl std::default::Default for FinancialConnectionsAccountSupportedPaymentMethodTypes {
    fn default() -> Self {
        Self::Link
    }
}