stripe_shared/
event.rs

1/// Snapshot events allow you to track and react to activity in your Stripe integration. When
2/// the state of another API resource changes, Stripe creates an `Event` object that contains
3/// all the relevant information associated with that action, including the affected API
4/// resource. For example, a successful payment triggers a `charge.succeeded` event, which
5/// contains the `Charge` in the event's data property. Some actions trigger multiple events.
6/// For example, if you create a new subscription for a customer, it triggers both a
7/// `customer.subscription.created` event and a `charge.succeeded` event.
8///
9/// Configure an event destination in your account to listen for events that represent actions
10/// your integration needs to respond to. Additionally, you can retrieve an individual event or
11/// a list of events from the API.
12///
13/// [Connect](https://docs.stripe.com/connect) platforms can also receive event notifications
14/// that occur in their connected accounts. These events include an account attribute that
15/// identifies the relevant connected account.
16///
17/// You can access events through the [Retrieve Event API](https://docs.stripe.com/api/events#retrieve_event).
18/// for 30 days.
19///
20/// For more details see <<https://stripe.com/docs/api/events/object>>.
21#[derive(Clone, Debug)]
22#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
23pub struct Event {
24    /// The connected account that originates the event.
25    pub account: Option<String>,
26    /// The Stripe API version used to render `data` when the event was created.
27    /// The contents of `data` never change, so this value remains static regardless of the API version currently in use.
28    /// This property is populated only for events created on or after October 31, 2014.
29    pub api_version: Option<String>,
30    /// Authentication context needed to fetch the event or related object.
31    pub context: Option<String>,
32    /// Time at which the object was created. Measured in seconds since the Unix epoch.
33    pub created: stripe_types::Timestamp,
34    pub data: stripe_shared::NotificationEventData,
35    /// Unique identifier for the object.
36    pub id: stripe_shared::EventId,
37    /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
38    pub livemode: bool,
39    /// Number of webhooks that haven't been successfully delivered (for example, to return a 20x response) to the URLs you specify.
40    pub pending_webhooks: i64,
41    /// Information on the API request that triggers the event.
42    pub request: Option<stripe_shared::NotificationEventRequest>,
43    /// Description of the event (for example, `invoice.created` or `charge.refunded`).
44    #[cfg_attr(feature = "deserialize", serde(rename = "type"))]
45    pub type_: EventType,
46}
47#[doc(hidden)]
48pub struct EventBuilder {
49    account: Option<Option<String>>,
50    api_version: Option<Option<String>>,
51    context: Option<Option<String>>,
52    created: Option<stripe_types::Timestamp>,
53    data: Option<stripe_shared::NotificationEventData>,
54    id: Option<stripe_shared::EventId>,
55    livemode: Option<bool>,
56    pending_webhooks: Option<i64>,
57    request: Option<Option<stripe_shared::NotificationEventRequest>>,
58    type_: Option<EventType>,
59}
60
61#[allow(
62    unused_variables,
63    irrefutable_let_patterns,
64    clippy::let_unit_value,
65    clippy::match_single_binding,
66    clippy::single_match
67)]
68const _: () = {
69    use miniserde::de::{Map, Visitor};
70    use miniserde::json::Value;
71    use miniserde::{make_place, Deserialize, Result};
72    use stripe_types::miniserde_helpers::FromValueOpt;
73    use stripe_types::{MapBuilder, ObjectDeser};
74
75    make_place!(Place);
76
77    impl Deserialize for Event {
78        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
79            Place::new(out)
80        }
81    }
82
83    struct Builder<'a> {
84        out: &'a mut Option<Event>,
85        builder: EventBuilder,
86    }
87
88    impl Visitor for Place<Event> {
89        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
90            Ok(Box::new(Builder { out: &mut self.out, builder: EventBuilder::deser_default() }))
91        }
92    }
93
94    impl MapBuilder for EventBuilder {
95        type Out = Event;
96        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
97            Ok(match k {
98                "account" => Deserialize::begin(&mut self.account),
99                "api_version" => Deserialize::begin(&mut self.api_version),
100                "context" => Deserialize::begin(&mut self.context),
101                "created" => Deserialize::begin(&mut self.created),
102                "data" => Deserialize::begin(&mut self.data),
103                "id" => Deserialize::begin(&mut self.id),
104                "livemode" => Deserialize::begin(&mut self.livemode),
105                "pending_webhooks" => Deserialize::begin(&mut self.pending_webhooks),
106                "request" => Deserialize::begin(&mut self.request),
107                "type" => Deserialize::begin(&mut self.type_),
108
109                _ => <dyn Visitor>::ignore(),
110            })
111        }
112
113        fn deser_default() -> Self {
114            Self {
115                account: Deserialize::default(),
116                api_version: Deserialize::default(),
117                context: Deserialize::default(),
118                created: Deserialize::default(),
119                data: Deserialize::default(),
120                id: Deserialize::default(),
121                livemode: Deserialize::default(),
122                pending_webhooks: Deserialize::default(),
123                request: Deserialize::default(),
124                type_: Deserialize::default(),
125            }
126        }
127
128        fn take_out(&mut self) -> Option<Self::Out> {
129            let (
130                Some(account),
131                Some(api_version),
132                Some(context),
133                Some(created),
134                Some(data),
135                Some(id),
136                Some(livemode),
137                Some(pending_webhooks),
138                Some(request),
139                Some(type_),
140            ) = (
141                self.account.take(),
142                self.api_version.take(),
143                self.context.take(),
144                self.created,
145                self.data.take(),
146                self.id.take(),
147                self.livemode,
148                self.pending_webhooks,
149                self.request.take(),
150                self.type_.take(),
151            )
152            else {
153                return None;
154            };
155            Some(Self::Out {
156                account,
157                api_version,
158                context,
159                created,
160                data,
161                id,
162                livemode,
163                pending_webhooks,
164                request,
165                type_,
166            })
167        }
168    }
169
170    impl Map for Builder<'_> {
171        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
172            self.builder.key(k)
173        }
174
175        fn finish(&mut self) -> Result<()> {
176            *self.out = self.builder.take_out();
177            Ok(())
178        }
179    }
180
181    impl ObjectDeser for Event {
182        type Builder = EventBuilder;
183    }
184
185    impl FromValueOpt for Event {
186        fn from_value(v: Value) -> Option<Self> {
187            let Value::Object(obj) = v else {
188                return None;
189            };
190            let mut b = EventBuilder::deser_default();
191            for (k, v) in obj {
192                match k.as_str() {
193                    "account" => b.account = FromValueOpt::from_value(v),
194                    "api_version" => b.api_version = FromValueOpt::from_value(v),
195                    "context" => b.context = FromValueOpt::from_value(v),
196                    "created" => b.created = FromValueOpt::from_value(v),
197                    "data" => b.data = FromValueOpt::from_value(v),
198                    "id" => b.id = FromValueOpt::from_value(v),
199                    "livemode" => b.livemode = FromValueOpt::from_value(v),
200                    "pending_webhooks" => b.pending_webhooks = FromValueOpt::from_value(v),
201                    "request" => b.request = FromValueOpt::from_value(v),
202                    "type" => b.type_ = FromValueOpt::from_value(v),
203
204                    _ => {}
205                }
206            }
207            b.take_out()
208        }
209    }
210};
211#[cfg(feature = "serialize")]
212impl serde::Serialize for Event {
213    fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
214        use serde::ser::SerializeStruct;
215        let mut s = s.serialize_struct("Event", 11)?;
216        s.serialize_field("account", &self.account)?;
217        s.serialize_field("api_version", &self.api_version)?;
218        s.serialize_field("context", &self.context)?;
219        s.serialize_field("created", &self.created)?;
220        s.serialize_field("data", &self.data)?;
221        s.serialize_field("id", &self.id)?;
222        s.serialize_field("livemode", &self.livemode)?;
223        s.serialize_field("pending_webhooks", &self.pending_webhooks)?;
224        s.serialize_field("request", &self.request)?;
225        s.serialize_field("type", &self.type_)?;
226
227        s.serialize_field("object", "event")?;
228        s.end()
229    }
230}
231/// Description of the event (for example, `invoice.created` or `charge.refunded`).
232#[derive(Clone, Eq, PartialEq)]
233#[non_exhaustive]
234pub enum EventType {
235    AccountApplicationAuthorized,
236    AccountApplicationDeauthorized,
237    AccountExternalAccountCreated,
238    AccountExternalAccountDeleted,
239    AccountExternalAccountUpdated,
240    AccountUpdated,
241    ApplicationFeeCreated,
242    ApplicationFeeRefundUpdated,
243    ApplicationFeeRefunded,
244    BalanceAvailable,
245    BillingAlertTriggered,
246    BillingPortalConfigurationCreated,
247    BillingPortalConfigurationUpdated,
248    BillingPortalSessionCreated,
249    CapabilityUpdated,
250    CashBalanceFundsAvailable,
251    ChargeCaptured,
252    ChargeDisputeClosed,
253    ChargeDisputeCreated,
254    ChargeDisputeFundsReinstated,
255    ChargeDisputeFundsWithdrawn,
256    ChargeDisputeUpdated,
257    ChargeExpired,
258    ChargeFailed,
259    ChargePending,
260    ChargeRefundUpdated,
261    ChargeRefunded,
262    ChargeSucceeded,
263    ChargeUpdated,
264    CheckoutSessionAsyncPaymentFailed,
265    CheckoutSessionAsyncPaymentSucceeded,
266    CheckoutSessionCompleted,
267    CheckoutSessionExpired,
268    ClimateOrderCanceled,
269    ClimateOrderCreated,
270    ClimateOrderDelayed,
271    ClimateOrderDelivered,
272    ClimateOrderProductSubstituted,
273    ClimateProductCreated,
274    ClimateProductPricingUpdated,
275    CouponCreated,
276    CouponDeleted,
277    CouponUpdated,
278    CreditNoteCreated,
279    CreditNoteUpdated,
280    CreditNoteVoided,
281    CustomerCreated,
282    CustomerDeleted,
283    CustomerDiscountCreated,
284    CustomerDiscountDeleted,
285    CustomerDiscountUpdated,
286    CustomerSourceCreated,
287    CustomerSourceDeleted,
288    CustomerSourceExpiring,
289    CustomerSourceUpdated,
290    CustomerSubscriptionCreated,
291    CustomerSubscriptionDeleted,
292    CustomerSubscriptionPaused,
293    CustomerSubscriptionPendingUpdateApplied,
294    CustomerSubscriptionPendingUpdateExpired,
295    CustomerSubscriptionResumed,
296    CustomerSubscriptionTrialWillEnd,
297    CustomerSubscriptionUpdated,
298    CustomerTaxIdCreated,
299    CustomerTaxIdDeleted,
300    CustomerTaxIdUpdated,
301    CustomerUpdated,
302    CustomerCashBalanceTransactionCreated,
303    EntitlementsActiveEntitlementSummaryUpdated,
304    FileCreated,
305    FinancialConnectionsAccountCreated,
306    FinancialConnectionsAccountDeactivated,
307    FinancialConnectionsAccountDisconnected,
308    FinancialConnectionsAccountReactivated,
309    FinancialConnectionsAccountRefreshedBalance,
310    FinancialConnectionsAccountRefreshedOwnership,
311    FinancialConnectionsAccountRefreshedTransactions,
312    IdentityVerificationSessionCanceled,
313    IdentityVerificationSessionCreated,
314    IdentityVerificationSessionProcessing,
315    IdentityVerificationSessionRedacted,
316    IdentityVerificationSessionRequiresInput,
317    IdentityVerificationSessionVerified,
318    InvoiceCreated,
319    InvoiceDeleted,
320    InvoiceFinalizationFailed,
321    InvoiceFinalized,
322    InvoiceMarkedUncollectible,
323    InvoiceOverdue,
324    InvoiceOverpaid,
325    InvoicePaid,
326    InvoicePaymentActionRequired,
327    InvoicePaymentFailed,
328    InvoicePaymentSucceeded,
329    InvoiceSent,
330    InvoiceUpcoming,
331    InvoiceUpdated,
332    InvoiceVoided,
333    InvoiceWillBeDue,
334    InvoicePaymentPaid,
335    InvoiceitemCreated,
336    InvoiceitemDeleted,
337    IssuingAuthorizationCreated,
338    IssuingAuthorizationRequest,
339    IssuingAuthorizationUpdated,
340    IssuingCardCreated,
341    IssuingCardUpdated,
342    IssuingCardholderCreated,
343    IssuingCardholderUpdated,
344    IssuingDisputeClosed,
345    IssuingDisputeCreated,
346    IssuingDisputeFundsReinstated,
347    IssuingDisputeFundsRescinded,
348    IssuingDisputeSubmitted,
349    IssuingDisputeUpdated,
350    IssuingPersonalizationDesignActivated,
351    IssuingPersonalizationDesignDeactivated,
352    IssuingPersonalizationDesignRejected,
353    IssuingPersonalizationDesignUpdated,
354    IssuingTokenCreated,
355    IssuingTokenUpdated,
356    IssuingTransactionCreated,
357    IssuingTransactionPurchaseDetailsReceiptUpdated,
358    IssuingTransactionUpdated,
359    MandateUpdated,
360    PaymentIntentAmountCapturableUpdated,
361    PaymentIntentCanceled,
362    PaymentIntentCreated,
363    PaymentIntentPartiallyFunded,
364    PaymentIntentPaymentFailed,
365    PaymentIntentProcessing,
366    PaymentIntentRequiresAction,
367    PaymentIntentSucceeded,
368    PaymentLinkCreated,
369    PaymentLinkUpdated,
370    PaymentMethodAttached,
371    PaymentMethodAutomaticallyUpdated,
372    PaymentMethodDetached,
373    PaymentMethodUpdated,
374    PayoutCanceled,
375    PayoutCreated,
376    PayoutFailed,
377    PayoutPaid,
378    PayoutReconciliationCompleted,
379    PayoutUpdated,
380    PersonCreated,
381    PersonDeleted,
382    PersonUpdated,
383    PlanCreated,
384    PlanDeleted,
385    PlanUpdated,
386    PriceCreated,
387    PriceDeleted,
388    PriceUpdated,
389    ProductCreated,
390    ProductDeleted,
391    ProductUpdated,
392    PromotionCodeCreated,
393    PromotionCodeUpdated,
394    QuoteAccepted,
395    QuoteCanceled,
396    QuoteCreated,
397    QuoteFinalized,
398    RadarEarlyFraudWarningCreated,
399    RadarEarlyFraudWarningUpdated,
400    RefundCreated,
401    RefundFailed,
402    RefundUpdated,
403    ReportingReportRunFailed,
404    ReportingReportRunSucceeded,
405    ReportingReportTypeUpdated,
406    ReviewClosed,
407    ReviewOpened,
408    SetupIntentCanceled,
409    SetupIntentCreated,
410    SetupIntentRequiresAction,
411    SetupIntentSetupFailed,
412    SetupIntentSucceeded,
413    SigmaScheduledQueryRunCreated,
414    SourceCanceled,
415    SourceChargeable,
416    SourceFailed,
417    SourceMandateNotification,
418    SourceRefundAttributesRequired,
419    SourceTransactionCreated,
420    SourceTransactionUpdated,
421    SubscriptionScheduleAborted,
422    SubscriptionScheduleCanceled,
423    SubscriptionScheduleCompleted,
424    SubscriptionScheduleCreated,
425    SubscriptionScheduleExpiring,
426    SubscriptionScheduleReleased,
427    SubscriptionScheduleUpdated,
428    TaxSettingsUpdated,
429    TaxRateCreated,
430    TaxRateUpdated,
431    TerminalReaderActionFailed,
432    TerminalReaderActionSucceeded,
433    TerminalReaderActionUpdated,
434    TestHelpersTestClockAdvancing,
435    TestHelpersTestClockCreated,
436    TestHelpersTestClockDeleted,
437    TestHelpersTestClockInternalFailure,
438    TestHelpersTestClockReady,
439    TopupCanceled,
440    TopupCreated,
441    TopupFailed,
442    TopupReversed,
443    TopupSucceeded,
444    TransferCreated,
445    TransferReversed,
446    TransferUpdated,
447    TreasuryCreditReversalCreated,
448    TreasuryCreditReversalPosted,
449    TreasuryDebitReversalCompleted,
450    TreasuryDebitReversalCreated,
451    TreasuryDebitReversalInitialCreditGranted,
452    TreasuryFinancialAccountClosed,
453    TreasuryFinancialAccountCreated,
454    TreasuryFinancialAccountFeaturesStatusUpdated,
455    TreasuryInboundTransferCanceled,
456    TreasuryInboundTransferCreated,
457    TreasuryInboundTransferFailed,
458    TreasuryInboundTransferSucceeded,
459    TreasuryOutboundPaymentCanceled,
460    TreasuryOutboundPaymentCreated,
461    TreasuryOutboundPaymentExpectedArrivalDateUpdated,
462    TreasuryOutboundPaymentFailed,
463    TreasuryOutboundPaymentPosted,
464    TreasuryOutboundPaymentReturned,
465    TreasuryOutboundPaymentTrackingDetailsUpdated,
466    TreasuryOutboundTransferCanceled,
467    TreasuryOutboundTransferCreated,
468    TreasuryOutboundTransferExpectedArrivalDateUpdated,
469    TreasuryOutboundTransferFailed,
470    TreasuryOutboundTransferPosted,
471    TreasuryOutboundTransferReturned,
472    TreasuryOutboundTransferTrackingDetailsUpdated,
473    TreasuryReceivedCreditCreated,
474    TreasuryReceivedCreditFailed,
475    TreasuryReceivedCreditSucceeded,
476    TreasuryReceivedDebitCreated,
477    /// An unrecognized value from Stripe. Should not be used as a request parameter.
478    Unknown(String),
479}
480impl EventType {
481    pub fn as_str(&self) -> &str {
482        use EventType::*;
483        match self {
484            AccountApplicationAuthorized => "account.application.authorized",
485            AccountApplicationDeauthorized => "account.application.deauthorized",
486            AccountExternalAccountCreated => "account.external_account.created",
487            AccountExternalAccountDeleted => "account.external_account.deleted",
488            AccountExternalAccountUpdated => "account.external_account.updated",
489            AccountUpdated => "account.updated",
490            ApplicationFeeCreated => "application_fee.created",
491            ApplicationFeeRefundUpdated => "application_fee.refund.updated",
492            ApplicationFeeRefunded => "application_fee.refunded",
493            BalanceAvailable => "balance.available",
494            BillingAlertTriggered => "billing.alert.triggered",
495            BillingPortalConfigurationCreated => "billing_portal.configuration.created",
496            BillingPortalConfigurationUpdated => "billing_portal.configuration.updated",
497            BillingPortalSessionCreated => "billing_portal.session.created",
498            CapabilityUpdated => "capability.updated",
499            CashBalanceFundsAvailable => "cash_balance.funds_available",
500            ChargeCaptured => "charge.captured",
501            ChargeDisputeClosed => "charge.dispute.closed",
502            ChargeDisputeCreated => "charge.dispute.created",
503            ChargeDisputeFundsReinstated => "charge.dispute.funds_reinstated",
504            ChargeDisputeFundsWithdrawn => "charge.dispute.funds_withdrawn",
505            ChargeDisputeUpdated => "charge.dispute.updated",
506            ChargeExpired => "charge.expired",
507            ChargeFailed => "charge.failed",
508            ChargePending => "charge.pending",
509            ChargeRefundUpdated => "charge.refund.updated",
510            ChargeRefunded => "charge.refunded",
511            ChargeSucceeded => "charge.succeeded",
512            ChargeUpdated => "charge.updated",
513            CheckoutSessionAsyncPaymentFailed => "checkout.session.async_payment_failed",
514            CheckoutSessionAsyncPaymentSucceeded => "checkout.session.async_payment_succeeded",
515            CheckoutSessionCompleted => "checkout.session.completed",
516            CheckoutSessionExpired => "checkout.session.expired",
517            ClimateOrderCanceled => "climate.order.canceled",
518            ClimateOrderCreated => "climate.order.created",
519            ClimateOrderDelayed => "climate.order.delayed",
520            ClimateOrderDelivered => "climate.order.delivered",
521            ClimateOrderProductSubstituted => "climate.order.product_substituted",
522            ClimateProductCreated => "climate.product.created",
523            ClimateProductPricingUpdated => "climate.product.pricing_updated",
524            CouponCreated => "coupon.created",
525            CouponDeleted => "coupon.deleted",
526            CouponUpdated => "coupon.updated",
527            CreditNoteCreated => "credit_note.created",
528            CreditNoteUpdated => "credit_note.updated",
529            CreditNoteVoided => "credit_note.voided",
530            CustomerCreated => "customer.created",
531            CustomerDeleted => "customer.deleted",
532            CustomerDiscountCreated => "customer.discount.created",
533            CustomerDiscountDeleted => "customer.discount.deleted",
534            CustomerDiscountUpdated => "customer.discount.updated",
535            CustomerSourceCreated => "customer.source.created",
536            CustomerSourceDeleted => "customer.source.deleted",
537            CustomerSourceExpiring => "customer.source.expiring",
538            CustomerSourceUpdated => "customer.source.updated",
539            CustomerSubscriptionCreated => "customer.subscription.created",
540            CustomerSubscriptionDeleted => "customer.subscription.deleted",
541            CustomerSubscriptionPaused => "customer.subscription.paused",
542            CustomerSubscriptionPendingUpdateApplied => {
543                "customer.subscription.pending_update_applied"
544            }
545            CustomerSubscriptionPendingUpdateExpired => {
546                "customer.subscription.pending_update_expired"
547            }
548            CustomerSubscriptionResumed => "customer.subscription.resumed",
549            CustomerSubscriptionTrialWillEnd => "customer.subscription.trial_will_end",
550            CustomerSubscriptionUpdated => "customer.subscription.updated",
551            CustomerTaxIdCreated => "customer.tax_id.created",
552            CustomerTaxIdDeleted => "customer.tax_id.deleted",
553            CustomerTaxIdUpdated => "customer.tax_id.updated",
554            CustomerUpdated => "customer.updated",
555            CustomerCashBalanceTransactionCreated => "customer_cash_balance_transaction.created",
556            EntitlementsActiveEntitlementSummaryUpdated => {
557                "entitlements.active_entitlement_summary.updated"
558            }
559            FileCreated => "file.created",
560            FinancialConnectionsAccountCreated => "financial_connections.account.created",
561            FinancialConnectionsAccountDeactivated => "financial_connections.account.deactivated",
562            FinancialConnectionsAccountDisconnected => "financial_connections.account.disconnected",
563            FinancialConnectionsAccountReactivated => "financial_connections.account.reactivated",
564            FinancialConnectionsAccountRefreshedBalance => {
565                "financial_connections.account.refreshed_balance"
566            }
567            FinancialConnectionsAccountRefreshedOwnership => {
568                "financial_connections.account.refreshed_ownership"
569            }
570            FinancialConnectionsAccountRefreshedTransactions => {
571                "financial_connections.account.refreshed_transactions"
572            }
573            IdentityVerificationSessionCanceled => "identity.verification_session.canceled",
574            IdentityVerificationSessionCreated => "identity.verification_session.created",
575            IdentityVerificationSessionProcessing => "identity.verification_session.processing",
576            IdentityVerificationSessionRedacted => "identity.verification_session.redacted",
577            IdentityVerificationSessionRequiresInput => {
578                "identity.verification_session.requires_input"
579            }
580            IdentityVerificationSessionVerified => "identity.verification_session.verified",
581            InvoiceCreated => "invoice.created",
582            InvoiceDeleted => "invoice.deleted",
583            InvoiceFinalizationFailed => "invoice.finalization_failed",
584            InvoiceFinalized => "invoice.finalized",
585            InvoiceMarkedUncollectible => "invoice.marked_uncollectible",
586            InvoiceOverdue => "invoice.overdue",
587            InvoiceOverpaid => "invoice.overpaid",
588            InvoicePaid => "invoice.paid",
589            InvoicePaymentActionRequired => "invoice.payment_action_required",
590            InvoicePaymentFailed => "invoice.payment_failed",
591            InvoicePaymentSucceeded => "invoice.payment_succeeded",
592            InvoiceSent => "invoice.sent",
593            InvoiceUpcoming => "invoice.upcoming",
594            InvoiceUpdated => "invoice.updated",
595            InvoiceVoided => "invoice.voided",
596            InvoiceWillBeDue => "invoice.will_be_due",
597            InvoicePaymentPaid => "invoice_payment.paid",
598            InvoiceitemCreated => "invoiceitem.created",
599            InvoiceitemDeleted => "invoiceitem.deleted",
600            IssuingAuthorizationCreated => "issuing_authorization.created",
601            IssuingAuthorizationRequest => "issuing_authorization.request",
602            IssuingAuthorizationUpdated => "issuing_authorization.updated",
603            IssuingCardCreated => "issuing_card.created",
604            IssuingCardUpdated => "issuing_card.updated",
605            IssuingCardholderCreated => "issuing_cardholder.created",
606            IssuingCardholderUpdated => "issuing_cardholder.updated",
607            IssuingDisputeClosed => "issuing_dispute.closed",
608            IssuingDisputeCreated => "issuing_dispute.created",
609            IssuingDisputeFundsReinstated => "issuing_dispute.funds_reinstated",
610            IssuingDisputeFundsRescinded => "issuing_dispute.funds_rescinded",
611            IssuingDisputeSubmitted => "issuing_dispute.submitted",
612            IssuingDisputeUpdated => "issuing_dispute.updated",
613            IssuingPersonalizationDesignActivated => "issuing_personalization_design.activated",
614            IssuingPersonalizationDesignDeactivated => "issuing_personalization_design.deactivated",
615            IssuingPersonalizationDesignRejected => "issuing_personalization_design.rejected",
616            IssuingPersonalizationDesignUpdated => "issuing_personalization_design.updated",
617            IssuingTokenCreated => "issuing_token.created",
618            IssuingTokenUpdated => "issuing_token.updated",
619            IssuingTransactionCreated => "issuing_transaction.created",
620            IssuingTransactionPurchaseDetailsReceiptUpdated => {
621                "issuing_transaction.purchase_details_receipt_updated"
622            }
623            IssuingTransactionUpdated => "issuing_transaction.updated",
624            MandateUpdated => "mandate.updated",
625            PaymentIntentAmountCapturableUpdated => "payment_intent.amount_capturable_updated",
626            PaymentIntentCanceled => "payment_intent.canceled",
627            PaymentIntentCreated => "payment_intent.created",
628            PaymentIntentPartiallyFunded => "payment_intent.partially_funded",
629            PaymentIntentPaymentFailed => "payment_intent.payment_failed",
630            PaymentIntentProcessing => "payment_intent.processing",
631            PaymentIntentRequiresAction => "payment_intent.requires_action",
632            PaymentIntentSucceeded => "payment_intent.succeeded",
633            PaymentLinkCreated => "payment_link.created",
634            PaymentLinkUpdated => "payment_link.updated",
635            PaymentMethodAttached => "payment_method.attached",
636            PaymentMethodAutomaticallyUpdated => "payment_method.automatically_updated",
637            PaymentMethodDetached => "payment_method.detached",
638            PaymentMethodUpdated => "payment_method.updated",
639            PayoutCanceled => "payout.canceled",
640            PayoutCreated => "payout.created",
641            PayoutFailed => "payout.failed",
642            PayoutPaid => "payout.paid",
643            PayoutReconciliationCompleted => "payout.reconciliation_completed",
644            PayoutUpdated => "payout.updated",
645            PersonCreated => "person.created",
646            PersonDeleted => "person.deleted",
647            PersonUpdated => "person.updated",
648            PlanCreated => "plan.created",
649            PlanDeleted => "plan.deleted",
650            PlanUpdated => "plan.updated",
651            PriceCreated => "price.created",
652            PriceDeleted => "price.deleted",
653            PriceUpdated => "price.updated",
654            ProductCreated => "product.created",
655            ProductDeleted => "product.deleted",
656            ProductUpdated => "product.updated",
657            PromotionCodeCreated => "promotion_code.created",
658            PromotionCodeUpdated => "promotion_code.updated",
659            QuoteAccepted => "quote.accepted",
660            QuoteCanceled => "quote.canceled",
661            QuoteCreated => "quote.created",
662            QuoteFinalized => "quote.finalized",
663            RadarEarlyFraudWarningCreated => "radar.early_fraud_warning.created",
664            RadarEarlyFraudWarningUpdated => "radar.early_fraud_warning.updated",
665            RefundCreated => "refund.created",
666            RefundFailed => "refund.failed",
667            RefundUpdated => "refund.updated",
668            ReportingReportRunFailed => "reporting.report_run.failed",
669            ReportingReportRunSucceeded => "reporting.report_run.succeeded",
670            ReportingReportTypeUpdated => "reporting.report_type.updated",
671            ReviewClosed => "review.closed",
672            ReviewOpened => "review.opened",
673            SetupIntentCanceled => "setup_intent.canceled",
674            SetupIntentCreated => "setup_intent.created",
675            SetupIntentRequiresAction => "setup_intent.requires_action",
676            SetupIntentSetupFailed => "setup_intent.setup_failed",
677            SetupIntentSucceeded => "setup_intent.succeeded",
678            SigmaScheduledQueryRunCreated => "sigma.scheduled_query_run.created",
679            SourceCanceled => "source.canceled",
680            SourceChargeable => "source.chargeable",
681            SourceFailed => "source.failed",
682            SourceMandateNotification => "source.mandate_notification",
683            SourceRefundAttributesRequired => "source.refund_attributes_required",
684            SourceTransactionCreated => "source.transaction.created",
685            SourceTransactionUpdated => "source.transaction.updated",
686            SubscriptionScheduleAborted => "subscription_schedule.aborted",
687            SubscriptionScheduleCanceled => "subscription_schedule.canceled",
688            SubscriptionScheduleCompleted => "subscription_schedule.completed",
689            SubscriptionScheduleCreated => "subscription_schedule.created",
690            SubscriptionScheduleExpiring => "subscription_schedule.expiring",
691            SubscriptionScheduleReleased => "subscription_schedule.released",
692            SubscriptionScheduleUpdated => "subscription_schedule.updated",
693            TaxSettingsUpdated => "tax.settings.updated",
694            TaxRateCreated => "tax_rate.created",
695            TaxRateUpdated => "tax_rate.updated",
696            TerminalReaderActionFailed => "terminal.reader.action_failed",
697            TerminalReaderActionSucceeded => "terminal.reader.action_succeeded",
698            TerminalReaderActionUpdated => "terminal.reader.action_updated",
699            TestHelpersTestClockAdvancing => "test_helpers.test_clock.advancing",
700            TestHelpersTestClockCreated => "test_helpers.test_clock.created",
701            TestHelpersTestClockDeleted => "test_helpers.test_clock.deleted",
702            TestHelpersTestClockInternalFailure => "test_helpers.test_clock.internal_failure",
703            TestHelpersTestClockReady => "test_helpers.test_clock.ready",
704            TopupCanceled => "topup.canceled",
705            TopupCreated => "topup.created",
706            TopupFailed => "topup.failed",
707            TopupReversed => "topup.reversed",
708            TopupSucceeded => "topup.succeeded",
709            TransferCreated => "transfer.created",
710            TransferReversed => "transfer.reversed",
711            TransferUpdated => "transfer.updated",
712            TreasuryCreditReversalCreated => "treasury.credit_reversal.created",
713            TreasuryCreditReversalPosted => "treasury.credit_reversal.posted",
714            TreasuryDebitReversalCompleted => "treasury.debit_reversal.completed",
715            TreasuryDebitReversalCreated => "treasury.debit_reversal.created",
716            TreasuryDebitReversalInitialCreditGranted => {
717                "treasury.debit_reversal.initial_credit_granted"
718            }
719            TreasuryFinancialAccountClosed => "treasury.financial_account.closed",
720            TreasuryFinancialAccountCreated => "treasury.financial_account.created",
721            TreasuryFinancialAccountFeaturesStatusUpdated => {
722                "treasury.financial_account.features_status_updated"
723            }
724            TreasuryInboundTransferCanceled => "treasury.inbound_transfer.canceled",
725            TreasuryInboundTransferCreated => "treasury.inbound_transfer.created",
726            TreasuryInboundTransferFailed => "treasury.inbound_transfer.failed",
727            TreasuryInboundTransferSucceeded => "treasury.inbound_transfer.succeeded",
728            TreasuryOutboundPaymentCanceled => "treasury.outbound_payment.canceled",
729            TreasuryOutboundPaymentCreated => "treasury.outbound_payment.created",
730            TreasuryOutboundPaymentExpectedArrivalDateUpdated => {
731                "treasury.outbound_payment.expected_arrival_date_updated"
732            }
733            TreasuryOutboundPaymentFailed => "treasury.outbound_payment.failed",
734            TreasuryOutboundPaymentPosted => "treasury.outbound_payment.posted",
735            TreasuryOutboundPaymentReturned => "treasury.outbound_payment.returned",
736            TreasuryOutboundPaymentTrackingDetailsUpdated => {
737                "treasury.outbound_payment.tracking_details_updated"
738            }
739            TreasuryOutboundTransferCanceled => "treasury.outbound_transfer.canceled",
740            TreasuryOutboundTransferCreated => "treasury.outbound_transfer.created",
741            TreasuryOutboundTransferExpectedArrivalDateUpdated => {
742                "treasury.outbound_transfer.expected_arrival_date_updated"
743            }
744            TreasuryOutboundTransferFailed => "treasury.outbound_transfer.failed",
745            TreasuryOutboundTransferPosted => "treasury.outbound_transfer.posted",
746            TreasuryOutboundTransferReturned => "treasury.outbound_transfer.returned",
747            TreasuryOutboundTransferTrackingDetailsUpdated => {
748                "treasury.outbound_transfer.tracking_details_updated"
749            }
750            TreasuryReceivedCreditCreated => "treasury.received_credit.created",
751            TreasuryReceivedCreditFailed => "treasury.received_credit.failed",
752            TreasuryReceivedCreditSucceeded => "treasury.received_credit.succeeded",
753            TreasuryReceivedDebitCreated => "treasury.received_debit.created",
754            Unknown(v) => v,
755        }
756    }
757}
758
759impl std::str::FromStr for EventType {
760    type Err = std::convert::Infallible;
761    fn from_str(s: &str) -> Result<Self, Self::Err> {
762        use EventType::*;
763        match s {
764            "account.application.authorized" => Ok(AccountApplicationAuthorized),
765            "account.application.deauthorized" => Ok(AccountApplicationDeauthorized),
766            "account.external_account.created" => Ok(AccountExternalAccountCreated),
767            "account.external_account.deleted" => Ok(AccountExternalAccountDeleted),
768            "account.external_account.updated" => Ok(AccountExternalAccountUpdated),
769            "account.updated" => Ok(AccountUpdated),
770            "application_fee.created" => Ok(ApplicationFeeCreated),
771            "application_fee.refund.updated" => Ok(ApplicationFeeRefundUpdated),
772            "application_fee.refunded" => Ok(ApplicationFeeRefunded),
773            "balance.available" => Ok(BalanceAvailable),
774            "billing.alert.triggered" => Ok(BillingAlertTriggered),
775            "billing_portal.configuration.created" => Ok(BillingPortalConfigurationCreated),
776            "billing_portal.configuration.updated" => Ok(BillingPortalConfigurationUpdated),
777            "billing_portal.session.created" => Ok(BillingPortalSessionCreated),
778            "capability.updated" => Ok(CapabilityUpdated),
779            "cash_balance.funds_available" => Ok(CashBalanceFundsAvailable),
780            "charge.captured" => Ok(ChargeCaptured),
781            "charge.dispute.closed" => Ok(ChargeDisputeClosed),
782            "charge.dispute.created" => Ok(ChargeDisputeCreated),
783            "charge.dispute.funds_reinstated" => Ok(ChargeDisputeFundsReinstated),
784            "charge.dispute.funds_withdrawn" => Ok(ChargeDisputeFundsWithdrawn),
785            "charge.dispute.updated" => Ok(ChargeDisputeUpdated),
786            "charge.expired" => Ok(ChargeExpired),
787            "charge.failed" => Ok(ChargeFailed),
788            "charge.pending" => Ok(ChargePending),
789            "charge.refund.updated" => Ok(ChargeRefundUpdated),
790            "charge.refunded" => Ok(ChargeRefunded),
791            "charge.succeeded" => Ok(ChargeSucceeded),
792            "charge.updated" => Ok(ChargeUpdated),
793            "checkout.session.async_payment_failed" => Ok(CheckoutSessionAsyncPaymentFailed),
794            "checkout.session.async_payment_succeeded" => Ok(CheckoutSessionAsyncPaymentSucceeded),
795            "checkout.session.completed" => Ok(CheckoutSessionCompleted),
796            "checkout.session.expired" => Ok(CheckoutSessionExpired),
797            "climate.order.canceled" => Ok(ClimateOrderCanceled),
798            "climate.order.created" => Ok(ClimateOrderCreated),
799            "climate.order.delayed" => Ok(ClimateOrderDelayed),
800            "climate.order.delivered" => Ok(ClimateOrderDelivered),
801            "climate.order.product_substituted" => Ok(ClimateOrderProductSubstituted),
802            "climate.product.created" => Ok(ClimateProductCreated),
803            "climate.product.pricing_updated" => Ok(ClimateProductPricingUpdated),
804            "coupon.created" => Ok(CouponCreated),
805            "coupon.deleted" => Ok(CouponDeleted),
806            "coupon.updated" => Ok(CouponUpdated),
807            "credit_note.created" => Ok(CreditNoteCreated),
808            "credit_note.updated" => Ok(CreditNoteUpdated),
809            "credit_note.voided" => Ok(CreditNoteVoided),
810            "customer.created" => Ok(CustomerCreated),
811            "customer.deleted" => Ok(CustomerDeleted),
812            "customer.discount.created" => Ok(CustomerDiscountCreated),
813            "customer.discount.deleted" => Ok(CustomerDiscountDeleted),
814            "customer.discount.updated" => Ok(CustomerDiscountUpdated),
815            "customer.source.created" => Ok(CustomerSourceCreated),
816            "customer.source.deleted" => Ok(CustomerSourceDeleted),
817            "customer.source.expiring" => Ok(CustomerSourceExpiring),
818            "customer.source.updated" => Ok(CustomerSourceUpdated),
819            "customer.subscription.created" => Ok(CustomerSubscriptionCreated),
820            "customer.subscription.deleted" => Ok(CustomerSubscriptionDeleted),
821            "customer.subscription.paused" => Ok(CustomerSubscriptionPaused),
822            "customer.subscription.pending_update_applied" => {
823                Ok(CustomerSubscriptionPendingUpdateApplied)
824            }
825            "customer.subscription.pending_update_expired" => {
826                Ok(CustomerSubscriptionPendingUpdateExpired)
827            }
828            "customer.subscription.resumed" => Ok(CustomerSubscriptionResumed),
829            "customer.subscription.trial_will_end" => Ok(CustomerSubscriptionTrialWillEnd),
830            "customer.subscription.updated" => Ok(CustomerSubscriptionUpdated),
831            "customer.tax_id.created" => Ok(CustomerTaxIdCreated),
832            "customer.tax_id.deleted" => Ok(CustomerTaxIdDeleted),
833            "customer.tax_id.updated" => Ok(CustomerTaxIdUpdated),
834            "customer.updated" => Ok(CustomerUpdated),
835            "customer_cash_balance_transaction.created" => {
836                Ok(CustomerCashBalanceTransactionCreated)
837            }
838            "entitlements.active_entitlement_summary.updated" => {
839                Ok(EntitlementsActiveEntitlementSummaryUpdated)
840            }
841            "file.created" => Ok(FileCreated),
842            "financial_connections.account.created" => Ok(FinancialConnectionsAccountCreated),
843            "financial_connections.account.deactivated" => {
844                Ok(FinancialConnectionsAccountDeactivated)
845            }
846            "financial_connections.account.disconnected" => {
847                Ok(FinancialConnectionsAccountDisconnected)
848            }
849            "financial_connections.account.reactivated" => {
850                Ok(FinancialConnectionsAccountReactivated)
851            }
852            "financial_connections.account.refreshed_balance" => {
853                Ok(FinancialConnectionsAccountRefreshedBalance)
854            }
855            "financial_connections.account.refreshed_ownership" => {
856                Ok(FinancialConnectionsAccountRefreshedOwnership)
857            }
858            "financial_connections.account.refreshed_transactions" => {
859                Ok(FinancialConnectionsAccountRefreshedTransactions)
860            }
861            "identity.verification_session.canceled" => Ok(IdentityVerificationSessionCanceled),
862            "identity.verification_session.created" => Ok(IdentityVerificationSessionCreated),
863            "identity.verification_session.processing" => Ok(IdentityVerificationSessionProcessing),
864            "identity.verification_session.redacted" => Ok(IdentityVerificationSessionRedacted),
865            "identity.verification_session.requires_input" => {
866                Ok(IdentityVerificationSessionRequiresInput)
867            }
868            "identity.verification_session.verified" => Ok(IdentityVerificationSessionVerified),
869            "invoice.created" => Ok(InvoiceCreated),
870            "invoice.deleted" => Ok(InvoiceDeleted),
871            "invoice.finalization_failed" => Ok(InvoiceFinalizationFailed),
872            "invoice.finalized" => Ok(InvoiceFinalized),
873            "invoice.marked_uncollectible" => Ok(InvoiceMarkedUncollectible),
874            "invoice.overdue" => Ok(InvoiceOverdue),
875            "invoice.overpaid" => Ok(InvoiceOverpaid),
876            "invoice.paid" => Ok(InvoicePaid),
877            "invoice.payment_action_required" => Ok(InvoicePaymentActionRequired),
878            "invoice.payment_failed" => Ok(InvoicePaymentFailed),
879            "invoice.payment_succeeded" => Ok(InvoicePaymentSucceeded),
880            "invoice.sent" => Ok(InvoiceSent),
881            "invoice.upcoming" => Ok(InvoiceUpcoming),
882            "invoice.updated" => Ok(InvoiceUpdated),
883            "invoice.voided" => Ok(InvoiceVoided),
884            "invoice.will_be_due" => Ok(InvoiceWillBeDue),
885            "invoice_payment.paid" => Ok(InvoicePaymentPaid),
886            "invoiceitem.created" => Ok(InvoiceitemCreated),
887            "invoiceitem.deleted" => Ok(InvoiceitemDeleted),
888            "issuing_authorization.created" => Ok(IssuingAuthorizationCreated),
889            "issuing_authorization.request" => Ok(IssuingAuthorizationRequest),
890            "issuing_authorization.updated" => Ok(IssuingAuthorizationUpdated),
891            "issuing_card.created" => Ok(IssuingCardCreated),
892            "issuing_card.updated" => Ok(IssuingCardUpdated),
893            "issuing_cardholder.created" => Ok(IssuingCardholderCreated),
894            "issuing_cardholder.updated" => Ok(IssuingCardholderUpdated),
895            "issuing_dispute.closed" => Ok(IssuingDisputeClosed),
896            "issuing_dispute.created" => Ok(IssuingDisputeCreated),
897            "issuing_dispute.funds_reinstated" => Ok(IssuingDisputeFundsReinstated),
898            "issuing_dispute.funds_rescinded" => Ok(IssuingDisputeFundsRescinded),
899            "issuing_dispute.submitted" => Ok(IssuingDisputeSubmitted),
900            "issuing_dispute.updated" => Ok(IssuingDisputeUpdated),
901            "issuing_personalization_design.activated" => Ok(IssuingPersonalizationDesignActivated),
902            "issuing_personalization_design.deactivated" => {
903                Ok(IssuingPersonalizationDesignDeactivated)
904            }
905            "issuing_personalization_design.rejected" => Ok(IssuingPersonalizationDesignRejected),
906            "issuing_personalization_design.updated" => Ok(IssuingPersonalizationDesignUpdated),
907            "issuing_token.created" => Ok(IssuingTokenCreated),
908            "issuing_token.updated" => Ok(IssuingTokenUpdated),
909            "issuing_transaction.created" => Ok(IssuingTransactionCreated),
910            "issuing_transaction.purchase_details_receipt_updated" => {
911                Ok(IssuingTransactionPurchaseDetailsReceiptUpdated)
912            }
913            "issuing_transaction.updated" => Ok(IssuingTransactionUpdated),
914            "mandate.updated" => Ok(MandateUpdated),
915            "payment_intent.amount_capturable_updated" => Ok(PaymentIntentAmountCapturableUpdated),
916            "payment_intent.canceled" => Ok(PaymentIntentCanceled),
917            "payment_intent.created" => Ok(PaymentIntentCreated),
918            "payment_intent.partially_funded" => Ok(PaymentIntentPartiallyFunded),
919            "payment_intent.payment_failed" => Ok(PaymentIntentPaymentFailed),
920            "payment_intent.processing" => Ok(PaymentIntentProcessing),
921            "payment_intent.requires_action" => Ok(PaymentIntentRequiresAction),
922            "payment_intent.succeeded" => Ok(PaymentIntentSucceeded),
923            "payment_link.created" => Ok(PaymentLinkCreated),
924            "payment_link.updated" => Ok(PaymentLinkUpdated),
925            "payment_method.attached" => Ok(PaymentMethodAttached),
926            "payment_method.automatically_updated" => Ok(PaymentMethodAutomaticallyUpdated),
927            "payment_method.detached" => Ok(PaymentMethodDetached),
928            "payment_method.updated" => Ok(PaymentMethodUpdated),
929            "payout.canceled" => Ok(PayoutCanceled),
930            "payout.created" => Ok(PayoutCreated),
931            "payout.failed" => Ok(PayoutFailed),
932            "payout.paid" => Ok(PayoutPaid),
933            "payout.reconciliation_completed" => Ok(PayoutReconciliationCompleted),
934            "payout.updated" => Ok(PayoutUpdated),
935            "person.created" => Ok(PersonCreated),
936            "person.deleted" => Ok(PersonDeleted),
937            "person.updated" => Ok(PersonUpdated),
938            "plan.created" => Ok(PlanCreated),
939            "plan.deleted" => Ok(PlanDeleted),
940            "plan.updated" => Ok(PlanUpdated),
941            "price.created" => Ok(PriceCreated),
942            "price.deleted" => Ok(PriceDeleted),
943            "price.updated" => Ok(PriceUpdated),
944            "product.created" => Ok(ProductCreated),
945            "product.deleted" => Ok(ProductDeleted),
946            "product.updated" => Ok(ProductUpdated),
947            "promotion_code.created" => Ok(PromotionCodeCreated),
948            "promotion_code.updated" => Ok(PromotionCodeUpdated),
949            "quote.accepted" => Ok(QuoteAccepted),
950            "quote.canceled" => Ok(QuoteCanceled),
951            "quote.created" => Ok(QuoteCreated),
952            "quote.finalized" => Ok(QuoteFinalized),
953            "radar.early_fraud_warning.created" => Ok(RadarEarlyFraudWarningCreated),
954            "radar.early_fraud_warning.updated" => Ok(RadarEarlyFraudWarningUpdated),
955            "refund.created" => Ok(RefundCreated),
956            "refund.failed" => Ok(RefundFailed),
957            "refund.updated" => Ok(RefundUpdated),
958            "reporting.report_run.failed" => Ok(ReportingReportRunFailed),
959            "reporting.report_run.succeeded" => Ok(ReportingReportRunSucceeded),
960            "reporting.report_type.updated" => Ok(ReportingReportTypeUpdated),
961            "review.closed" => Ok(ReviewClosed),
962            "review.opened" => Ok(ReviewOpened),
963            "setup_intent.canceled" => Ok(SetupIntentCanceled),
964            "setup_intent.created" => Ok(SetupIntentCreated),
965            "setup_intent.requires_action" => Ok(SetupIntentRequiresAction),
966            "setup_intent.setup_failed" => Ok(SetupIntentSetupFailed),
967            "setup_intent.succeeded" => Ok(SetupIntentSucceeded),
968            "sigma.scheduled_query_run.created" => Ok(SigmaScheduledQueryRunCreated),
969            "source.canceled" => Ok(SourceCanceled),
970            "source.chargeable" => Ok(SourceChargeable),
971            "source.failed" => Ok(SourceFailed),
972            "source.mandate_notification" => Ok(SourceMandateNotification),
973            "source.refund_attributes_required" => Ok(SourceRefundAttributesRequired),
974            "source.transaction.created" => Ok(SourceTransactionCreated),
975            "source.transaction.updated" => Ok(SourceTransactionUpdated),
976            "subscription_schedule.aborted" => Ok(SubscriptionScheduleAborted),
977            "subscription_schedule.canceled" => Ok(SubscriptionScheduleCanceled),
978            "subscription_schedule.completed" => Ok(SubscriptionScheduleCompleted),
979            "subscription_schedule.created" => Ok(SubscriptionScheduleCreated),
980            "subscription_schedule.expiring" => Ok(SubscriptionScheduleExpiring),
981            "subscription_schedule.released" => Ok(SubscriptionScheduleReleased),
982            "subscription_schedule.updated" => Ok(SubscriptionScheduleUpdated),
983            "tax.settings.updated" => Ok(TaxSettingsUpdated),
984            "tax_rate.created" => Ok(TaxRateCreated),
985            "tax_rate.updated" => Ok(TaxRateUpdated),
986            "terminal.reader.action_failed" => Ok(TerminalReaderActionFailed),
987            "terminal.reader.action_succeeded" => Ok(TerminalReaderActionSucceeded),
988            "terminal.reader.action_updated" => Ok(TerminalReaderActionUpdated),
989            "test_helpers.test_clock.advancing" => Ok(TestHelpersTestClockAdvancing),
990            "test_helpers.test_clock.created" => Ok(TestHelpersTestClockCreated),
991            "test_helpers.test_clock.deleted" => Ok(TestHelpersTestClockDeleted),
992            "test_helpers.test_clock.internal_failure" => Ok(TestHelpersTestClockInternalFailure),
993            "test_helpers.test_clock.ready" => Ok(TestHelpersTestClockReady),
994            "topup.canceled" => Ok(TopupCanceled),
995            "topup.created" => Ok(TopupCreated),
996            "topup.failed" => Ok(TopupFailed),
997            "topup.reversed" => Ok(TopupReversed),
998            "topup.succeeded" => Ok(TopupSucceeded),
999            "transfer.created" => Ok(TransferCreated),
1000            "transfer.reversed" => Ok(TransferReversed),
1001            "transfer.updated" => Ok(TransferUpdated),
1002            "treasury.credit_reversal.created" => Ok(TreasuryCreditReversalCreated),
1003            "treasury.credit_reversal.posted" => Ok(TreasuryCreditReversalPosted),
1004            "treasury.debit_reversal.completed" => Ok(TreasuryDebitReversalCompleted),
1005            "treasury.debit_reversal.created" => Ok(TreasuryDebitReversalCreated),
1006            "treasury.debit_reversal.initial_credit_granted" => {
1007                Ok(TreasuryDebitReversalInitialCreditGranted)
1008            }
1009            "treasury.financial_account.closed" => Ok(TreasuryFinancialAccountClosed),
1010            "treasury.financial_account.created" => Ok(TreasuryFinancialAccountCreated),
1011            "treasury.financial_account.features_status_updated" => {
1012                Ok(TreasuryFinancialAccountFeaturesStatusUpdated)
1013            }
1014            "treasury.inbound_transfer.canceled" => Ok(TreasuryInboundTransferCanceled),
1015            "treasury.inbound_transfer.created" => Ok(TreasuryInboundTransferCreated),
1016            "treasury.inbound_transfer.failed" => Ok(TreasuryInboundTransferFailed),
1017            "treasury.inbound_transfer.succeeded" => Ok(TreasuryInboundTransferSucceeded),
1018            "treasury.outbound_payment.canceled" => Ok(TreasuryOutboundPaymentCanceled),
1019            "treasury.outbound_payment.created" => Ok(TreasuryOutboundPaymentCreated),
1020            "treasury.outbound_payment.expected_arrival_date_updated" => {
1021                Ok(TreasuryOutboundPaymentExpectedArrivalDateUpdated)
1022            }
1023            "treasury.outbound_payment.failed" => Ok(TreasuryOutboundPaymentFailed),
1024            "treasury.outbound_payment.posted" => Ok(TreasuryOutboundPaymentPosted),
1025            "treasury.outbound_payment.returned" => Ok(TreasuryOutboundPaymentReturned),
1026            "treasury.outbound_payment.tracking_details_updated" => {
1027                Ok(TreasuryOutboundPaymentTrackingDetailsUpdated)
1028            }
1029            "treasury.outbound_transfer.canceled" => Ok(TreasuryOutboundTransferCanceled),
1030            "treasury.outbound_transfer.created" => Ok(TreasuryOutboundTransferCreated),
1031            "treasury.outbound_transfer.expected_arrival_date_updated" => {
1032                Ok(TreasuryOutboundTransferExpectedArrivalDateUpdated)
1033            }
1034            "treasury.outbound_transfer.failed" => Ok(TreasuryOutboundTransferFailed),
1035            "treasury.outbound_transfer.posted" => Ok(TreasuryOutboundTransferPosted),
1036            "treasury.outbound_transfer.returned" => Ok(TreasuryOutboundTransferReturned),
1037            "treasury.outbound_transfer.tracking_details_updated" => {
1038                Ok(TreasuryOutboundTransferTrackingDetailsUpdated)
1039            }
1040            "treasury.received_credit.created" => Ok(TreasuryReceivedCreditCreated),
1041            "treasury.received_credit.failed" => Ok(TreasuryReceivedCreditFailed),
1042            "treasury.received_credit.succeeded" => Ok(TreasuryReceivedCreditSucceeded),
1043            "treasury.received_debit.created" => Ok(TreasuryReceivedDebitCreated),
1044            v => Ok(Unknown(v.to_owned())),
1045        }
1046    }
1047}
1048impl std::fmt::Display for EventType {
1049    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1050        f.write_str(self.as_str())
1051    }
1052}
1053
1054impl std::fmt::Debug for EventType {
1055    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1056        f.write_str(self.as_str())
1057    }
1058}
1059#[cfg(feature = "serialize")]
1060impl serde::Serialize for EventType {
1061    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1062    where
1063        S: serde::Serializer,
1064    {
1065        serializer.serialize_str(self.as_str())
1066    }
1067}
1068impl miniserde::Deserialize for EventType {
1069    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1070        crate::Place::new(out)
1071    }
1072}
1073
1074impl miniserde::de::Visitor for crate::Place<EventType> {
1075    fn string(&mut self, s: &str) -> miniserde::Result<()> {
1076        use std::str::FromStr;
1077        self.out = Some(EventType::from_str(s).unwrap());
1078        Ok(())
1079    }
1080}
1081
1082stripe_types::impl_from_val_with_from_str!(EventType);
1083#[cfg(feature = "deserialize")]
1084impl<'de> serde::Deserialize<'de> for EventType {
1085    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1086        use std::str::FromStr;
1087        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1088        Ok(Self::from_str(&s).unwrap())
1089    }
1090}
1091impl stripe_types::Object for Event {
1092    type Id = stripe_shared::EventId;
1093    fn id(&self) -> &Self::Id {
1094        &self.id
1095    }
1096
1097    fn into_id(self) -> Self::Id {
1098        self.id
1099    }
1100}
1101stripe_types::def_id!(EventId);