Skip to main content

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