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::{Deserialize, Result, make_place};
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                _ => <dyn Visitor>::ignore(),
109            })
110        }
111
112        fn deser_default() -> Self {
113            Self {
114                account: Deserialize::default(),
115                api_version: Deserialize::default(),
116                context: Deserialize::default(),
117                created: Deserialize::default(),
118                data: Deserialize::default(),
119                id: Deserialize::default(),
120                livemode: Deserialize::default(),
121                pending_webhooks: Deserialize::default(),
122                request: Deserialize::default(),
123                type_: Deserialize::default(),
124            }
125        }
126
127        fn take_out(&mut self) -> Option<Self::Out> {
128            let (
129                Some(account),
130                Some(api_version),
131                Some(context),
132                Some(created),
133                Some(data),
134                Some(id),
135                Some(livemode),
136                Some(pending_webhooks),
137                Some(request),
138                Some(type_),
139            ) = (
140                self.account.take(),
141                self.api_version.take(),
142                self.context.take(),
143                self.created,
144                self.data.take(),
145                self.id.take(),
146                self.livemode,
147                self.pending_webhooks,
148                self.request.take(),
149                self.type_.take(),
150            )
151            else {
152                return None;
153            };
154            Some(Self::Out {
155                account,
156                api_version,
157                context,
158                created,
159                data,
160                id,
161                livemode,
162                pending_webhooks,
163                request,
164                type_,
165            })
166        }
167    }
168
169    impl Map for Builder<'_> {
170        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
171            self.builder.key(k)
172        }
173
174        fn finish(&mut self) -> Result<()> {
175            *self.out = self.builder.take_out();
176            Ok(())
177        }
178    }
179
180    impl ObjectDeser for Event {
181        type Builder = EventBuilder;
182    }
183
184    impl FromValueOpt for Event {
185        fn from_value(v: Value) -> Option<Self> {
186            let Value::Object(obj) = v else {
187                return None;
188            };
189            let mut b = EventBuilder::deser_default();
190            for (k, v) in obj {
191                match k.as_str() {
192                    "account" => b.account = FromValueOpt::from_value(v),
193                    "api_version" => b.api_version = FromValueOpt::from_value(v),
194                    "context" => b.context = FromValueOpt::from_value(v),
195                    "created" => b.created = FromValueOpt::from_value(v),
196                    "data" => b.data = FromValueOpt::from_value(v),
197                    "id" => b.id = FromValueOpt::from_value(v),
198                    "livemode" => b.livemode = FromValueOpt::from_value(v),
199                    "pending_webhooks" => b.pending_webhooks = FromValueOpt::from_value(v),
200                    "request" => b.request = FromValueOpt::from_value(v),
201                    "type" => b.type_ = FromValueOpt::from_value(v),
202                    _ => {}
203                }
204            }
205            b.take_out()
206        }
207    }
208};
209#[cfg(feature = "serialize")]
210impl serde::Serialize for Event {
211    fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
212        use serde::ser::SerializeStruct;
213        let mut s = s.serialize_struct("Event", 11)?;
214        s.serialize_field("account", &self.account)?;
215        s.serialize_field("api_version", &self.api_version)?;
216        s.serialize_field("context", &self.context)?;
217        s.serialize_field("created", &self.created)?;
218        s.serialize_field("data", &self.data)?;
219        s.serialize_field("id", &self.id)?;
220        s.serialize_field("livemode", &self.livemode)?;
221        s.serialize_field("pending_webhooks", &self.pending_webhooks)?;
222        s.serialize_field("request", &self.request)?;
223        s.serialize_field("type", &self.type_)?;
224
225        s.serialize_field("object", "event")?;
226        s.end()
227    }
228}
229/// Description of the event (for example, `invoice.created` or `charge.refunded`).
230#[derive(Clone, Eq, PartialEq)]
231#[non_exhaustive]
232pub enum EventType {
233    AccountApplicationAuthorized,
234    AccountApplicationDeauthorized,
235    AccountExternalAccountCreated,
236    AccountExternalAccountDeleted,
237    AccountExternalAccountUpdated,
238    AccountUpdated,
239    ApplicationFeeCreated,
240    ApplicationFeeRefundUpdated,
241    ApplicationFeeRefunded,
242    BalanceAvailable,
243    BalanceSettingsUpdated,
244    BillingAlertTriggered,
245    BillingPortalConfigurationCreated,
246    BillingPortalConfigurationUpdated,
247    BillingPortalSessionCreated,
248    CapabilityUpdated,
249    CashBalanceFundsAvailable,
250    ChargeCaptured,
251    ChargeDisputeClosed,
252    ChargeDisputeCreated,
253    ChargeDisputeFundsReinstated,
254    ChargeDisputeFundsWithdrawn,
255    ChargeDisputeUpdated,
256    ChargeExpired,
257    ChargeFailed,
258    ChargePending,
259    ChargeRefundUpdated,
260    ChargeRefunded,
261    ChargeSucceeded,
262    ChargeUpdated,
263    CheckoutSessionAsyncPaymentFailed,
264    CheckoutSessionAsyncPaymentSucceeded,
265    CheckoutSessionCompleted,
266    CheckoutSessionExpired,
267    ClimateOrderCanceled,
268    ClimateOrderCreated,
269    ClimateOrderDelayed,
270    ClimateOrderDelivered,
271    ClimateOrderProductSubstituted,
272    ClimateProductCreated,
273    ClimateProductPricingUpdated,
274    CouponCreated,
275    CouponDeleted,
276    CouponUpdated,
277    CreditNoteCreated,
278    CreditNoteUpdated,
279    CreditNoteVoided,
280    CustomerCreated,
281    CustomerDeleted,
282    CustomerDiscountCreated,
283    CustomerDiscountDeleted,
284    CustomerDiscountUpdated,
285    CustomerSourceCreated,
286    CustomerSourceDeleted,
287    CustomerSourceExpiring,
288    CustomerSourceUpdated,
289    CustomerSubscriptionCreated,
290    CustomerSubscriptionDeleted,
291    CustomerSubscriptionPaused,
292    CustomerSubscriptionPendingUpdateApplied,
293    CustomerSubscriptionPendingUpdateExpired,
294    CustomerSubscriptionResumed,
295    CustomerSubscriptionTrialWillEnd,
296    CustomerSubscriptionUpdated,
297    CustomerTaxIdCreated,
298    CustomerTaxIdDeleted,
299    CustomerTaxIdUpdated,
300    CustomerUpdated,
301    CustomerCashBalanceTransactionCreated,
302    EntitlementsActiveEntitlementSummaryUpdated,
303    FileCreated,
304    FinancialConnectionsAccountCreated,
305    FinancialConnectionsAccountDeactivated,
306    FinancialConnectionsAccountDisconnected,
307    FinancialConnectionsAccountReactivated,
308    FinancialConnectionsAccountRefreshedBalance,
309    FinancialConnectionsAccountRefreshedOwnership,
310    FinancialConnectionsAccountRefreshedTransactions,
311    IdentityVerificationSessionCanceled,
312    IdentityVerificationSessionCreated,
313    IdentityVerificationSessionProcessing,
314    IdentityVerificationSessionRedacted,
315    IdentityVerificationSessionRequiresInput,
316    IdentityVerificationSessionVerified,
317    InvoiceCreated,
318    InvoiceDeleted,
319    InvoiceFinalizationFailed,
320    InvoiceFinalized,
321    InvoiceMarkedUncollectible,
322    InvoiceOverdue,
323    InvoiceOverpaid,
324    InvoicePaid,
325    InvoicePaymentActionRequired,
326    InvoicePaymentAttemptRequired,
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            BalanceSettingsUpdated => "balance_settings.updated",
495            BillingAlertTriggered => "billing.alert.triggered",
496            BillingPortalConfigurationCreated => "billing_portal.configuration.created",
497            BillingPortalConfigurationUpdated => "billing_portal.configuration.updated",
498            BillingPortalSessionCreated => "billing_portal.session.created",
499            CapabilityUpdated => "capability.updated",
500            CashBalanceFundsAvailable => "cash_balance.funds_available",
501            ChargeCaptured => "charge.captured",
502            ChargeDisputeClosed => "charge.dispute.closed",
503            ChargeDisputeCreated => "charge.dispute.created",
504            ChargeDisputeFundsReinstated => "charge.dispute.funds_reinstated",
505            ChargeDisputeFundsWithdrawn => "charge.dispute.funds_withdrawn",
506            ChargeDisputeUpdated => "charge.dispute.updated",
507            ChargeExpired => "charge.expired",
508            ChargeFailed => "charge.failed",
509            ChargePending => "charge.pending",
510            ChargeRefundUpdated => "charge.refund.updated",
511            ChargeRefunded => "charge.refunded",
512            ChargeSucceeded => "charge.succeeded",
513            ChargeUpdated => "charge.updated",
514            CheckoutSessionAsyncPaymentFailed => "checkout.session.async_payment_failed",
515            CheckoutSessionAsyncPaymentSucceeded => "checkout.session.async_payment_succeeded",
516            CheckoutSessionCompleted => "checkout.session.completed",
517            CheckoutSessionExpired => "checkout.session.expired",
518            ClimateOrderCanceled => "climate.order.canceled",
519            ClimateOrderCreated => "climate.order.created",
520            ClimateOrderDelayed => "climate.order.delayed",
521            ClimateOrderDelivered => "climate.order.delivered",
522            ClimateOrderProductSubstituted => "climate.order.product_substituted",
523            ClimateProductCreated => "climate.product.created",
524            ClimateProductPricingUpdated => "climate.product.pricing_updated",
525            CouponCreated => "coupon.created",
526            CouponDeleted => "coupon.deleted",
527            CouponUpdated => "coupon.updated",
528            CreditNoteCreated => "credit_note.created",
529            CreditNoteUpdated => "credit_note.updated",
530            CreditNoteVoided => "credit_note.voided",
531            CustomerCreated => "customer.created",
532            CustomerDeleted => "customer.deleted",
533            CustomerDiscountCreated => "customer.discount.created",
534            CustomerDiscountDeleted => "customer.discount.deleted",
535            CustomerDiscountUpdated => "customer.discount.updated",
536            CustomerSourceCreated => "customer.source.created",
537            CustomerSourceDeleted => "customer.source.deleted",
538            CustomerSourceExpiring => "customer.source.expiring",
539            CustomerSourceUpdated => "customer.source.updated",
540            CustomerSubscriptionCreated => "customer.subscription.created",
541            CustomerSubscriptionDeleted => "customer.subscription.deleted",
542            CustomerSubscriptionPaused => "customer.subscription.paused",
543            CustomerSubscriptionPendingUpdateApplied => {
544                "customer.subscription.pending_update_applied"
545            }
546            CustomerSubscriptionPendingUpdateExpired => {
547                "customer.subscription.pending_update_expired"
548            }
549            CustomerSubscriptionResumed => "customer.subscription.resumed",
550            CustomerSubscriptionTrialWillEnd => "customer.subscription.trial_will_end",
551            CustomerSubscriptionUpdated => "customer.subscription.updated",
552            CustomerTaxIdCreated => "customer.tax_id.created",
553            CustomerTaxIdDeleted => "customer.tax_id.deleted",
554            CustomerTaxIdUpdated => "customer.tax_id.updated",
555            CustomerUpdated => "customer.updated",
556            CustomerCashBalanceTransactionCreated => "customer_cash_balance_transaction.created",
557            EntitlementsActiveEntitlementSummaryUpdated => {
558                "entitlements.active_entitlement_summary.updated"
559            }
560            FileCreated => "file.created",
561            FinancialConnectionsAccountCreated => "financial_connections.account.created",
562            FinancialConnectionsAccountDeactivated => "financial_connections.account.deactivated",
563            FinancialConnectionsAccountDisconnected => "financial_connections.account.disconnected",
564            FinancialConnectionsAccountReactivated => "financial_connections.account.reactivated",
565            FinancialConnectionsAccountRefreshedBalance => {
566                "financial_connections.account.refreshed_balance"
567            }
568            FinancialConnectionsAccountRefreshedOwnership => {
569                "financial_connections.account.refreshed_ownership"
570            }
571            FinancialConnectionsAccountRefreshedTransactions => {
572                "financial_connections.account.refreshed_transactions"
573            }
574            IdentityVerificationSessionCanceled => "identity.verification_session.canceled",
575            IdentityVerificationSessionCreated => "identity.verification_session.created",
576            IdentityVerificationSessionProcessing => "identity.verification_session.processing",
577            IdentityVerificationSessionRedacted => "identity.verification_session.redacted",
578            IdentityVerificationSessionRequiresInput => {
579                "identity.verification_session.requires_input"
580            }
581            IdentityVerificationSessionVerified => "identity.verification_session.verified",
582            InvoiceCreated => "invoice.created",
583            InvoiceDeleted => "invoice.deleted",
584            InvoiceFinalizationFailed => "invoice.finalization_failed",
585            InvoiceFinalized => "invoice.finalized",
586            InvoiceMarkedUncollectible => "invoice.marked_uncollectible",
587            InvoiceOverdue => "invoice.overdue",
588            InvoiceOverpaid => "invoice.overpaid",
589            InvoicePaid => "invoice.paid",
590            InvoicePaymentActionRequired => "invoice.payment_action_required",
591            InvoicePaymentAttemptRequired => "invoice.payment_attempt_required",
592            InvoicePaymentFailed => "invoice.payment_failed",
593            InvoicePaymentSucceeded => "invoice.payment_succeeded",
594            InvoiceSent => "invoice.sent",
595            InvoiceUpcoming => "invoice.upcoming",
596            InvoiceUpdated => "invoice.updated",
597            InvoiceVoided => "invoice.voided",
598            InvoiceWillBeDue => "invoice.will_be_due",
599            InvoicePaymentPaid => "invoice_payment.paid",
600            InvoiceitemCreated => "invoiceitem.created",
601            InvoiceitemDeleted => "invoiceitem.deleted",
602            IssuingAuthorizationCreated => "issuing_authorization.created",
603            IssuingAuthorizationRequest => "issuing_authorization.request",
604            IssuingAuthorizationUpdated => "issuing_authorization.updated",
605            IssuingCardCreated => "issuing_card.created",
606            IssuingCardUpdated => "issuing_card.updated",
607            IssuingCardholderCreated => "issuing_cardholder.created",
608            IssuingCardholderUpdated => "issuing_cardholder.updated",
609            IssuingDisputeClosed => "issuing_dispute.closed",
610            IssuingDisputeCreated => "issuing_dispute.created",
611            IssuingDisputeFundsReinstated => "issuing_dispute.funds_reinstated",
612            IssuingDisputeFundsRescinded => "issuing_dispute.funds_rescinded",
613            IssuingDisputeSubmitted => "issuing_dispute.submitted",
614            IssuingDisputeUpdated => "issuing_dispute.updated",
615            IssuingPersonalizationDesignActivated => "issuing_personalization_design.activated",
616            IssuingPersonalizationDesignDeactivated => "issuing_personalization_design.deactivated",
617            IssuingPersonalizationDesignRejected => "issuing_personalization_design.rejected",
618            IssuingPersonalizationDesignUpdated => "issuing_personalization_design.updated",
619            IssuingTokenCreated => "issuing_token.created",
620            IssuingTokenUpdated => "issuing_token.updated",
621            IssuingTransactionCreated => "issuing_transaction.created",
622            IssuingTransactionPurchaseDetailsReceiptUpdated => {
623                "issuing_transaction.purchase_details_receipt_updated"
624            }
625            IssuingTransactionUpdated => "issuing_transaction.updated",
626            MandateUpdated => "mandate.updated",
627            PaymentIntentAmountCapturableUpdated => "payment_intent.amount_capturable_updated",
628            PaymentIntentCanceled => "payment_intent.canceled",
629            PaymentIntentCreated => "payment_intent.created",
630            PaymentIntentPartiallyFunded => "payment_intent.partially_funded",
631            PaymentIntentPaymentFailed => "payment_intent.payment_failed",
632            PaymentIntentProcessing => "payment_intent.processing",
633            PaymentIntentRequiresAction => "payment_intent.requires_action",
634            PaymentIntentSucceeded => "payment_intent.succeeded",
635            PaymentLinkCreated => "payment_link.created",
636            PaymentLinkUpdated => "payment_link.updated",
637            PaymentMethodAttached => "payment_method.attached",
638            PaymentMethodAutomaticallyUpdated => "payment_method.automatically_updated",
639            PaymentMethodDetached => "payment_method.detached",
640            PaymentMethodUpdated => "payment_method.updated",
641            PayoutCanceled => "payout.canceled",
642            PayoutCreated => "payout.created",
643            PayoutFailed => "payout.failed",
644            PayoutPaid => "payout.paid",
645            PayoutReconciliationCompleted => "payout.reconciliation_completed",
646            PayoutUpdated => "payout.updated",
647            PersonCreated => "person.created",
648            PersonDeleted => "person.deleted",
649            PersonUpdated => "person.updated",
650            PlanCreated => "plan.created",
651            PlanDeleted => "plan.deleted",
652            PlanUpdated => "plan.updated",
653            PriceCreated => "price.created",
654            PriceDeleted => "price.deleted",
655            PriceUpdated => "price.updated",
656            ProductCreated => "product.created",
657            ProductDeleted => "product.deleted",
658            ProductUpdated => "product.updated",
659            PromotionCodeCreated => "promotion_code.created",
660            PromotionCodeUpdated => "promotion_code.updated",
661            QuoteAccepted => "quote.accepted",
662            QuoteCanceled => "quote.canceled",
663            QuoteCreated => "quote.created",
664            QuoteFinalized => "quote.finalized",
665            RadarEarlyFraudWarningCreated => "radar.early_fraud_warning.created",
666            RadarEarlyFraudWarningUpdated => "radar.early_fraud_warning.updated",
667            RefundCreated => "refund.created",
668            RefundFailed => "refund.failed",
669            RefundUpdated => "refund.updated",
670            ReportingReportRunFailed => "reporting.report_run.failed",
671            ReportingReportRunSucceeded => "reporting.report_run.succeeded",
672            ReportingReportTypeUpdated => "reporting.report_type.updated",
673            ReviewClosed => "review.closed",
674            ReviewOpened => "review.opened",
675            SetupIntentCanceled => "setup_intent.canceled",
676            SetupIntentCreated => "setup_intent.created",
677            SetupIntentRequiresAction => "setup_intent.requires_action",
678            SetupIntentSetupFailed => "setup_intent.setup_failed",
679            SetupIntentSucceeded => "setup_intent.succeeded",
680            SigmaScheduledQueryRunCreated => "sigma.scheduled_query_run.created",
681            SourceCanceled => "source.canceled",
682            SourceChargeable => "source.chargeable",
683            SourceFailed => "source.failed",
684            SourceMandateNotification => "source.mandate_notification",
685            SourceRefundAttributesRequired => "source.refund_attributes_required",
686            SourceTransactionCreated => "source.transaction.created",
687            SourceTransactionUpdated => "source.transaction.updated",
688            SubscriptionScheduleAborted => "subscription_schedule.aborted",
689            SubscriptionScheduleCanceled => "subscription_schedule.canceled",
690            SubscriptionScheduleCompleted => "subscription_schedule.completed",
691            SubscriptionScheduleCreated => "subscription_schedule.created",
692            SubscriptionScheduleExpiring => "subscription_schedule.expiring",
693            SubscriptionScheduleReleased => "subscription_schedule.released",
694            SubscriptionScheduleUpdated => "subscription_schedule.updated",
695            TaxSettingsUpdated => "tax.settings.updated",
696            TaxRateCreated => "tax_rate.created",
697            TaxRateUpdated => "tax_rate.updated",
698            TerminalReaderActionFailed => "terminal.reader.action_failed",
699            TerminalReaderActionSucceeded => "terminal.reader.action_succeeded",
700            TerminalReaderActionUpdated => "terminal.reader.action_updated",
701            TestHelpersTestClockAdvancing => "test_helpers.test_clock.advancing",
702            TestHelpersTestClockCreated => "test_helpers.test_clock.created",
703            TestHelpersTestClockDeleted => "test_helpers.test_clock.deleted",
704            TestHelpersTestClockInternalFailure => "test_helpers.test_clock.internal_failure",
705            TestHelpersTestClockReady => "test_helpers.test_clock.ready",
706            TopupCanceled => "topup.canceled",
707            TopupCreated => "topup.created",
708            TopupFailed => "topup.failed",
709            TopupReversed => "topup.reversed",
710            TopupSucceeded => "topup.succeeded",
711            TransferCreated => "transfer.created",
712            TransferReversed => "transfer.reversed",
713            TransferUpdated => "transfer.updated",
714            TreasuryCreditReversalCreated => "treasury.credit_reversal.created",
715            TreasuryCreditReversalPosted => "treasury.credit_reversal.posted",
716            TreasuryDebitReversalCompleted => "treasury.debit_reversal.completed",
717            TreasuryDebitReversalCreated => "treasury.debit_reversal.created",
718            TreasuryDebitReversalInitialCreditGranted => {
719                "treasury.debit_reversal.initial_credit_granted"
720            }
721            TreasuryFinancialAccountClosed => "treasury.financial_account.closed",
722            TreasuryFinancialAccountCreated => "treasury.financial_account.created",
723            TreasuryFinancialAccountFeaturesStatusUpdated => {
724                "treasury.financial_account.features_status_updated"
725            }
726            TreasuryInboundTransferCanceled => "treasury.inbound_transfer.canceled",
727            TreasuryInboundTransferCreated => "treasury.inbound_transfer.created",
728            TreasuryInboundTransferFailed => "treasury.inbound_transfer.failed",
729            TreasuryInboundTransferSucceeded => "treasury.inbound_transfer.succeeded",
730            TreasuryOutboundPaymentCanceled => "treasury.outbound_payment.canceled",
731            TreasuryOutboundPaymentCreated => "treasury.outbound_payment.created",
732            TreasuryOutboundPaymentExpectedArrivalDateUpdated => {
733                "treasury.outbound_payment.expected_arrival_date_updated"
734            }
735            TreasuryOutboundPaymentFailed => "treasury.outbound_payment.failed",
736            TreasuryOutboundPaymentPosted => "treasury.outbound_payment.posted",
737            TreasuryOutboundPaymentReturned => "treasury.outbound_payment.returned",
738            TreasuryOutboundPaymentTrackingDetailsUpdated => {
739                "treasury.outbound_payment.tracking_details_updated"
740            }
741            TreasuryOutboundTransferCanceled => "treasury.outbound_transfer.canceled",
742            TreasuryOutboundTransferCreated => "treasury.outbound_transfer.created",
743            TreasuryOutboundTransferExpectedArrivalDateUpdated => {
744                "treasury.outbound_transfer.expected_arrival_date_updated"
745            }
746            TreasuryOutboundTransferFailed => "treasury.outbound_transfer.failed",
747            TreasuryOutboundTransferPosted => "treasury.outbound_transfer.posted",
748            TreasuryOutboundTransferReturned => "treasury.outbound_transfer.returned",
749            TreasuryOutboundTransferTrackingDetailsUpdated => {
750                "treasury.outbound_transfer.tracking_details_updated"
751            }
752            TreasuryReceivedCreditCreated => "treasury.received_credit.created",
753            TreasuryReceivedCreditFailed => "treasury.received_credit.failed",
754            TreasuryReceivedCreditSucceeded => "treasury.received_credit.succeeded",
755            TreasuryReceivedDebitCreated => "treasury.received_debit.created",
756            Unknown(v) => v,
757        }
758    }
759}
760
761impl std::str::FromStr for EventType {
762    type Err = std::convert::Infallible;
763    fn from_str(s: &str) -> Result<Self, Self::Err> {
764        use EventType::*;
765        match s {
766            "account.application.authorized" => Ok(AccountApplicationAuthorized),
767            "account.application.deauthorized" => Ok(AccountApplicationDeauthorized),
768            "account.external_account.created" => Ok(AccountExternalAccountCreated),
769            "account.external_account.deleted" => Ok(AccountExternalAccountDeleted),
770            "account.external_account.updated" => Ok(AccountExternalAccountUpdated),
771            "account.updated" => Ok(AccountUpdated),
772            "application_fee.created" => Ok(ApplicationFeeCreated),
773            "application_fee.refund.updated" => Ok(ApplicationFeeRefundUpdated),
774            "application_fee.refunded" => Ok(ApplicationFeeRefunded),
775            "balance.available" => Ok(BalanceAvailable),
776            "balance_settings.updated" => Ok(BalanceSettingsUpdated),
777            "billing.alert.triggered" => Ok(BillingAlertTriggered),
778            "billing_portal.configuration.created" => Ok(BillingPortalConfigurationCreated),
779            "billing_portal.configuration.updated" => Ok(BillingPortalConfigurationUpdated),
780            "billing_portal.session.created" => Ok(BillingPortalSessionCreated),
781            "capability.updated" => Ok(CapabilityUpdated),
782            "cash_balance.funds_available" => Ok(CashBalanceFundsAvailable),
783            "charge.captured" => Ok(ChargeCaptured),
784            "charge.dispute.closed" => Ok(ChargeDisputeClosed),
785            "charge.dispute.created" => Ok(ChargeDisputeCreated),
786            "charge.dispute.funds_reinstated" => Ok(ChargeDisputeFundsReinstated),
787            "charge.dispute.funds_withdrawn" => Ok(ChargeDisputeFundsWithdrawn),
788            "charge.dispute.updated" => Ok(ChargeDisputeUpdated),
789            "charge.expired" => Ok(ChargeExpired),
790            "charge.failed" => Ok(ChargeFailed),
791            "charge.pending" => Ok(ChargePending),
792            "charge.refund.updated" => Ok(ChargeRefundUpdated),
793            "charge.refunded" => Ok(ChargeRefunded),
794            "charge.succeeded" => Ok(ChargeSucceeded),
795            "charge.updated" => Ok(ChargeUpdated),
796            "checkout.session.async_payment_failed" => Ok(CheckoutSessionAsyncPaymentFailed),
797            "checkout.session.async_payment_succeeded" => Ok(CheckoutSessionAsyncPaymentSucceeded),
798            "checkout.session.completed" => Ok(CheckoutSessionCompleted),
799            "checkout.session.expired" => Ok(CheckoutSessionExpired),
800            "climate.order.canceled" => Ok(ClimateOrderCanceled),
801            "climate.order.created" => Ok(ClimateOrderCreated),
802            "climate.order.delayed" => Ok(ClimateOrderDelayed),
803            "climate.order.delivered" => Ok(ClimateOrderDelivered),
804            "climate.order.product_substituted" => Ok(ClimateOrderProductSubstituted),
805            "climate.product.created" => Ok(ClimateProductCreated),
806            "climate.product.pricing_updated" => Ok(ClimateProductPricingUpdated),
807            "coupon.created" => Ok(CouponCreated),
808            "coupon.deleted" => Ok(CouponDeleted),
809            "coupon.updated" => Ok(CouponUpdated),
810            "credit_note.created" => Ok(CreditNoteCreated),
811            "credit_note.updated" => Ok(CreditNoteUpdated),
812            "credit_note.voided" => Ok(CreditNoteVoided),
813            "customer.created" => Ok(CustomerCreated),
814            "customer.deleted" => Ok(CustomerDeleted),
815            "customer.discount.created" => Ok(CustomerDiscountCreated),
816            "customer.discount.deleted" => Ok(CustomerDiscountDeleted),
817            "customer.discount.updated" => Ok(CustomerDiscountUpdated),
818            "customer.source.created" => Ok(CustomerSourceCreated),
819            "customer.source.deleted" => Ok(CustomerSourceDeleted),
820            "customer.source.expiring" => Ok(CustomerSourceExpiring),
821            "customer.source.updated" => Ok(CustomerSourceUpdated),
822            "customer.subscription.created" => Ok(CustomerSubscriptionCreated),
823            "customer.subscription.deleted" => Ok(CustomerSubscriptionDeleted),
824            "customer.subscription.paused" => Ok(CustomerSubscriptionPaused),
825            "customer.subscription.pending_update_applied" => {
826                Ok(CustomerSubscriptionPendingUpdateApplied)
827            }
828            "customer.subscription.pending_update_expired" => {
829                Ok(CustomerSubscriptionPendingUpdateExpired)
830            }
831            "customer.subscription.resumed" => Ok(CustomerSubscriptionResumed),
832            "customer.subscription.trial_will_end" => Ok(CustomerSubscriptionTrialWillEnd),
833            "customer.subscription.updated" => Ok(CustomerSubscriptionUpdated),
834            "customer.tax_id.created" => Ok(CustomerTaxIdCreated),
835            "customer.tax_id.deleted" => Ok(CustomerTaxIdDeleted),
836            "customer.tax_id.updated" => Ok(CustomerTaxIdUpdated),
837            "customer.updated" => Ok(CustomerUpdated),
838            "customer_cash_balance_transaction.created" => {
839                Ok(CustomerCashBalanceTransactionCreated)
840            }
841            "entitlements.active_entitlement_summary.updated" => {
842                Ok(EntitlementsActiveEntitlementSummaryUpdated)
843            }
844            "file.created" => Ok(FileCreated),
845            "financial_connections.account.created" => Ok(FinancialConnectionsAccountCreated),
846            "financial_connections.account.deactivated" => {
847                Ok(FinancialConnectionsAccountDeactivated)
848            }
849            "financial_connections.account.disconnected" => {
850                Ok(FinancialConnectionsAccountDisconnected)
851            }
852            "financial_connections.account.reactivated" => {
853                Ok(FinancialConnectionsAccountReactivated)
854            }
855            "financial_connections.account.refreshed_balance" => {
856                Ok(FinancialConnectionsAccountRefreshedBalance)
857            }
858            "financial_connections.account.refreshed_ownership" => {
859                Ok(FinancialConnectionsAccountRefreshedOwnership)
860            }
861            "financial_connections.account.refreshed_transactions" => {
862                Ok(FinancialConnectionsAccountRefreshedTransactions)
863            }
864            "identity.verification_session.canceled" => Ok(IdentityVerificationSessionCanceled),
865            "identity.verification_session.created" => Ok(IdentityVerificationSessionCreated),
866            "identity.verification_session.processing" => Ok(IdentityVerificationSessionProcessing),
867            "identity.verification_session.redacted" => Ok(IdentityVerificationSessionRedacted),
868            "identity.verification_session.requires_input" => {
869                Ok(IdentityVerificationSessionRequiresInput)
870            }
871            "identity.verification_session.verified" => Ok(IdentityVerificationSessionVerified),
872            "invoice.created" => Ok(InvoiceCreated),
873            "invoice.deleted" => Ok(InvoiceDeleted),
874            "invoice.finalization_failed" => Ok(InvoiceFinalizationFailed),
875            "invoice.finalized" => Ok(InvoiceFinalized),
876            "invoice.marked_uncollectible" => Ok(InvoiceMarkedUncollectible),
877            "invoice.overdue" => Ok(InvoiceOverdue),
878            "invoice.overpaid" => Ok(InvoiceOverpaid),
879            "invoice.paid" => Ok(InvoicePaid),
880            "invoice.payment_action_required" => Ok(InvoicePaymentActionRequired),
881            "invoice.payment_attempt_required" => Ok(InvoicePaymentAttemptRequired),
882            "invoice.payment_failed" => Ok(InvoicePaymentFailed),
883            "invoice.payment_succeeded" => Ok(InvoicePaymentSucceeded),
884            "invoice.sent" => Ok(InvoiceSent),
885            "invoice.upcoming" => Ok(InvoiceUpcoming),
886            "invoice.updated" => Ok(InvoiceUpdated),
887            "invoice.voided" => Ok(InvoiceVoided),
888            "invoice.will_be_due" => Ok(InvoiceWillBeDue),
889            "invoice_payment.paid" => Ok(InvoicePaymentPaid),
890            "invoiceitem.created" => Ok(InvoiceitemCreated),
891            "invoiceitem.deleted" => Ok(InvoiceitemDeleted),
892            "issuing_authorization.created" => Ok(IssuingAuthorizationCreated),
893            "issuing_authorization.request" => Ok(IssuingAuthorizationRequest),
894            "issuing_authorization.updated" => Ok(IssuingAuthorizationUpdated),
895            "issuing_card.created" => Ok(IssuingCardCreated),
896            "issuing_card.updated" => Ok(IssuingCardUpdated),
897            "issuing_cardholder.created" => Ok(IssuingCardholderCreated),
898            "issuing_cardholder.updated" => Ok(IssuingCardholderUpdated),
899            "issuing_dispute.closed" => Ok(IssuingDisputeClosed),
900            "issuing_dispute.created" => Ok(IssuingDisputeCreated),
901            "issuing_dispute.funds_reinstated" => Ok(IssuingDisputeFundsReinstated),
902            "issuing_dispute.funds_rescinded" => Ok(IssuingDisputeFundsRescinded),
903            "issuing_dispute.submitted" => Ok(IssuingDisputeSubmitted),
904            "issuing_dispute.updated" => Ok(IssuingDisputeUpdated),
905            "issuing_personalization_design.activated" => Ok(IssuingPersonalizationDesignActivated),
906            "issuing_personalization_design.deactivated" => {
907                Ok(IssuingPersonalizationDesignDeactivated)
908            }
909            "issuing_personalization_design.rejected" => Ok(IssuingPersonalizationDesignRejected),
910            "issuing_personalization_design.updated" => Ok(IssuingPersonalizationDesignUpdated),
911            "issuing_token.created" => Ok(IssuingTokenCreated),
912            "issuing_token.updated" => Ok(IssuingTokenUpdated),
913            "issuing_transaction.created" => Ok(IssuingTransactionCreated),
914            "issuing_transaction.purchase_details_receipt_updated" => {
915                Ok(IssuingTransactionPurchaseDetailsReceiptUpdated)
916            }
917            "issuing_transaction.updated" => Ok(IssuingTransactionUpdated),
918            "mandate.updated" => Ok(MandateUpdated),
919            "payment_intent.amount_capturable_updated" => Ok(PaymentIntentAmountCapturableUpdated),
920            "payment_intent.canceled" => Ok(PaymentIntentCanceled),
921            "payment_intent.created" => Ok(PaymentIntentCreated),
922            "payment_intent.partially_funded" => Ok(PaymentIntentPartiallyFunded),
923            "payment_intent.payment_failed" => Ok(PaymentIntentPaymentFailed),
924            "payment_intent.processing" => Ok(PaymentIntentProcessing),
925            "payment_intent.requires_action" => Ok(PaymentIntentRequiresAction),
926            "payment_intent.succeeded" => Ok(PaymentIntentSucceeded),
927            "payment_link.created" => Ok(PaymentLinkCreated),
928            "payment_link.updated" => Ok(PaymentLinkUpdated),
929            "payment_method.attached" => Ok(PaymentMethodAttached),
930            "payment_method.automatically_updated" => Ok(PaymentMethodAutomaticallyUpdated),
931            "payment_method.detached" => Ok(PaymentMethodDetached),
932            "payment_method.updated" => Ok(PaymentMethodUpdated),
933            "payout.canceled" => Ok(PayoutCanceled),
934            "payout.created" => Ok(PayoutCreated),
935            "payout.failed" => Ok(PayoutFailed),
936            "payout.paid" => Ok(PayoutPaid),
937            "payout.reconciliation_completed" => Ok(PayoutReconciliationCompleted),
938            "payout.updated" => Ok(PayoutUpdated),
939            "person.created" => Ok(PersonCreated),
940            "person.deleted" => Ok(PersonDeleted),
941            "person.updated" => Ok(PersonUpdated),
942            "plan.created" => Ok(PlanCreated),
943            "plan.deleted" => Ok(PlanDeleted),
944            "plan.updated" => Ok(PlanUpdated),
945            "price.created" => Ok(PriceCreated),
946            "price.deleted" => Ok(PriceDeleted),
947            "price.updated" => Ok(PriceUpdated),
948            "product.created" => Ok(ProductCreated),
949            "product.deleted" => Ok(ProductDeleted),
950            "product.updated" => Ok(ProductUpdated),
951            "promotion_code.created" => Ok(PromotionCodeCreated),
952            "promotion_code.updated" => Ok(PromotionCodeUpdated),
953            "quote.accepted" => Ok(QuoteAccepted),
954            "quote.canceled" => Ok(QuoteCanceled),
955            "quote.created" => Ok(QuoteCreated),
956            "quote.finalized" => Ok(QuoteFinalized),
957            "radar.early_fraud_warning.created" => Ok(RadarEarlyFraudWarningCreated),
958            "radar.early_fraud_warning.updated" => Ok(RadarEarlyFraudWarningUpdated),
959            "refund.created" => Ok(RefundCreated),
960            "refund.failed" => Ok(RefundFailed),
961            "refund.updated" => Ok(RefundUpdated),
962            "reporting.report_run.failed" => Ok(ReportingReportRunFailed),
963            "reporting.report_run.succeeded" => Ok(ReportingReportRunSucceeded),
964            "reporting.report_type.updated" => Ok(ReportingReportTypeUpdated),
965            "review.closed" => Ok(ReviewClosed),
966            "review.opened" => Ok(ReviewOpened),
967            "setup_intent.canceled" => Ok(SetupIntentCanceled),
968            "setup_intent.created" => Ok(SetupIntentCreated),
969            "setup_intent.requires_action" => Ok(SetupIntentRequiresAction),
970            "setup_intent.setup_failed" => Ok(SetupIntentSetupFailed),
971            "setup_intent.succeeded" => Ok(SetupIntentSucceeded),
972            "sigma.scheduled_query_run.created" => Ok(SigmaScheduledQueryRunCreated),
973            "source.canceled" => Ok(SourceCanceled),
974            "source.chargeable" => Ok(SourceChargeable),
975            "source.failed" => Ok(SourceFailed),
976            "source.mandate_notification" => Ok(SourceMandateNotification),
977            "source.refund_attributes_required" => Ok(SourceRefundAttributesRequired),
978            "source.transaction.created" => Ok(SourceTransactionCreated),
979            "source.transaction.updated" => Ok(SourceTransactionUpdated),
980            "subscription_schedule.aborted" => Ok(SubscriptionScheduleAborted),
981            "subscription_schedule.canceled" => Ok(SubscriptionScheduleCanceled),
982            "subscription_schedule.completed" => Ok(SubscriptionScheduleCompleted),
983            "subscription_schedule.created" => Ok(SubscriptionScheduleCreated),
984            "subscription_schedule.expiring" => Ok(SubscriptionScheduleExpiring),
985            "subscription_schedule.released" => Ok(SubscriptionScheduleReleased),
986            "subscription_schedule.updated" => Ok(SubscriptionScheduleUpdated),
987            "tax.settings.updated" => Ok(TaxSettingsUpdated),
988            "tax_rate.created" => Ok(TaxRateCreated),
989            "tax_rate.updated" => Ok(TaxRateUpdated),
990            "terminal.reader.action_failed" => Ok(TerminalReaderActionFailed),
991            "terminal.reader.action_succeeded" => Ok(TerminalReaderActionSucceeded),
992            "terminal.reader.action_updated" => Ok(TerminalReaderActionUpdated),
993            "test_helpers.test_clock.advancing" => Ok(TestHelpersTestClockAdvancing),
994            "test_helpers.test_clock.created" => Ok(TestHelpersTestClockCreated),
995            "test_helpers.test_clock.deleted" => Ok(TestHelpersTestClockDeleted),
996            "test_helpers.test_clock.internal_failure" => Ok(TestHelpersTestClockInternalFailure),
997            "test_helpers.test_clock.ready" => Ok(TestHelpersTestClockReady),
998            "topup.canceled" => Ok(TopupCanceled),
999            "topup.created" => Ok(TopupCreated),
1000            "topup.failed" => Ok(TopupFailed),
1001            "topup.reversed" => Ok(TopupReversed),
1002            "topup.succeeded" => Ok(TopupSucceeded),
1003            "transfer.created" => Ok(TransferCreated),
1004            "transfer.reversed" => Ok(TransferReversed),
1005            "transfer.updated" => Ok(TransferUpdated),
1006            "treasury.credit_reversal.created" => Ok(TreasuryCreditReversalCreated),
1007            "treasury.credit_reversal.posted" => Ok(TreasuryCreditReversalPosted),
1008            "treasury.debit_reversal.completed" => Ok(TreasuryDebitReversalCompleted),
1009            "treasury.debit_reversal.created" => Ok(TreasuryDebitReversalCreated),
1010            "treasury.debit_reversal.initial_credit_granted" => {
1011                Ok(TreasuryDebitReversalInitialCreditGranted)
1012            }
1013            "treasury.financial_account.closed" => Ok(TreasuryFinancialAccountClosed),
1014            "treasury.financial_account.created" => Ok(TreasuryFinancialAccountCreated),
1015            "treasury.financial_account.features_status_updated" => {
1016                Ok(TreasuryFinancialAccountFeaturesStatusUpdated)
1017            }
1018            "treasury.inbound_transfer.canceled" => Ok(TreasuryInboundTransferCanceled),
1019            "treasury.inbound_transfer.created" => Ok(TreasuryInboundTransferCreated),
1020            "treasury.inbound_transfer.failed" => Ok(TreasuryInboundTransferFailed),
1021            "treasury.inbound_transfer.succeeded" => Ok(TreasuryInboundTransferSucceeded),
1022            "treasury.outbound_payment.canceled" => Ok(TreasuryOutboundPaymentCanceled),
1023            "treasury.outbound_payment.created" => Ok(TreasuryOutboundPaymentCreated),
1024            "treasury.outbound_payment.expected_arrival_date_updated" => {
1025                Ok(TreasuryOutboundPaymentExpectedArrivalDateUpdated)
1026            }
1027            "treasury.outbound_payment.failed" => Ok(TreasuryOutboundPaymentFailed),
1028            "treasury.outbound_payment.posted" => Ok(TreasuryOutboundPaymentPosted),
1029            "treasury.outbound_payment.returned" => Ok(TreasuryOutboundPaymentReturned),
1030            "treasury.outbound_payment.tracking_details_updated" => {
1031                Ok(TreasuryOutboundPaymentTrackingDetailsUpdated)
1032            }
1033            "treasury.outbound_transfer.canceled" => Ok(TreasuryOutboundTransferCanceled),
1034            "treasury.outbound_transfer.created" => Ok(TreasuryOutboundTransferCreated),
1035            "treasury.outbound_transfer.expected_arrival_date_updated" => {
1036                Ok(TreasuryOutboundTransferExpectedArrivalDateUpdated)
1037            }
1038            "treasury.outbound_transfer.failed" => Ok(TreasuryOutboundTransferFailed),
1039            "treasury.outbound_transfer.posted" => Ok(TreasuryOutboundTransferPosted),
1040            "treasury.outbound_transfer.returned" => Ok(TreasuryOutboundTransferReturned),
1041            "treasury.outbound_transfer.tracking_details_updated" => {
1042                Ok(TreasuryOutboundTransferTrackingDetailsUpdated)
1043            }
1044            "treasury.received_credit.created" => Ok(TreasuryReceivedCreditCreated),
1045            "treasury.received_credit.failed" => Ok(TreasuryReceivedCreditFailed),
1046            "treasury.received_credit.succeeded" => Ok(TreasuryReceivedCreditSucceeded),
1047            "treasury.received_debit.created" => Ok(TreasuryReceivedDebitCreated),
1048            v => Ok(Unknown(v.to_owned())),
1049        }
1050    }
1051}
1052impl std::fmt::Display for EventType {
1053    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1054        f.write_str(self.as_str())
1055    }
1056}
1057
1058impl std::fmt::Debug for EventType {
1059    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1060        f.write_str(self.as_str())
1061    }
1062}
1063#[cfg(feature = "serialize")]
1064impl serde::Serialize for EventType {
1065    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1066    where
1067        S: serde::Serializer,
1068    {
1069        serializer.serialize_str(self.as_str())
1070    }
1071}
1072impl miniserde::Deserialize for EventType {
1073    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1074        crate::Place::new(out)
1075    }
1076}
1077
1078impl miniserde::de::Visitor for crate::Place<EventType> {
1079    fn string(&mut self, s: &str) -> miniserde::Result<()> {
1080        use std::str::FromStr;
1081        self.out = Some(EventType::from_str(s).unwrap());
1082        Ok(())
1083    }
1084}
1085
1086stripe_types::impl_from_val_with_from_str!(EventType);
1087#[cfg(feature = "deserialize")]
1088impl<'de> serde::Deserialize<'de> for EventType {
1089    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1090        use std::str::FromStr;
1091        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1092        Ok(Self::from_str(&s).unwrap())
1093    }
1094}
1095impl stripe_types::Object for Event {
1096    type Id = stripe_shared::EventId;
1097    fn id(&self) -> &Self::Id {
1098        &self.id
1099    }
1100
1101    fn into_id(self) -> Self::Id {
1102        self.id
1103    }
1104}
1105stripe_types::def_id!(EventId);