stripe_shared/
balance_transaction.rs

1/// Balance transactions represent funds moving through your Stripe account.
2/// Stripe creates them for every type of transaction that enters or leaves your Stripe account balance.
3///
4/// Related guide: [Balance transaction types](https://stripe.com/docs/reports/balance-transaction-types).
5///
6/// For more details see <<https://stripe.com/docs/api/balance_transactions/object>>.
7#[derive(Clone, Debug)]
8#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
9pub struct BalanceTransaction {
10    /// Gross amount of this transaction (in cents (or local equivalent)).
11    /// A positive value represents funds charged to another party, and a negative value represents funds sent to another party.
12    pub amount: i64,
13    /// The date that the transaction's net funds become available in the Stripe balance.
14    pub available_on: stripe_types::Timestamp,
15    /// The balance that this transaction impacts.
16    pub balance_type: Option<BalanceTransactionBalanceType>,
17    /// Time at which the object was created. Measured in seconds since the Unix epoch.
18    pub created: stripe_types::Timestamp,
19    /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
20    /// Must be a [supported currency](https://stripe.com/docs/currencies).
21    pub currency: stripe_types::Currency,
22    /// An arbitrary string attached to the object. Often useful for displaying to users.
23    pub description: Option<String>,
24    /// If applicable, this transaction uses an exchange rate.
25    /// If money converts from currency A to currency B, then the `amount` in currency A, multipled by the `exchange_rate`, equals the `amount` in currency B.
26    /// For example, if you charge a customer 10.00 EUR, the PaymentIntent's `amount` is `1000` and `currency` is `eur`.
27    /// If this converts to 12.34 USD in your Stripe account, the BalanceTransaction's `amount` is `1234`, its `currency` is `usd`, and the `exchange_rate` is `1.234`.
28    pub exchange_rate: Option<f64>,
29    /// Fees (in cents (or local equivalent)) paid for this transaction.
30    /// Represented as a positive integer when assessed.
31    pub fee: i64,
32    /// Detailed breakdown of fees (in cents (or local equivalent)) paid for this transaction.
33    pub fee_details: Vec<stripe_shared::Fee>,
34    /// Unique identifier for the object.
35    pub id: stripe_shared::BalanceTransactionId,
36    /// Net impact to a Stripe balance (in cents (or local equivalent)).
37    /// A positive value represents incrementing a Stripe balance, and a negative value decrementing a Stripe balance.
38    /// You can calculate the net impact of a transaction on a balance by `amount` - `fee`.
39    pub net: i64,
40    /// Learn more about how [reporting categories](https://stripe.com/docs/reports/reporting-categories) can help you understand balance transactions from an accounting perspective.
41    pub reporting_category: String,
42    /// This transaction relates to the Stripe object.
43    pub source: Option<stripe_types::Expandable<stripe_shared::BalanceTransactionSource>>,
44    /// The transaction's net funds status in the Stripe balance, which are either `available` or `pending`.
45    pub status: String,
46    /// Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `payout_minimum_balance_hold`, `payout_minimum_balance_release`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `stripe_balance_payment_debit`, `stripe_balance_payment_debit_reversal`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`.
47    /// Learn more about [balance transaction types and what they represent](https://stripe.com/docs/reports/balance-transaction-types).
48    /// To classify transactions for accounting purposes, consider `reporting_category` instead.
49    #[cfg_attr(feature = "deserialize", serde(rename = "type"))]
50    pub type_: BalanceTransactionType,
51}
52#[doc(hidden)]
53pub struct BalanceTransactionBuilder {
54    amount: Option<i64>,
55    available_on: Option<stripe_types::Timestamp>,
56    balance_type: Option<Option<BalanceTransactionBalanceType>>,
57    created: Option<stripe_types::Timestamp>,
58    currency: Option<stripe_types::Currency>,
59    description: Option<Option<String>>,
60    exchange_rate: Option<Option<f64>>,
61    fee: Option<i64>,
62    fee_details: Option<Vec<stripe_shared::Fee>>,
63    id: Option<stripe_shared::BalanceTransactionId>,
64    net: Option<i64>,
65    reporting_category: Option<String>,
66    source: Option<Option<stripe_types::Expandable<stripe_shared::BalanceTransactionSource>>>,
67    status: Option<String>,
68    type_: Option<BalanceTransactionType>,
69}
70
71#[allow(
72    unused_variables,
73    irrefutable_let_patterns,
74    clippy::let_unit_value,
75    clippy::match_single_binding,
76    clippy::single_match
77)]
78const _: () = {
79    use miniserde::de::{Map, Visitor};
80    use miniserde::json::Value;
81    use miniserde::{Deserialize, Result, make_place};
82    use stripe_types::miniserde_helpers::FromValueOpt;
83    use stripe_types::{MapBuilder, ObjectDeser};
84
85    make_place!(Place);
86
87    impl Deserialize for BalanceTransaction {
88        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
89            Place::new(out)
90        }
91    }
92
93    struct Builder<'a> {
94        out: &'a mut Option<BalanceTransaction>,
95        builder: BalanceTransactionBuilder,
96    }
97
98    impl Visitor for Place<BalanceTransaction> {
99        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
100            Ok(Box::new(Builder {
101                out: &mut self.out,
102                builder: BalanceTransactionBuilder::deser_default(),
103            }))
104        }
105    }
106
107    impl MapBuilder for BalanceTransactionBuilder {
108        type Out = BalanceTransaction;
109        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
110            Ok(match k {
111                "amount" => Deserialize::begin(&mut self.amount),
112                "available_on" => Deserialize::begin(&mut self.available_on),
113                "balance_type" => Deserialize::begin(&mut self.balance_type),
114                "created" => Deserialize::begin(&mut self.created),
115                "currency" => Deserialize::begin(&mut self.currency),
116                "description" => Deserialize::begin(&mut self.description),
117                "exchange_rate" => Deserialize::begin(&mut self.exchange_rate),
118                "fee" => Deserialize::begin(&mut self.fee),
119                "fee_details" => Deserialize::begin(&mut self.fee_details),
120                "id" => Deserialize::begin(&mut self.id),
121                "net" => Deserialize::begin(&mut self.net),
122                "reporting_category" => Deserialize::begin(&mut self.reporting_category),
123                "source" => Deserialize::begin(&mut self.source),
124                "status" => Deserialize::begin(&mut self.status),
125                "type" => Deserialize::begin(&mut self.type_),
126                _ => <dyn Visitor>::ignore(),
127            })
128        }
129
130        fn deser_default() -> Self {
131            Self {
132                amount: Deserialize::default(),
133                available_on: Deserialize::default(),
134                balance_type: Deserialize::default(),
135                created: Deserialize::default(),
136                currency: Deserialize::default(),
137                description: Deserialize::default(),
138                exchange_rate: Deserialize::default(),
139                fee: Deserialize::default(),
140                fee_details: Deserialize::default(),
141                id: Deserialize::default(),
142                net: Deserialize::default(),
143                reporting_category: Deserialize::default(),
144                source: Deserialize::default(),
145                status: Deserialize::default(),
146                type_: Deserialize::default(),
147            }
148        }
149
150        fn take_out(&mut self) -> Option<Self::Out> {
151            let (
152                Some(amount),
153                Some(available_on),
154                Some(balance_type),
155                Some(created),
156                Some(currency),
157                Some(description),
158                Some(exchange_rate),
159                Some(fee),
160                Some(fee_details),
161                Some(id),
162                Some(net),
163                Some(reporting_category),
164                Some(source),
165                Some(status),
166                Some(type_),
167            ) = (
168                self.amount,
169                self.available_on,
170                self.balance_type,
171                self.created,
172                self.currency.take(),
173                self.description.take(),
174                self.exchange_rate,
175                self.fee,
176                self.fee_details.take(),
177                self.id.take(),
178                self.net,
179                self.reporting_category.take(),
180                self.source.take(),
181                self.status.take(),
182                self.type_.take(),
183            )
184            else {
185                return None;
186            };
187            Some(Self::Out {
188                amount,
189                available_on,
190                balance_type,
191                created,
192                currency,
193                description,
194                exchange_rate,
195                fee,
196                fee_details,
197                id,
198                net,
199                reporting_category,
200                source,
201                status,
202                type_,
203            })
204        }
205    }
206
207    impl Map for Builder<'_> {
208        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
209            self.builder.key(k)
210        }
211
212        fn finish(&mut self) -> Result<()> {
213            *self.out = self.builder.take_out();
214            Ok(())
215        }
216    }
217
218    impl ObjectDeser for BalanceTransaction {
219        type Builder = BalanceTransactionBuilder;
220    }
221
222    impl FromValueOpt for BalanceTransaction {
223        fn from_value(v: Value) -> Option<Self> {
224            let Value::Object(obj) = v else {
225                return None;
226            };
227            let mut b = BalanceTransactionBuilder::deser_default();
228            for (k, v) in obj {
229                match k.as_str() {
230                    "amount" => b.amount = FromValueOpt::from_value(v),
231                    "available_on" => b.available_on = FromValueOpt::from_value(v),
232                    "balance_type" => b.balance_type = FromValueOpt::from_value(v),
233                    "created" => b.created = FromValueOpt::from_value(v),
234                    "currency" => b.currency = FromValueOpt::from_value(v),
235                    "description" => b.description = FromValueOpt::from_value(v),
236                    "exchange_rate" => b.exchange_rate = FromValueOpt::from_value(v),
237                    "fee" => b.fee = FromValueOpt::from_value(v),
238                    "fee_details" => b.fee_details = FromValueOpt::from_value(v),
239                    "id" => b.id = FromValueOpt::from_value(v),
240                    "net" => b.net = FromValueOpt::from_value(v),
241                    "reporting_category" => b.reporting_category = FromValueOpt::from_value(v),
242                    "source" => b.source = FromValueOpt::from_value(v),
243                    "status" => b.status = FromValueOpt::from_value(v),
244                    "type" => b.type_ = FromValueOpt::from_value(v),
245                    _ => {}
246                }
247            }
248            b.take_out()
249        }
250    }
251};
252#[cfg(feature = "serialize")]
253impl serde::Serialize for BalanceTransaction {
254    fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
255        use serde::ser::SerializeStruct;
256        let mut s = s.serialize_struct("BalanceTransaction", 16)?;
257        s.serialize_field("amount", &self.amount)?;
258        s.serialize_field("available_on", &self.available_on)?;
259        s.serialize_field("balance_type", &self.balance_type)?;
260        s.serialize_field("created", &self.created)?;
261        s.serialize_field("currency", &self.currency)?;
262        s.serialize_field("description", &self.description)?;
263        s.serialize_field("exchange_rate", &self.exchange_rate)?;
264        s.serialize_field("fee", &self.fee)?;
265        s.serialize_field("fee_details", &self.fee_details)?;
266        s.serialize_field("id", &self.id)?;
267        s.serialize_field("net", &self.net)?;
268        s.serialize_field("reporting_category", &self.reporting_category)?;
269        s.serialize_field("source", &self.source)?;
270        s.serialize_field("status", &self.status)?;
271        s.serialize_field("type", &self.type_)?;
272
273        s.serialize_field("object", "balance_transaction")?;
274        s.end()
275    }
276}
277/// The balance that this transaction impacts.
278#[derive(Copy, Clone, Eq, PartialEq)]
279pub enum BalanceTransactionBalanceType {
280    Issuing,
281    Payments,
282    RefundAndDisputePrefunding,
283}
284impl BalanceTransactionBalanceType {
285    pub fn as_str(self) -> &'static str {
286        use BalanceTransactionBalanceType::*;
287        match self {
288            Issuing => "issuing",
289            Payments => "payments",
290            RefundAndDisputePrefunding => "refund_and_dispute_prefunding",
291        }
292    }
293}
294
295impl std::str::FromStr for BalanceTransactionBalanceType {
296    type Err = stripe_types::StripeParseError;
297    fn from_str(s: &str) -> Result<Self, Self::Err> {
298        use BalanceTransactionBalanceType::*;
299        match s {
300            "issuing" => Ok(Issuing),
301            "payments" => Ok(Payments),
302            "refund_and_dispute_prefunding" => Ok(RefundAndDisputePrefunding),
303            _ => Err(stripe_types::StripeParseError),
304        }
305    }
306}
307impl std::fmt::Display for BalanceTransactionBalanceType {
308    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
309        f.write_str(self.as_str())
310    }
311}
312
313impl std::fmt::Debug for BalanceTransactionBalanceType {
314    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
315        f.write_str(self.as_str())
316    }
317}
318#[cfg(feature = "serialize")]
319impl serde::Serialize for BalanceTransactionBalanceType {
320    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
321    where
322        S: serde::Serializer,
323    {
324        serializer.serialize_str(self.as_str())
325    }
326}
327impl miniserde::Deserialize for BalanceTransactionBalanceType {
328    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
329        crate::Place::new(out)
330    }
331}
332
333impl miniserde::de::Visitor for crate::Place<BalanceTransactionBalanceType> {
334    fn string(&mut self, s: &str) -> miniserde::Result<()> {
335        use std::str::FromStr;
336        self.out = Some(BalanceTransactionBalanceType::from_str(s).map_err(|_| miniserde::Error)?);
337        Ok(())
338    }
339}
340
341stripe_types::impl_from_val_with_from_str!(BalanceTransactionBalanceType);
342#[cfg(feature = "deserialize")]
343impl<'de> serde::Deserialize<'de> for BalanceTransactionBalanceType {
344    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
345        use std::str::FromStr;
346        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
347        Self::from_str(&s).map_err(|_| {
348            serde::de::Error::custom("Unknown value for BalanceTransactionBalanceType")
349        })
350    }
351}
352/// Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `payout_minimum_balance_hold`, `payout_minimum_balance_release`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `stripe_balance_payment_debit`, `stripe_balance_payment_debit_reversal`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`.
353/// Learn more about [balance transaction types and what they represent](https://stripe.com/docs/reports/balance-transaction-types).
354/// To classify transactions for accounting purposes, consider `reporting_category` instead.
355#[derive(Clone, Eq, PartialEq)]
356#[non_exhaustive]
357pub enum BalanceTransactionType {
358    Adjustment,
359    Advance,
360    AdvanceFunding,
361    AnticipationRepayment,
362    ApplicationFee,
363    ApplicationFeeRefund,
364    Charge,
365    ClimateOrderPurchase,
366    ClimateOrderRefund,
367    ConnectCollectionTransfer,
368    Contribution,
369    IssuingAuthorizationHold,
370    IssuingAuthorizationRelease,
371    IssuingDispute,
372    IssuingTransaction,
373    ObligationOutbound,
374    ObligationReversalInbound,
375    Payment,
376    PaymentFailureRefund,
377    PaymentNetworkReserveHold,
378    PaymentNetworkReserveRelease,
379    PaymentRefund,
380    PaymentReversal,
381    PaymentUnreconciled,
382    Payout,
383    PayoutCancel,
384    PayoutFailure,
385    PayoutMinimumBalanceHold,
386    PayoutMinimumBalanceRelease,
387    Refund,
388    RefundFailure,
389    ReserveTransaction,
390    ReservedFunds,
391    StripeBalancePaymentDebit,
392    StripeBalancePaymentDebitReversal,
393    StripeFee,
394    StripeFxFee,
395    TaxFee,
396    Topup,
397    TopupReversal,
398    Transfer,
399    TransferCancel,
400    TransferFailure,
401    TransferRefund,
402    /// An unrecognized value from Stripe. Should not be used as a request parameter.
403    Unknown(String),
404}
405impl BalanceTransactionType {
406    pub fn as_str(&self) -> &str {
407        use BalanceTransactionType::*;
408        match self {
409            Adjustment => "adjustment",
410            Advance => "advance",
411            AdvanceFunding => "advance_funding",
412            AnticipationRepayment => "anticipation_repayment",
413            ApplicationFee => "application_fee",
414            ApplicationFeeRefund => "application_fee_refund",
415            Charge => "charge",
416            ClimateOrderPurchase => "climate_order_purchase",
417            ClimateOrderRefund => "climate_order_refund",
418            ConnectCollectionTransfer => "connect_collection_transfer",
419            Contribution => "contribution",
420            IssuingAuthorizationHold => "issuing_authorization_hold",
421            IssuingAuthorizationRelease => "issuing_authorization_release",
422            IssuingDispute => "issuing_dispute",
423            IssuingTransaction => "issuing_transaction",
424            ObligationOutbound => "obligation_outbound",
425            ObligationReversalInbound => "obligation_reversal_inbound",
426            Payment => "payment",
427            PaymentFailureRefund => "payment_failure_refund",
428            PaymentNetworkReserveHold => "payment_network_reserve_hold",
429            PaymentNetworkReserveRelease => "payment_network_reserve_release",
430            PaymentRefund => "payment_refund",
431            PaymentReversal => "payment_reversal",
432            PaymentUnreconciled => "payment_unreconciled",
433            Payout => "payout",
434            PayoutCancel => "payout_cancel",
435            PayoutFailure => "payout_failure",
436            PayoutMinimumBalanceHold => "payout_minimum_balance_hold",
437            PayoutMinimumBalanceRelease => "payout_minimum_balance_release",
438            Refund => "refund",
439            RefundFailure => "refund_failure",
440            ReserveTransaction => "reserve_transaction",
441            ReservedFunds => "reserved_funds",
442            StripeBalancePaymentDebit => "stripe_balance_payment_debit",
443            StripeBalancePaymentDebitReversal => "stripe_balance_payment_debit_reversal",
444            StripeFee => "stripe_fee",
445            StripeFxFee => "stripe_fx_fee",
446            TaxFee => "tax_fee",
447            Topup => "topup",
448            TopupReversal => "topup_reversal",
449            Transfer => "transfer",
450            TransferCancel => "transfer_cancel",
451            TransferFailure => "transfer_failure",
452            TransferRefund => "transfer_refund",
453            Unknown(v) => v,
454        }
455    }
456}
457
458impl std::str::FromStr for BalanceTransactionType {
459    type Err = std::convert::Infallible;
460    fn from_str(s: &str) -> Result<Self, Self::Err> {
461        use BalanceTransactionType::*;
462        match s {
463            "adjustment" => Ok(Adjustment),
464            "advance" => Ok(Advance),
465            "advance_funding" => Ok(AdvanceFunding),
466            "anticipation_repayment" => Ok(AnticipationRepayment),
467            "application_fee" => Ok(ApplicationFee),
468            "application_fee_refund" => Ok(ApplicationFeeRefund),
469            "charge" => Ok(Charge),
470            "climate_order_purchase" => Ok(ClimateOrderPurchase),
471            "climate_order_refund" => Ok(ClimateOrderRefund),
472            "connect_collection_transfer" => Ok(ConnectCollectionTransfer),
473            "contribution" => Ok(Contribution),
474            "issuing_authorization_hold" => Ok(IssuingAuthorizationHold),
475            "issuing_authorization_release" => Ok(IssuingAuthorizationRelease),
476            "issuing_dispute" => Ok(IssuingDispute),
477            "issuing_transaction" => Ok(IssuingTransaction),
478            "obligation_outbound" => Ok(ObligationOutbound),
479            "obligation_reversal_inbound" => Ok(ObligationReversalInbound),
480            "payment" => Ok(Payment),
481            "payment_failure_refund" => Ok(PaymentFailureRefund),
482            "payment_network_reserve_hold" => Ok(PaymentNetworkReserveHold),
483            "payment_network_reserve_release" => Ok(PaymentNetworkReserveRelease),
484            "payment_refund" => Ok(PaymentRefund),
485            "payment_reversal" => Ok(PaymentReversal),
486            "payment_unreconciled" => Ok(PaymentUnreconciled),
487            "payout" => Ok(Payout),
488            "payout_cancel" => Ok(PayoutCancel),
489            "payout_failure" => Ok(PayoutFailure),
490            "payout_minimum_balance_hold" => Ok(PayoutMinimumBalanceHold),
491            "payout_minimum_balance_release" => Ok(PayoutMinimumBalanceRelease),
492            "refund" => Ok(Refund),
493            "refund_failure" => Ok(RefundFailure),
494            "reserve_transaction" => Ok(ReserveTransaction),
495            "reserved_funds" => Ok(ReservedFunds),
496            "stripe_balance_payment_debit" => Ok(StripeBalancePaymentDebit),
497            "stripe_balance_payment_debit_reversal" => Ok(StripeBalancePaymentDebitReversal),
498            "stripe_fee" => Ok(StripeFee),
499            "stripe_fx_fee" => Ok(StripeFxFee),
500            "tax_fee" => Ok(TaxFee),
501            "topup" => Ok(Topup),
502            "topup_reversal" => Ok(TopupReversal),
503            "transfer" => Ok(Transfer),
504            "transfer_cancel" => Ok(TransferCancel),
505            "transfer_failure" => Ok(TransferFailure),
506            "transfer_refund" => Ok(TransferRefund),
507            v => Ok(Unknown(v.to_owned())),
508        }
509    }
510}
511impl std::fmt::Display for BalanceTransactionType {
512    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
513        f.write_str(self.as_str())
514    }
515}
516
517impl std::fmt::Debug for BalanceTransactionType {
518    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
519        f.write_str(self.as_str())
520    }
521}
522#[cfg(feature = "serialize")]
523impl serde::Serialize for BalanceTransactionType {
524    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
525    where
526        S: serde::Serializer,
527    {
528        serializer.serialize_str(self.as_str())
529    }
530}
531impl miniserde::Deserialize for BalanceTransactionType {
532    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
533        crate::Place::new(out)
534    }
535}
536
537impl miniserde::de::Visitor for crate::Place<BalanceTransactionType> {
538    fn string(&mut self, s: &str) -> miniserde::Result<()> {
539        use std::str::FromStr;
540        self.out = Some(BalanceTransactionType::from_str(s).unwrap());
541        Ok(())
542    }
543}
544
545stripe_types::impl_from_val_with_from_str!(BalanceTransactionType);
546#[cfg(feature = "deserialize")]
547impl<'de> serde::Deserialize<'de> for BalanceTransactionType {
548    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
549        use std::str::FromStr;
550        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
551        Ok(Self::from_str(&s).unwrap())
552    }
553}
554impl stripe_types::Object for BalanceTransaction {
555    type Id = stripe_shared::BalanceTransactionId;
556    fn id(&self) -> &Self::Id {
557        &self.id
558    }
559
560    fn into_id(self) -> Self::Id {
561        self.id
562    }
563}
564stripe_types::def_id!(BalanceTransactionId);