stripe/resources/generated/balance.rs
1// ======================================
2// This file was automatically generated.
3// ======================================
4
5use crate::params::Object;
6use crate::resources::{BalanceAmountBySourceType, Currency};
7use serde::{Deserialize, Serialize};
8
9/// The resource representing a Stripe "Balance".
10///
11/// For more details see <https://stripe.com/docs/api/balance/balance_object>
12#[derive(Clone, Debug, Default, Deserialize, Serialize)]
13pub struct Balance {
14 /// Available funds that you can transfer or pay out automatically by Stripe or explicitly through the [Transfers API](https://stripe.com/docs/api#transfers) or [Payouts API](https://stripe.com/docs/api#payouts).
15 ///
16 /// You can find the available balance for each currency and payment type in the `source_types` property.
17 pub available: Vec<BalanceAmount>,
18
19 /// Funds held due to negative balances on connected Custom accounts.
20 ///
21 /// You can find the connect reserve balance for each currency and payment type in the `source_types` property.
22 #[serde(skip_serializing_if = "Option::is_none")]
23 pub connect_reserved: Option<Vec<BalanceAmount>>,
24
25 /// Funds that you can pay out using Instant Payouts.
26 #[serde(skip_serializing_if = "Option::is_none")]
27 pub instant_available: Option<Vec<BalanceAmountNet>>,
28
29 #[serde(skip_serializing_if = "Option::is_none")]
30 pub issuing: Option<BalanceDetail>,
31
32 /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
33 pub livemode: bool,
34
35 /// Funds that aren't available in the balance yet.
36 ///
37 /// You can find the pending balance for each currency and each payment type in the `source_types` property.
38 pub pending: Vec<BalanceAmount>,
39}
40
41impl Object for Balance {
42 type Id = ();
43 fn id(&self) -> Self::Id {}
44 fn object(&self) -> &'static str {
45 "balance"
46 }
47}
48
49#[derive(Clone, Debug, Default, Deserialize, Serialize)]
50pub struct BalanceAmount {
51 /// Balance amount.
52 pub amount: i64,
53
54 /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
55 ///
56 /// Must be a [supported currency](https://stripe.com/docs/currencies).
57 pub currency: Currency,
58
59 #[serde(skip_serializing_if = "Option::is_none")]
60 pub source_types: Option<BalanceAmountBySourceType>,
61}
62
63#[derive(Clone, Debug, Default, Deserialize, Serialize)]
64pub struct BalanceAmountNet {
65 /// Balance amount.
66 pub amount: i64,
67
68 /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
69 ///
70 /// Must be a [supported currency](https://stripe.com/docs/currencies).
71 pub currency: Currency,
72
73 #[serde(skip_serializing_if = "Option::is_none")]
74 pub source_types: Option<BalanceAmountBySourceType>,
75}
76
77#[derive(Clone, Debug, Default, Deserialize, Serialize)]
78pub struct BalanceDetail {
79 /// Funds that are available for use.
80 pub available: Vec<BalanceAmount>,
81}