stripe_shared/
event.rs

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