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
use serde::{Deserialize, Serialize};
use crate::ids::BalanceTransactionSourceId;
use crate::params::Object;
use crate::resources::BalanceTransactionSourceUnion;
impl Object for BalanceTransactionSourceUnion {
type Id = BalanceTransactionSourceId;
fn id(&self) -> Self::Id {
use BalanceTransactionSourceId as Id;
use BalanceTransactionSourceUnion as Source;
match self {
Source::ApplicationFee(x) => Id::ApplicationFee(x.id()),
Source::ApplicationFeeRefund(x) => Id::ApplicationFeeRefund(x.id()),
Source::Charge(x) => Id::Charge(x.id()),
Source::ConnectCollectionTransfer(_) => Id::None,
Source::Dispute(x) => Id::Dispute(x.id()),
Source::IssuingAuthorization(x) => Id::IssuingAuthorization(x.id()),
Source::IssuingDispute(x) => Id::IssuingDispute(x.id()),
Source::IssuingTransaction(x) => Id::IssuingTransaction(x.id()),
Source::PlatformTaxFee(_) => Id::None,
Source::Payout(x) => Id::Payout(x.id()),
Source::Refund(x) => Id::Refund(x.id()),
Source::ReserveTransaction(_) => Id::None,
Source::TaxDeductedAtSource(_) => Id::None,
Source::Topup(x) => Id::Topup(x.id()),
Source::Transfer(x) => Id::Transfer(x.id()),
Source::TransferReversal(x) => Id::TransferReversal(x.id()),
}
}
fn object(&self) -> &'static str {
use BalanceTransactionSourceUnion as Source;
match self {
Source::ApplicationFee(x) => x.object(),
Source::ApplicationFeeRefund(x) => x.object(),
Source::Charge(x) => x.object(),
Source::ConnectCollectionTransfer(x) => x.object(),
Source::Dispute(x) => x.object(),
Source::IssuingAuthorization(x) => x.object(),
Source::IssuingDispute(x) => x.object(),
Source::IssuingTransaction(x) => x.object(),
Source::PlatformTaxFee(x) => x.object(),
Source::Payout(x) => x.object(),
Source::Refund(x) => x.object(),
Source::ReserveTransaction(x) => x.object(),
Source::TaxDeductedAtSource(x) => x.object(),
Source::Topup(x) => x.object(),
Source::Transfer(x) => x.object(),
Source::TransferReversal(x) => x.object(),
}
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum BalanceTransactionStatus {
Available,
Pending,
}
impl BalanceTransactionStatus {
pub fn as_str(self) -> &'static str {
match self {
BalanceTransactionStatus::Available => "available",
BalanceTransactionStatus::Pending => "pending",
}
}
}
impl AsRef<str> for BalanceTransactionStatus {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for BalanceTransactionStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for BalanceTransactionStatus {
fn default() -> Self {
Self::Pending
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum FeeType {
ApplicationFee,
StripeFee,
Tax,
}
impl FeeType {
pub fn as_str(self) -> &'static str {
match self {
FeeType::ApplicationFee => "application_fee",
FeeType::StripeFee => "stripe_fee",
FeeType::Tax => "tax",
}
}
}
impl AsRef<str> for FeeType {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for FeeType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for FeeType {
fn default() -> Self {
FeeType::ApplicationFee
}
}