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
use crate::config::{Client, Response};
use crate::params::{Identifiable, Timestamp};
use crate::resources::Currency;
use serde_derive::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct FeeDetails {
pub amount: u64,
pub application: Option<String>,
pub currency: Currency,
pub description: String,
#[serde(rename = "type")]
pub fee_type: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Balance {
pub object: String,
pub available: Vec<serde_json::Value>,
pub connect_reserved: Vec<serde_json::Value>,
pub livemode: bool,
pub pending: Vec<serde_json::Value>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BalanceTransaction {
pub id: String,
pub object: String,
pub amount: u64,
pub available_on: Timestamp,
pub created: Timestamp,
pub currency: Currency,
pub description: Option<String>,
pub fee: u64,
pub fee_details: Vec<FeeDetails>,
pub net: u64,
pub source: Option<String>,
pub status: String,
#[serde(rename = "type")]
pub transaction_type: String,
}
impl Identifiable for BalanceTransaction {
fn id(&self) -> &str {
&self.id
}
}
impl BalanceTransaction {
pub fn retrieve(client: &Client, balance_transaction_id: &str) -> Response<BalanceTransaction> {
client.get(&format!("/balance/history/{}", balance_transaction_id))
}
}