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::{make_place, Deserialize, Result};
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
127                _ => <dyn Visitor>::ignore(),
128            })
129        }
130
131        fn deser_default() -> Self {
132            Self {
133                amount: Deserialize::default(),
134                available_on: Deserialize::default(),
135                balance_type: Deserialize::default(),
136                created: Deserialize::default(),
137                currency: Deserialize::default(),
138                description: Deserialize::default(),
139                exchange_rate: Deserialize::default(),
140                fee: Deserialize::default(),
141                fee_details: Deserialize::default(),
142                id: Deserialize::default(),
143                net: Deserialize::default(),
144                reporting_category: Deserialize::default(),
145                source: Deserialize::default(),
146                status: Deserialize::default(),
147                type_: Deserialize::default(),
148            }
149        }
150
151        fn take_out(&mut self) -> Option<Self::Out> {
152            let (
153                Some(amount),
154                Some(available_on),
155                Some(balance_type),
156                Some(created),
157                Some(currency),
158                Some(description),
159                Some(exchange_rate),
160                Some(fee),
161                Some(fee_details),
162                Some(id),
163                Some(net),
164                Some(reporting_category),
165                Some(source),
166                Some(status),
167                Some(type_),
168            ) = (
169                self.amount,
170                self.available_on,
171                self.balance_type,
172                self.created,
173                self.currency.take(),
174                self.description.take(),
175                self.exchange_rate,
176                self.fee,
177                self.fee_details.take(),
178                self.id.take(),
179                self.net,
180                self.reporting_category.take(),
181                self.source.take(),
182                self.status.take(),
183                self.type_.take(),
184            )
185            else {
186                return None;
187            };
188            Some(Self::Out {
189                amount,
190                available_on,
191                balance_type,
192                created,
193                currency,
194                description,
195                exchange_rate,
196                fee,
197                fee_details,
198                id,
199                net,
200                reporting_category,
201                source,
202                status,
203                type_,
204            })
205        }
206    }
207
208    impl Map for Builder<'_> {
209        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
210            self.builder.key(k)
211        }
212
213        fn finish(&mut self) -> Result<()> {
214            *self.out = self.builder.take_out();
215            Ok(())
216        }
217    }
218
219    impl ObjectDeser for BalanceTransaction {
220        type Builder = BalanceTransactionBuilder;
221    }
222
223    impl FromValueOpt for BalanceTransaction {
224        fn from_value(v: Value) -> Option<Self> {
225            let Value::Object(obj) = v else {
226                return None;
227            };
228            let mut b = BalanceTransactionBuilder::deser_default();
229            for (k, v) in obj {
230                match k.as_str() {
231                    "amount" => b.amount = FromValueOpt::from_value(v),
232                    "available_on" => b.available_on = FromValueOpt::from_value(v),
233                    "balance_type" => b.balance_type = FromValueOpt::from_value(v),
234                    "created" => b.created = FromValueOpt::from_value(v),
235                    "currency" => b.currency = FromValueOpt::from_value(v),
236                    "description" => b.description = FromValueOpt::from_value(v),
237                    "exchange_rate" => b.exchange_rate = FromValueOpt::from_value(v),
238                    "fee" => b.fee = FromValueOpt::from_value(v),
239                    "fee_details" => b.fee_details = FromValueOpt::from_value(v),
240                    "id" => b.id = FromValueOpt::from_value(v),
241                    "net" => b.net = FromValueOpt::from_value(v),
242                    "reporting_category" => b.reporting_category = FromValueOpt::from_value(v),
243                    "source" => b.source = FromValueOpt::from_value(v),
244                    "status" => b.status = FromValueOpt::from_value(v),
245                    "type" => b.type_ = FromValueOpt::from_value(v),
246
247                    _ => {}
248                }
249            }
250            b.take_out()
251        }
252    }
253};
254#[cfg(feature = "serialize")]
255impl serde::Serialize for BalanceTransaction {
256    fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
257        use serde::ser::SerializeStruct;
258        let mut s = s.serialize_struct("BalanceTransaction", 16)?;
259        s.serialize_field("amount", &self.amount)?;
260        s.serialize_field("available_on", &self.available_on)?;
261        s.serialize_field("balance_type", &self.balance_type)?;
262        s.serialize_field("created", &self.created)?;
263        s.serialize_field("currency", &self.currency)?;
264        s.serialize_field("description", &self.description)?;
265        s.serialize_field("exchange_rate", &self.exchange_rate)?;
266        s.serialize_field("fee", &self.fee)?;
267        s.serialize_field("fee_details", &self.fee_details)?;
268        s.serialize_field("id", &self.id)?;
269        s.serialize_field("net", &self.net)?;
270        s.serialize_field("reporting_category", &self.reporting_category)?;
271        s.serialize_field("source", &self.source)?;
272        s.serialize_field("status", &self.status)?;
273        s.serialize_field("type", &self.type_)?;
274
275        s.serialize_field("object", "balance_transaction")?;
276        s.end()
277    }
278}
279/// The balance that this transaction impacts.
280#[derive(Copy, Clone, Eq, PartialEq)]
281pub enum BalanceTransactionBalanceType {
282    Issuing,
283    Payments,
284    RefundAndDisputePrefunding,
285}
286impl BalanceTransactionBalanceType {
287    pub fn as_str(self) -> &'static str {
288        use BalanceTransactionBalanceType::*;
289        match self {
290            Issuing => "issuing",
291            Payments => "payments",
292            RefundAndDisputePrefunding => "refund_and_dispute_prefunding",
293        }
294    }
295}
296
297impl std::str::FromStr for BalanceTransactionBalanceType {
298    type Err = stripe_types::StripeParseError;
299    fn from_str(s: &str) -> Result<Self, Self::Err> {
300        use BalanceTransactionBalanceType::*;
301        match s {
302            "issuing" => Ok(Issuing),
303            "payments" => Ok(Payments),
304            "refund_and_dispute_prefunding" => Ok(RefundAndDisputePrefunding),
305            _ => Err(stripe_types::StripeParseError),
306        }
307    }
308}
309impl std::fmt::Display for BalanceTransactionBalanceType {
310    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
311        f.write_str(self.as_str())
312    }
313}
314
315impl std::fmt::Debug for BalanceTransactionBalanceType {
316    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
317        f.write_str(self.as_str())
318    }
319}
320#[cfg(feature = "serialize")]
321impl serde::Serialize for BalanceTransactionBalanceType {
322    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
323    where
324        S: serde::Serializer,
325    {
326        serializer.serialize_str(self.as_str())
327    }
328}
329impl miniserde::Deserialize for BalanceTransactionBalanceType {
330    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
331        crate::Place::new(out)
332    }
333}
334
335impl miniserde::de::Visitor for crate::Place<BalanceTransactionBalanceType> {
336    fn string(&mut self, s: &str) -> miniserde::Result<()> {
337        use std::str::FromStr;
338        self.out = Some(BalanceTransactionBalanceType::from_str(s).map_err(|_| miniserde::Error)?);
339        Ok(())
340    }
341}
342
343stripe_types::impl_from_val_with_from_str!(BalanceTransactionBalanceType);
344#[cfg(feature = "deserialize")]
345impl<'de> serde::Deserialize<'de> for BalanceTransactionBalanceType {
346    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
347        use std::str::FromStr;
348        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
349        Self::from_str(&s).map_err(|_| {
350            serde::de::Error::custom("Unknown value for BalanceTransactionBalanceType")
351        })
352    }
353}
354/// 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`.
355/// Learn more about [balance transaction types and what they represent](https://stripe.com/docs/reports/balance-transaction-types).
356/// To classify transactions for accounting purposes, consider `reporting_category` instead.
357#[derive(Clone, Eq, PartialEq)]
358#[non_exhaustive]
359pub enum BalanceTransactionType {
360    Adjustment,
361    Advance,
362    AdvanceFunding,
363    AnticipationRepayment,
364    ApplicationFee,
365    ApplicationFeeRefund,
366    Charge,
367    ClimateOrderPurchase,
368    ClimateOrderRefund,
369    ConnectCollectionTransfer,
370    Contribution,
371    IssuingAuthorizationHold,
372    IssuingAuthorizationRelease,
373    IssuingDispute,
374    IssuingTransaction,
375    ObligationOutbound,
376    ObligationReversalInbound,
377    Payment,
378    PaymentFailureRefund,
379    PaymentNetworkReserveHold,
380    PaymentNetworkReserveRelease,
381    PaymentRefund,
382    PaymentReversal,
383    PaymentUnreconciled,
384    Payout,
385    PayoutCancel,
386    PayoutFailure,
387    PayoutMinimumBalanceHold,
388    PayoutMinimumBalanceRelease,
389    Refund,
390    RefundFailure,
391    ReserveTransaction,
392    ReservedFunds,
393    StripeBalancePaymentDebit,
394    StripeBalancePaymentDebitReversal,
395    StripeFee,
396    StripeFxFee,
397    TaxFee,
398    Topup,
399    TopupReversal,
400    Transfer,
401    TransferCancel,
402    TransferFailure,
403    TransferRefund,
404    /// An unrecognized value from Stripe. Should not be used as a request parameter.
405    Unknown(String),
406}
407impl BalanceTransactionType {
408    pub fn as_str(&self) -> &str {
409        use BalanceTransactionType::*;
410        match self {
411            Adjustment => "adjustment",
412            Advance => "advance",
413            AdvanceFunding => "advance_funding",
414            AnticipationRepayment => "anticipation_repayment",
415            ApplicationFee => "application_fee",
416            ApplicationFeeRefund => "application_fee_refund",
417            Charge => "charge",
418            ClimateOrderPurchase => "climate_order_purchase",
419            ClimateOrderRefund => "climate_order_refund",
420            ConnectCollectionTransfer => "connect_collection_transfer",
421            Contribution => "contribution",
422            IssuingAuthorizationHold => "issuing_authorization_hold",
423            IssuingAuthorizationRelease => "issuing_authorization_release",
424            IssuingDispute => "issuing_dispute",
425            IssuingTransaction => "issuing_transaction",
426            ObligationOutbound => "obligation_outbound",
427            ObligationReversalInbound => "obligation_reversal_inbound",
428            Payment => "payment",
429            PaymentFailureRefund => "payment_failure_refund",
430            PaymentNetworkReserveHold => "payment_network_reserve_hold",
431            PaymentNetworkReserveRelease => "payment_network_reserve_release",
432            PaymentRefund => "payment_refund",
433            PaymentReversal => "payment_reversal",
434            PaymentUnreconciled => "payment_unreconciled",
435            Payout => "payout",
436            PayoutCancel => "payout_cancel",
437            PayoutFailure => "payout_failure",
438            PayoutMinimumBalanceHold => "payout_minimum_balance_hold",
439            PayoutMinimumBalanceRelease => "payout_minimum_balance_release",
440            Refund => "refund",
441            RefundFailure => "refund_failure",
442            ReserveTransaction => "reserve_transaction",
443            ReservedFunds => "reserved_funds",
444            StripeBalancePaymentDebit => "stripe_balance_payment_debit",
445            StripeBalancePaymentDebitReversal => "stripe_balance_payment_debit_reversal",
446            StripeFee => "stripe_fee",
447            StripeFxFee => "stripe_fx_fee",
448            TaxFee => "tax_fee",
449            Topup => "topup",
450            TopupReversal => "topup_reversal",
451            Transfer => "transfer",
452            TransferCancel => "transfer_cancel",
453            TransferFailure => "transfer_failure",
454            TransferRefund => "transfer_refund",
455            Unknown(v) => v,
456        }
457    }
458}
459
460impl std::str::FromStr for BalanceTransactionType {
461    type Err = std::convert::Infallible;
462    fn from_str(s: &str) -> Result<Self, Self::Err> {
463        use BalanceTransactionType::*;
464        match s {
465            "adjustment" => Ok(Adjustment),
466            "advance" => Ok(Advance),
467            "advance_funding" => Ok(AdvanceFunding),
468            "anticipation_repayment" => Ok(AnticipationRepayment),
469            "application_fee" => Ok(ApplicationFee),
470            "application_fee_refund" => Ok(ApplicationFeeRefund),
471            "charge" => Ok(Charge),
472            "climate_order_purchase" => Ok(ClimateOrderPurchase),
473            "climate_order_refund" => Ok(ClimateOrderRefund),
474            "connect_collection_transfer" => Ok(ConnectCollectionTransfer),
475            "contribution" => Ok(Contribution),
476            "issuing_authorization_hold" => Ok(IssuingAuthorizationHold),
477            "issuing_authorization_release" => Ok(IssuingAuthorizationRelease),
478            "issuing_dispute" => Ok(IssuingDispute),
479            "issuing_transaction" => Ok(IssuingTransaction),
480            "obligation_outbound" => Ok(ObligationOutbound),
481            "obligation_reversal_inbound" => Ok(ObligationReversalInbound),
482            "payment" => Ok(Payment),
483            "payment_failure_refund" => Ok(PaymentFailureRefund),
484            "payment_network_reserve_hold" => Ok(PaymentNetworkReserveHold),
485            "payment_network_reserve_release" => Ok(PaymentNetworkReserveRelease),
486            "payment_refund" => Ok(PaymentRefund),
487            "payment_reversal" => Ok(PaymentReversal),
488            "payment_unreconciled" => Ok(PaymentUnreconciled),
489            "payout" => Ok(Payout),
490            "payout_cancel" => Ok(PayoutCancel),
491            "payout_failure" => Ok(PayoutFailure),
492            "payout_minimum_balance_hold" => Ok(PayoutMinimumBalanceHold),
493            "payout_minimum_balance_release" => Ok(PayoutMinimumBalanceRelease),
494            "refund" => Ok(Refund),
495            "refund_failure" => Ok(RefundFailure),
496            "reserve_transaction" => Ok(ReserveTransaction),
497            "reserved_funds" => Ok(ReservedFunds),
498            "stripe_balance_payment_debit" => Ok(StripeBalancePaymentDebit),
499            "stripe_balance_payment_debit_reversal" => Ok(StripeBalancePaymentDebitReversal),
500            "stripe_fee" => Ok(StripeFee),
501            "stripe_fx_fee" => Ok(StripeFxFee),
502            "tax_fee" => Ok(TaxFee),
503            "topup" => Ok(Topup),
504            "topup_reversal" => Ok(TopupReversal),
505            "transfer" => Ok(Transfer),
506            "transfer_cancel" => Ok(TransferCancel),
507            "transfer_failure" => Ok(TransferFailure),
508            "transfer_refund" => Ok(TransferRefund),
509            v => Ok(Unknown(v.to_owned())),
510        }
511    }
512}
513impl std::fmt::Display for BalanceTransactionType {
514    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
515        f.write_str(self.as_str())
516    }
517}
518
519impl std::fmt::Debug for BalanceTransactionType {
520    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
521        f.write_str(self.as_str())
522    }
523}
524#[cfg(feature = "serialize")]
525impl serde::Serialize for BalanceTransactionType {
526    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
527    where
528        S: serde::Serializer,
529    {
530        serializer.serialize_str(self.as_str())
531    }
532}
533impl miniserde::Deserialize for BalanceTransactionType {
534    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
535        crate::Place::new(out)
536    }
537}
538
539impl miniserde::de::Visitor for crate::Place<BalanceTransactionType> {
540    fn string(&mut self, s: &str) -> miniserde::Result<()> {
541        use std::str::FromStr;
542        self.out = Some(BalanceTransactionType::from_str(s).unwrap());
543        Ok(())
544    }
545}
546
547stripe_types::impl_from_val_with_from_str!(BalanceTransactionType);
548#[cfg(feature = "deserialize")]
549impl<'de> serde::Deserialize<'de> for BalanceTransactionType {
550    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
551        use std::str::FromStr;
552        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
553        Ok(Self::from_str(&s).unwrap())
554    }
555}
556impl stripe_types::Object for BalanceTransaction {
557    type Id = stripe_shared::BalanceTransactionId;
558    fn id(&self) -> &Self::Id {
559        &self.id
560    }
561
562    fn into_id(self) -> Self::Id {
563        self.id
564    }
565}
566stripe_types::def_id!(BalanceTransactionId);