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    FinancialConnectionsAccountAccountNumbersUpdated,
305    FinancialConnectionsAccountCreated,
306    FinancialConnectionsAccountDeactivated,
307    FinancialConnectionsAccountDisconnected,
308    FinancialConnectionsAccountReactivated,
309    FinancialConnectionsAccountRefreshedBalance,
310    FinancialConnectionsAccountRefreshedOwnership,
311    FinancialConnectionsAccountRefreshedTransactions,
312    FinancialConnectionsAccountUpcomingAccountNumberExpiry,
313    IdentityVerificationSessionCanceled,
314    IdentityVerificationSessionCreated,
315    IdentityVerificationSessionProcessing,
316    IdentityVerificationSessionRedacted,
317    IdentityVerificationSessionRequiresInput,
318    IdentityVerificationSessionVerified,
319    InvoiceCreated,
320    InvoiceDeleted,
321    InvoiceFinalizationFailed,
322    InvoiceFinalized,
323    InvoiceMarkedUncollectible,
324    InvoiceOverdue,
325    InvoiceOverpaid,
326    InvoicePaid,
327    InvoicePaymentActionRequired,
328    InvoicePaymentAttemptRequired,
329    InvoicePaymentFailed,
330    InvoicePaymentSucceeded,
331    InvoiceSent,
332    InvoiceUpcoming,
333    InvoiceUpdated,
334    InvoiceVoided,
335    InvoiceWillBeDue,
336    InvoicePaymentPaid,
337    InvoiceitemCreated,
338    InvoiceitemDeleted,
339    IssuingAuthorizationCreated,
340    IssuingAuthorizationRequest,
341    IssuingAuthorizationUpdated,
342    IssuingCardCreated,
343    IssuingCardUpdated,
344    IssuingCardholderCreated,
345    IssuingCardholderUpdated,
346    IssuingDisputeClosed,
347    IssuingDisputeCreated,
348    IssuingDisputeFundsReinstated,
349    IssuingDisputeFundsRescinded,
350    IssuingDisputeSubmitted,
351    IssuingDisputeUpdated,
352    IssuingPersonalizationDesignActivated,
353    IssuingPersonalizationDesignDeactivated,
354    IssuingPersonalizationDesignRejected,
355    IssuingPersonalizationDesignUpdated,
356    IssuingTokenCreated,
357    IssuingTokenUpdated,
358    IssuingTransactionCreated,
359    IssuingTransactionPurchaseDetailsReceiptUpdated,
360    IssuingTransactionUpdated,
361    MandateUpdated,
362    PaymentIntentAmountCapturableUpdated,
363    PaymentIntentCanceled,
364    PaymentIntentCreated,
365    PaymentIntentPartiallyFunded,
366    PaymentIntentPaymentFailed,
367    PaymentIntentProcessing,
368    PaymentIntentRequiresAction,
369    PaymentIntentSucceeded,
370    PaymentLinkCreated,
371    PaymentLinkUpdated,
372    PaymentMethodAttached,
373    PaymentMethodAutomaticallyUpdated,
374    PaymentMethodDetached,
375    PaymentMethodUpdated,
376    PayoutCanceled,
377    PayoutCreated,
378    PayoutFailed,
379    PayoutPaid,
380    PayoutReconciliationCompleted,
381    PayoutUpdated,
382    PersonCreated,
383    PersonDeleted,
384    PersonUpdated,
385    PlanCreated,
386    PlanDeleted,
387    PlanUpdated,
388    PriceCreated,
389    PriceDeleted,
390    PriceUpdated,
391    ProductCreated,
392    ProductDeleted,
393    ProductUpdated,
394    PromotionCodeCreated,
395    PromotionCodeUpdated,
396    QuoteAccepted,
397    QuoteCanceled,
398    QuoteCreated,
399    QuoteFinalized,
400    RadarEarlyFraudWarningCreated,
401    RadarEarlyFraudWarningUpdated,
402    RefundCreated,
403    RefundFailed,
404    RefundUpdated,
405    ReportingReportRunFailed,
406    ReportingReportRunSucceeded,
407    ReportingReportTypeUpdated,
408    ReviewClosed,
409    ReviewOpened,
410    SetupIntentCanceled,
411    SetupIntentCreated,
412    SetupIntentRequiresAction,
413    SetupIntentSetupFailed,
414    SetupIntentSucceeded,
415    SigmaScheduledQueryRunCreated,
416    SourceCanceled,
417    SourceChargeable,
418    SourceFailed,
419    SourceMandateNotification,
420    SourceRefundAttributesRequired,
421    SourceTransactionCreated,
422    SourceTransactionUpdated,
423    SubscriptionScheduleAborted,
424    SubscriptionScheduleCanceled,
425    SubscriptionScheduleCompleted,
426    SubscriptionScheduleCreated,
427    SubscriptionScheduleExpiring,
428    SubscriptionScheduleReleased,
429    SubscriptionScheduleUpdated,
430    TaxSettingsUpdated,
431    TaxRateCreated,
432    TaxRateUpdated,
433    TerminalReaderActionFailed,
434    TerminalReaderActionSucceeded,
435    TerminalReaderActionUpdated,
436    TestHelpersTestClockAdvancing,
437    TestHelpersTestClockCreated,
438    TestHelpersTestClockDeleted,
439    TestHelpersTestClockInternalFailure,
440    TestHelpersTestClockReady,
441    TopupCanceled,
442    TopupCreated,
443    TopupFailed,
444    TopupReversed,
445    TopupSucceeded,
446    TransferCreated,
447    TransferReversed,
448    TransferUpdated,
449    TreasuryCreditReversalCreated,
450    TreasuryCreditReversalPosted,
451    TreasuryDebitReversalCompleted,
452    TreasuryDebitReversalCreated,
453    TreasuryDebitReversalInitialCreditGranted,
454    TreasuryFinancialAccountClosed,
455    TreasuryFinancialAccountCreated,
456    TreasuryFinancialAccountFeaturesStatusUpdated,
457    TreasuryInboundTransferCanceled,
458    TreasuryInboundTransferCreated,
459    TreasuryInboundTransferFailed,
460    TreasuryInboundTransferSucceeded,
461    TreasuryOutboundPaymentCanceled,
462    TreasuryOutboundPaymentCreated,
463    TreasuryOutboundPaymentExpectedArrivalDateUpdated,
464    TreasuryOutboundPaymentFailed,
465    TreasuryOutboundPaymentPosted,
466    TreasuryOutboundPaymentReturned,
467    TreasuryOutboundPaymentTrackingDetailsUpdated,
468    TreasuryOutboundTransferCanceled,
469    TreasuryOutboundTransferCreated,
470    TreasuryOutboundTransferExpectedArrivalDateUpdated,
471    TreasuryOutboundTransferFailed,
472    TreasuryOutboundTransferPosted,
473    TreasuryOutboundTransferReturned,
474    TreasuryOutboundTransferTrackingDetailsUpdated,
475    TreasuryReceivedCreditCreated,
476    TreasuryReceivedCreditFailed,
477    TreasuryReceivedCreditSucceeded,
478    TreasuryReceivedDebitCreated,
479    /// An unrecognized value from Stripe. Should not be used as a request parameter.
480    Unknown(String),
481}
482impl EventType {
483    pub fn as_str(&self) -> &str {
484        use EventType::*;
485        match self {
486            AccountApplicationAuthorized => "account.application.authorized",
487            AccountApplicationDeauthorized => "account.application.deauthorized",
488            AccountExternalAccountCreated => "account.external_account.created",
489            AccountExternalAccountDeleted => "account.external_account.deleted",
490            AccountExternalAccountUpdated => "account.external_account.updated",
491            AccountUpdated => "account.updated",
492            ApplicationFeeCreated => "application_fee.created",
493            ApplicationFeeRefundUpdated => "application_fee.refund.updated",
494            ApplicationFeeRefunded => "application_fee.refunded",
495            BalanceAvailable => "balance.available",
496            BalanceSettingsUpdated => "balance_settings.updated",
497            BillingAlertTriggered => "billing.alert.triggered",
498            BillingPortalConfigurationCreated => "billing_portal.configuration.created",
499            BillingPortalConfigurationUpdated => "billing_portal.configuration.updated",
500            BillingPortalSessionCreated => "billing_portal.session.created",
501            CapabilityUpdated => "capability.updated",
502            CashBalanceFundsAvailable => "cash_balance.funds_available",
503            ChargeCaptured => "charge.captured",
504            ChargeDisputeClosed => "charge.dispute.closed",
505            ChargeDisputeCreated => "charge.dispute.created",
506            ChargeDisputeFundsReinstated => "charge.dispute.funds_reinstated",
507            ChargeDisputeFundsWithdrawn => "charge.dispute.funds_withdrawn",
508            ChargeDisputeUpdated => "charge.dispute.updated",
509            ChargeExpired => "charge.expired",
510            ChargeFailed => "charge.failed",
511            ChargePending => "charge.pending",
512            ChargeRefundUpdated => "charge.refund.updated",
513            ChargeRefunded => "charge.refunded",
514            ChargeSucceeded => "charge.succeeded",
515            ChargeUpdated => "charge.updated",
516            CheckoutSessionAsyncPaymentFailed => "checkout.session.async_payment_failed",
517            CheckoutSessionAsyncPaymentSucceeded => "checkout.session.async_payment_succeeded",
518            CheckoutSessionCompleted => "checkout.session.completed",
519            CheckoutSessionExpired => "checkout.session.expired",
520            ClimateOrderCanceled => "climate.order.canceled",
521            ClimateOrderCreated => "climate.order.created",
522            ClimateOrderDelayed => "climate.order.delayed",
523            ClimateOrderDelivered => "climate.order.delivered",
524            ClimateOrderProductSubstituted => "climate.order.product_substituted",
525            ClimateProductCreated => "climate.product.created",
526            ClimateProductPricingUpdated => "climate.product.pricing_updated",
527            CouponCreated => "coupon.created",
528            CouponDeleted => "coupon.deleted",
529            CouponUpdated => "coupon.updated",
530            CreditNoteCreated => "credit_note.created",
531            CreditNoteUpdated => "credit_note.updated",
532            CreditNoteVoided => "credit_note.voided",
533            CustomerCreated => "customer.created",
534            CustomerDeleted => "customer.deleted",
535            CustomerDiscountCreated => "customer.discount.created",
536            CustomerDiscountDeleted => "customer.discount.deleted",
537            CustomerDiscountUpdated => "customer.discount.updated",
538            CustomerSourceCreated => "customer.source.created",
539            CustomerSourceDeleted => "customer.source.deleted",
540            CustomerSourceExpiring => "customer.source.expiring",
541            CustomerSourceUpdated => "customer.source.updated",
542            CustomerSubscriptionCreated => "customer.subscription.created",
543            CustomerSubscriptionDeleted => "customer.subscription.deleted",
544            CustomerSubscriptionPaused => "customer.subscription.paused",
545            CustomerSubscriptionPendingUpdateApplied => {
546                "customer.subscription.pending_update_applied"
547            }
548            CustomerSubscriptionPendingUpdateExpired => {
549                "customer.subscription.pending_update_expired"
550            }
551            CustomerSubscriptionResumed => "customer.subscription.resumed",
552            CustomerSubscriptionTrialWillEnd => "customer.subscription.trial_will_end",
553            CustomerSubscriptionUpdated => "customer.subscription.updated",
554            CustomerTaxIdCreated => "customer.tax_id.created",
555            CustomerTaxIdDeleted => "customer.tax_id.deleted",
556            CustomerTaxIdUpdated => "customer.tax_id.updated",
557            CustomerUpdated => "customer.updated",
558            CustomerCashBalanceTransactionCreated => "customer_cash_balance_transaction.created",
559            EntitlementsActiveEntitlementSummaryUpdated => {
560                "entitlements.active_entitlement_summary.updated"
561            }
562            FileCreated => "file.created",
563            FinancialConnectionsAccountAccountNumbersUpdated => {
564                "financial_connections.account.account_numbers_updated"
565            }
566            FinancialConnectionsAccountCreated => "financial_connections.account.created",
567            FinancialConnectionsAccountDeactivated => "financial_connections.account.deactivated",
568            FinancialConnectionsAccountDisconnected => "financial_connections.account.disconnected",
569            FinancialConnectionsAccountReactivated => "financial_connections.account.reactivated",
570            FinancialConnectionsAccountRefreshedBalance => {
571                "financial_connections.account.refreshed_balance"
572            }
573            FinancialConnectionsAccountRefreshedOwnership => {
574                "financial_connections.account.refreshed_ownership"
575            }
576            FinancialConnectionsAccountRefreshedTransactions => {
577                "financial_connections.account.refreshed_transactions"
578            }
579            FinancialConnectionsAccountUpcomingAccountNumberExpiry => {
580                "financial_connections.account.upcoming_account_number_expiry"
581            }
582            IdentityVerificationSessionCanceled => "identity.verification_session.canceled",
583            IdentityVerificationSessionCreated => "identity.verification_session.created",
584            IdentityVerificationSessionProcessing => "identity.verification_session.processing",
585            IdentityVerificationSessionRedacted => "identity.verification_session.redacted",
586            IdentityVerificationSessionRequiresInput => {
587                "identity.verification_session.requires_input"
588            }
589            IdentityVerificationSessionVerified => "identity.verification_session.verified",
590            InvoiceCreated => "invoice.created",
591            InvoiceDeleted => "invoice.deleted",
592            InvoiceFinalizationFailed => "invoice.finalization_failed",
593            InvoiceFinalized => "invoice.finalized",
594            InvoiceMarkedUncollectible => "invoice.marked_uncollectible",
595            InvoiceOverdue => "invoice.overdue",
596            InvoiceOverpaid => "invoice.overpaid",
597            InvoicePaid => "invoice.paid",
598            InvoicePaymentActionRequired => "invoice.payment_action_required",
599            InvoicePaymentAttemptRequired => "invoice.payment_attempt_required",
600            InvoicePaymentFailed => "invoice.payment_failed",
601            InvoicePaymentSucceeded => "invoice.payment_succeeded",
602            InvoiceSent => "invoice.sent",
603            InvoiceUpcoming => "invoice.upcoming",
604            InvoiceUpdated => "invoice.updated",
605            InvoiceVoided => "invoice.voided",
606            InvoiceWillBeDue => "invoice.will_be_due",
607            InvoicePaymentPaid => "invoice_payment.paid",
608            InvoiceitemCreated => "invoiceitem.created",
609            InvoiceitemDeleted => "invoiceitem.deleted",
610            IssuingAuthorizationCreated => "issuing_authorization.created",
611            IssuingAuthorizationRequest => "issuing_authorization.request",
612            IssuingAuthorizationUpdated => "issuing_authorization.updated",
613            IssuingCardCreated => "issuing_card.created",
614            IssuingCardUpdated => "issuing_card.updated",
615            IssuingCardholderCreated => "issuing_cardholder.created",
616            IssuingCardholderUpdated => "issuing_cardholder.updated",
617            IssuingDisputeClosed => "issuing_dispute.closed",
618            IssuingDisputeCreated => "issuing_dispute.created",
619            IssuingDisputeFundsReinstated => "issuing_dispute.funds_reinstated",
620            IssuingDisputeFundsRescinded => "issuing_dispute.funds_rescinded",
621            IssuingDisputeSubmitted => "issuing_dispute.submitted",
622            IssuingDisputeUpdated => "issuing_dispute.updated",
623            IssuingPersonalizationDesignActivated => "issuing_personalization_design.activated",
624            IssuingPersonalizationDesignDeactivated => "issuing_personalization_design.deactivated",
625            IssuingPersonalizationDesignRejected => "issuing_personalization_design.rejected",
626            IssuingPersonalizationDesignUpdated => "issuing_personalization_design.updated",
627            IssuingTokenCreated => "issuing_token.created",
628            IssuingTokenUpdated => "issuing_token.updated",
629            IssuingTransactionCreated => "issuing_transaction.created",
630            IssuingTransactionPurchaseDetailsReceiptUpdated => {
631                "issuing_transaction.purchase_details_receipt_updated"
632            }
633            IssuingTransactionUpdated => "issuing_transaction.updated",
634            MandateUpdated => "mandate.updated",
635            PaymentIntentAmountCapturableUpdated => "payment_intent.amount_capturable_updated",
636            PaymentIntentCanceled => "payment_intent.canceled",
637            PaymentIntentCreated => "payment_intent.created",
638            PaymentIntentPartiallyFunded => "payment_intent.partially_funded",
639            PaymentIntentPaymentFailed => "payment_intent.payment_failed",
640            PaymentIntentProcessing => "payment_intent.processing",
641            PaymentIntentRequiresAction => "payment_intent.requires_action",
642            PaymentIntentSucceeded => "payment_intent.succeeded",
643            PaymentLinkCreated => "payment_link.created",
644            PaymentLinkUpdated => "payment_link.updated",
645            PaymentMethodAttached => "payment_method.attached",
646            PaymentMethodAutomaticallyUpdated => "payment_method.automatically_updated",
647            PaymentMethodDetached => "payment_method.detached",
648            PaymentMethodUpdated => "payment_method.updated",
649            PayoutCanceled => "payout.canceled",
650            PayoutCreated => "payout.created",
651            PayoutFailed => "payout.failed",
652            PayoutPaid => "payout.paid",
653            PayoutReconciliationCompleted => "payout.reconciliation_completed",
654            PayoutUpdated => "payout.updated",
655            PersonCreated => "person.created",
656            PersonDeleted => "person.deleted",
657            PersonUpdated => "person.updated",
658            PlanCreated => "plan.created",
659            PlanDeleted => "plan.deleted",
660            PlanUpdated => "plan.updated",
661            PriceCreated => "price.created",
662            PriceDeleted => "price.deleted",
663            PriceUpdated => "price.updated",
664            ProductCreated => "product.created",
665            ProductDeleted => "product.deleted",
666            ProductUpdated => "product.updated",
667            PromotionCodeCreated => "promotion_code.created",
668            PromotionCodeUpdated => "promotion_code.updated",
669            QuoteAccepted => "quote.accepted",
670            QuoteCanceled => "quote.canceled",
671            QuoteCreated => "quote.created",
672            QuoteFinalized => "quote.finalized",
673            RadarEarlyFraudWarningCreated => "radar.early_fraud_warning.created",
674            RadarEarlyFraudWarningUpdated => "radar.early_fraud_warning.updated",
675            RefundCreated => "refund.created",
676            RefundFailed => "refund.failed",
677            RefundUpdated => "refund.updated",
678            ReportingReportRunFailed => "reporting.report_run.failed",
679            ReportingReportRunSucceeded => "reporting.report_run.succeeded",
680            ReportingReportTypeUpdated => "reporting.report_type.updated",
681            ReviewClosed => "review.closed",
682            ReviewOpened => "review.opened",
683            SetupIntentCanceled => "setup_intent.canceled",
684            SetupIntentCreated => "setup_intent.created",
685            SetupIntentRequiresAction => "setup_intent.requires_action",
686            SetupIntentSetupFailed => "setup_intent.setup_failed",
687            SetupIntentSucceeded => "setup_intent.succeeded",
688            SigmaScheduledQueryRunCreated => "sigma.scheduled_query_run.created",
689            SourceCanceled => "source.canceled",
690            SourceChargeable => "source.chargeable",
691            SourceFailed => "source.failed",
692            SourceMandateNotification => "source.mandate_notification",
693            SourceRefundAttributesRequired => "source.refund_attributes_required",
694            SourceTransactionCreated => "source.transaction.created",
695            SourceTransactionUpdated => "source.transaction.updated",
696            SubscriptionScheduleAborted => "subscription_schedule.aborted",
697            SubscriptionScheduleCanceled => "subscription_schedule.canceled",
698            SubscriptionScheduleCompleted => "subscription_schedule.completed",
699            SubscriptionScheduleCreated => "subscription_schedule.created",
700            SubscriptionScheduleExpiring => "subscription_schedule.expiring",
701            SubscriptionScheduleReleased => "subscription_schedule.released",
702            SubscriptionScheduleUpdated => "subscription_schedule.updated",
703            TaxSettingsUpdated => "tax.settings.updated",
704            TaxRateCreated => "tax_rate.created",
705            TaxRateUpdated => "tax_rate.updated",
706            TerminalReaderActionFailed => "terminal.reader.action_failed",
707            TerminalReaderActionSucceeded => "terminal.reader.action_succeeded",
708            TerminalReaderActionUpdated => "terminal.reader.action_updated",
709            TestHelpersTestClockAdvancing => "test_helpers.test_clock.advancing",
710            TestHelpersTestClockCreated => "test_helpers.test_clock.created",
711            TestHelpersTestClockDeleted => "test_helpers.test_clock.deleted",
712            TestHelpersTestClockInternalFailure => "test_helpers.test_clock.internal_failure",
713            TestHelpersTestClockReady => "test_helpers.test_clock.ready",
714            TopupCanceled => "topup.canceled",
715            TopupCreated => "topup.created",
716            TopupFailed => "topup.failed",
717            TopupReversed => "topup.reversed",
718            TopupSucceeded => "topup.succeeded",
719            TransferCreated => "transfer.created",
720            TransferReversed => "transfer.reversed",
721            TransferUpdated => "transfer.updated",
722            TreasuryCreditReversalCreated => "treasury.credit_reversal.created",
723            TreasuryCreditReversalPosted => "treasury.credit_reversal.posted",
724            TreasuryDebitReversalCompleted => "treasury.debit_reversal.completed",
725            TreasuryDebitReversalCreated => "treasury.debit_reversal.created",
726            TreasuryDebitReversalInitialCreditGranted => {
727                "treasury.debit_reversal.initial_credit_granted"
728            }
729            TreasuryFinancialAccountClosed => "treasury.financial_account.closed",
730            TreasuryFinancialAccountCreated => "treasury.financial_account.created",
731            TreasuryFinancialAccountFeaturesStatusUpdated => {
732                "treasury.financial_account.features_status_updated"
733            }
734            TreasuryInboundTransferCanceled => "treasury.inbound_transfer.canceled",
735            TreasuryInboundTransferCreated => "treasury.inbound_transfer.created",
736            TreasuryInboundTransferFailed => "treasury.inbound_transfer.failed",
737            TreasuryInboundTransferSucceeded => "treasury.inbound_transfer.succeeded",
738            TreasuryOutboundPaymentCanceled => "treasury.outbound_payment.canceled",
739            TreasuryOutboundPaymentCreated => "treasury.outbound_payment.created",
740            TreasuryOutboundPaymentExpectedArrivalDateUpdated => {
741                "treasury.outbound_payment.expected_arrival_date_updated"
742            }
743            TreasuryOutboundPaymentFailed => "treasury.outbound_payment.failed",
744            TreasuryOutboundPaymentPosted => "treasury.outbound_payment.posted",
745            TreasuryOutboundPaymentReturned => "treasury.outbound_payment.returned",
746            TreasuryOutboundPaymentTrackingDetailsUpdated => {
747                "treasury.outbound_payment.tracking_details_updated"
748            }
749            TreasuryOutboundTransferCanceled => "treasury.outbound_transfer.canceled",
750            TreasuryOutboundTransferCreated => "treasury.outbound_transfer.created",
751            TreasuryOutboundTransferExpectedArrivalDateUpdated => {
752                "treasury.outbound_transfer.expected_arrival_date_updated"
753            }
754            TreasuryOutboundTransferFailed => "treasury.outbound_transfer.failed",
755            TreasuryOutboundTransferPosted => "treasury.outbound_transfer.posted",
756            TreasuryOutboundTransferReturned => "treasury.outbound_transfer.returned",
757            TreasuryOutboundTransferTrackingDetailsUpdated => {
758                "treasury.outbound_transfer.tracking_details_updated"
759            }
760            TreasuryReceivedCreditCreated => "treasury.received_credit.created",
761            TreasuryReceivedCreditFailed => "treasury.received_credit.failed",
762            TreasuryReceivedCreditSucceeded => "treasury.received_credit.succeeded",
763            TreasuryReceivedDebitCreated => "treasury.received_debit.created",
764            Unknown(v) => v,
765        }
766    }
767}
768
769impl std::str::FromStr for EventType {
770    type Err = std::convert::Infallible;
771    fn from_str(s: &str) -> Result<Self, Self::Err> {
772        use EventType::*;
773        match s {
774            "account.application.authorized" => Ok(AccountApplicationAuthorized),
775            "account.application.deauthorized" => Ok(AccountApplicationDeauthorized),
776            "account.external_account.created" => Ok(AccountExternalAccountCreated),
777            "account.external_account.deleted" => Ok(AccountExternalAccountDeleted),
778            "account.external_account.updated" => Ok(AccountExternalAccountUpdated),
779            "account.updated" => Ok(AccountUpdated),
780            "application_fee.created" => Ok(ApplicationFeeCreated),
781            "application_fee.refund.updated" => Ok(ApplicationFeeRefundUpdated),
782            "application_fee.refunded" => Ok(ApplicationFeeRefunded),
783            "balance.available" => Ok(BalanceAvailable),
784            "balance_settings.updated" => Ok(BalanceSettingsUpdated),
785            "billing.alert.triggered" => Ok(BillingAlertTriggered),
786            "billing_portal.configuration.created" => Ok(BillingPortalConfigurationCreated),
787            "billing_portal.configuration.updated" => Ok(BillingPortalConfigurationUpdated),
788            "billing_portal.session.created" => Ok(BillingPortalSessionCreated),
789            "capability.updated" => Ok(CapabilityUpdated),
790            "cash_balance.funds_available" => Ok(CashBalanceFundsAvailable),
791            "charge.captured" => Ok(ChargeCaptured),
792            "charge.dispute.closed" => Ok(ChargeDisputeClosed),
793            "charge.dispute.created" => Ok(ChargeDisputeCreated),
794            "charge.dispute.funds_reinstated" => Ok(ChargeDisputeFundsReinstated),
795            "charge.dispute.funds_withdrawn" => Ok(ChargeDisputeFundsWithdrawn),
796            "charge.dispute.updated" => Ok(ChargeDisputeUpdated),
797            "charge.expired" => Ok(ChargeExpired),
798            "charge.failed" => Ok(ChargeFailed),
799            "charge.pending" => Ok(ChargePending),
800            "charge.refund.updated" => Ok(ChargeRefundUpdated),
801            "charge.refunded" => Ok(ChargeRefunded),
802            "charge.succeeded" => Ok(ChargeSucceeded),
803            "charge.updated" => Ok(ChargeUpdated),
804            "checkout.session.async_payment_failed" => Ok(CheckoutSessionAsyncPaymentFailed),
805            "checkout.session.async_payment_succeeded" => Ok(CheckoutSessionAsyncPaymentSucceeded),
806            "checkout.session.completed" => Ok(CheckoutSessionCompleted),
807            "checkout.session.expired" => Ok(CheckoutSessionExpired),
808            "climate.order.canceled" => Ok(ClimateOrderCanceled),
809            "climate.order.created" => Ok(ClimateOrderCreated),
810            "climate.order.delayed" => Ok(ClimateOrderDelayed),
811            "climate.order.delivered" => Ok(ClimateOrderDelivered),
812            "climate.order.product_substituted" => Ok(ClimateOrderProductSubstituted),
813            "climate.product.created" => Ok(ClimateProductCreated),
814            "climate.product.pricing_updated" => Ok(ClimateProductPricingUpdated),
815            "coupon.created" => Ok(CouponCreated),
816            "coupon.deleted" => Ok(CouponDeleted),
817            "coupon.updated" => Ok(CouponUpdated),
818            "credit_note.created" => Ok(CreditNoteCreated),
819            "credit_note.updated" => Ok(CreditNoteUpdated),
820            "credit_note.voided" => Ok(CreditNoteVoided),
821            "customer.created" => Ok(CustomerCreated),
822            "customer.deleted" => Ok(CustomerDeleted),
823            "customer.discount.created" => Ok(CustomerDiscountCreated),
824            "customer.discount.deleted" => Ok(CustomerDiscountDeleted),
825            "customer.discount.updated" => Ok(CustomerDiscountUpdated),
826            "customer.source.created" => Ok(CustomerSourceCreated),
827            "customer.source.deleted" => Ok(CustomerSourceDeleted),
828            "customer.source.expiring" => Ok(CustomerSourceExpiring),
829            "customer.source.updated" => Ok(CustomerSourceUpdated),
830            "customer.subscription.created" => Ok(CustomerSubscriptionCreated),
831            "customer.subscription.deleted" => Ok(CustomerSubscriptionDeleted),
832            "customer.subscription.paused" => Ok(CustomerSubscriptionPaused),
833            "customer.subscription.pending_update_applied" => {
834                Ok(CustomerSubscriptionPendingUpdateApplied)
835            }
836            "customer.subscription.pending_update_expired" => {
837                Ok(CustomerSubscriptionPendingUpdateExpired)
838            }
839            "customer.subscription.resumed" => Ok(CustomerSubscriptionResumed),
840            "customer.subscription.trial_will_end" => Ok(CustomerSubscriptionTrialWillEnd),
841            "customer.subscription.updated" => Ok(CustomerSubscriptionUpdated),
842            "customer.tax_id.created" => Ok(CustomerTaxIdCreated),
843            "customer.tax_id.deleted" => Ok(CustomerTaxIdDeleted),
844            "customer.tax_id.updated" => Ok(CustomerTaxIdUpdated),
845            "customer.updated" => Ok(CustomerUpdated),
846            "customer_cash_balance_transaction.created" => {
847                Ok(CustomerCashBalanceTransactionCreated)
848            }
849            "entitlements.active_entitlement_summary.updated" => {
850                Ok(EntitlementsActiveEntitlementSummaryUpdated)
851            }
852            "file.created" => Ok(FileCreated),
853            "financial_connections.account.account_numbers_updated" => {
854                Ok(FinancialConnectionsAccountAccountNumbersUpdated)
855            }
856            "financial_connections.account.created" => Ok(FinancialConnectionsAccountCreated),
857            "financial_connections.account.deactivated" => {
858                Ok(FinancialConnectionsAccountDeactivated)
859            }
860            "financial_connections.account.disconnected" => {
861                Ok(FinancialConnectionsAccountDisconnected)
862            }
863            "financial_connections.account.reactivated" => {
864                Ok(FinancialConnectionsAccountReactivated)
865            }
866            "financial_connections.account.refreshed_balance" => {
867                Ok(FinancialConnectionsAccountRefreshedBalance)
868            }
869            "financial_connections.account.refreshed_ownership" => {
870                Ok(FinancialConnectionsAccountRefreshedOwnership)
871            }
872            "financial_connections.account.refreshed_transactions" => {
873                Ok(FinancialConnectionsAccountRefreshedTransactions)
874            }
875            "financial_connections.account.upcoming_account_number_expiry" => {
876                Ok(FinancialConnectionsAccountUpcomingAccountNumberExpiry)
877            }
878            "identity.verification_session.canceled" => Ok(IdentityVerificationSessionCanceled),
879            "identity.verification_session.created" => Ok(IdentityVerificationSessionCreated),
880            "identity.verification_session.processing" => Ok(IdentityVerificationSessionProcessing),
881            "identity.verification_session.redacted" => Ok(IdentityVerificationSessionRedacted),
882            "identity.verification_session.requires_input" => {
883                Ok(IdentityVerificationSessionRequiresInput)
884            }
885            "identity.verification_session.verified" => Ok(IdentityVerificationSessionVerified),
886            "invoice.created" => Ok(InvoiceCreated),
887            "invoice.deleted" => Ok(InvoiceDeleted),
888            "invoice.finalization_failed" => Ok(InvoiceFinalizationFailed),
889            "invoice.finalized" => Ok(InvoiceFinalized),
890            "invoice.marked_uncollectible" => Ok(InvoiceMarkedUncollectible),
891            "invoice.overdue" => Ok(InvoiceOverdue),
892            "invoice.overpaid" => Ok(InvoiceOverpaid),
893            "invoice.paid" => Ok(InvoicePaid),
894            "invoice.payment_action_required" => Ok(InvoicePaymentActionRequired),
895            "invoice.payment_attempt_required" => Ok(InvoicePaymentAttemptRequired),
896            "invoice.payment_failed" => Ok(InvoicePaymentFailed),
897            "invoice.payment_succeeded" => Ok(InvoicePaymentSucceeded),
898            "invoice.sent" => Ok(InvoiceSent),
899            "invoice.upcoming" => Ok(InvoiceUpcoming),
900            "invoice.updated" => Ok(InvoiceUpdated),
901            "invoice.voided" => Ok(InvoiceVoided),
902            "invoice.will_be_due" => Ok(InvoiceWillBeDue),
903            "invoice_payment.paid" => Ok(InvoicePaymentPaid),
904            "invoiceitem.created" => Ok(InvoiceitemCreated),
905            "invoiceitem.deleted" => Ok(InvoiceitemDeleted),
906            "issuing_authorization.created" => Ok(IssuingAuthorizationCreated),
907            "issuing_authorization.request" => Ok(IssuingAuthorizationRequest),
908            "issuing_authorization.updated" => Ok(IssuingAuthorizationUpdated),
909            "issuing_card.created" => Ok(IssuingCardCreated),
910            "issuing_card.updated" => Ok(IssuingCardUpdated),
911            "issuing_cardholder.created" => Ok(IssuingCardholderCreated),
912            "issuing_cardholder.updated" => Ok(IssuingCardholderUpdated),
913            "issuing_dispute.closed" => Ok(IssuingDisputeClosed),
914            "issuing_dispute.created" => Ok(IssuingDisputeCreated),
915            "issuing_dispute.funds_reinstated" => Ok(IssuingDisputeFundsReinstated),
916            "issuing_dispute.funds_rescinded" => Ok(IssuingDisputeFundsRescinded),
917            "issuing_dispute.submitted" => Ok(IssuingDisputeSubmitted),
918            "issuing_dispute.updated" => Ok(IssuingDisputeUpdated),
919            "issuing_personalization_design.activated" => Ok(IssuingPersonalizationDesignActivated),
920            "issuing_personalization_design.deactivated" => {
921                Ok(IssuingPersonalizationDesignDeactivated)
922            }
923            "issuing_personalization_design.rejected" => Ok(IssuingPersonalizationDesignRejected),
924            "issuing_personalization_design.updated" => Ok(IssuingPersonalizationDesignUpdated),
925            "issuing_token.created" => Ok(IssuingTokenCreated),
926            "issuing_token.updated" => Ok(IssuingTokenUpdated),
927            "issuing_transaction.created" => Ok(IssuingTransactionCreated),
928            "issuing_transaction.purchase_details_receipt_updated" => {
929                Ok(IssuingTransactionPurchaseDetailsReceiptUpdated)
930            }
931            "issuing_transaction.updated" => Ok(IssuingTransactionUpdated),
932            "mandate.updated" => Ok(MandateUpdated),
933            "payment_intent.amount_capturable_updated" => Ok(PaymentIntentAmountCapturableUpdated),
934            "payment_intent.canceled" => Ok(PaymentIntentCanceled),
935            "payment_intent.created" => Ok(PaymentIntentCreated),
936            "payment_intent.partially_funded" => Ok(PaymentIntentPartiallyFunded),
937            "payment_intent.payment_failed" => Ok(PaymentIntentPaymentFailed),
938            "payment_intent.processing" => Ok(PaymentIntentProcessing),
939            "payment_intent.requires_action" => Ok(PaymentIntentRequiresAction),
940            "payment_intent.succeeded" => Ok(PaymentIntentSucceeded),
941            "payment_link.created" => Ok(PaymentLinkCreated),
942            "payment_link.updated" => Ok(PaymentLinkUpdated),
943            "payment_method.attached" => Ok(PaymentMethodAttached),
944            "payment_method.automatically_updated" => Ok(PaymentMethodAutomaticallyUpdated),
945            "payment_method.detached" => Ok(PaymentMethodDetached),
946            "payment_method.updated" => Ok(PaymentMethodUpdated),
947            "payout.canceled" => Ok(PayoutCanceled),
948            "payout.created" => Ok(PayoutCreated),
949            "payout.failed" => Ok(PayoutFailed),
950            "payout.paid" => Ok(PayoutPaid),
951            "payout.reconciliation_completed" => Ok(PayoutReconciliationCompleted),
952            "payout.updated" => Ok(PayoutUpdated),
953            "person.created" => Ok(PersonCreated),
954            "person.deleted" => Ok(PersonDeleted),
955            "person.updated" => Ok(PersonUpdated),
956            "plan.created" => Ok(PlanCreated),
957            "plan.deleted" => Ok(PlanDeleted),
958            "plan.updated" => Ok(PlanUpdated),
959            "price.created" => Ok(PriceCreated),
960            "price.deleted" => Ok(PriceDeleted),
961            "price.updated" => Ok(PriceUpdated),
962            "product.created" => Ok(ProductCreated),
963            "product.deleted" => Ok(ProductDeleted),
964            "product.updated" => Ok(ProductUpdated),
965            "promotion_code.created" => Ok(PromotionCodeCreated),
966            "promotion_code.updated" => Ok(PromotionCodeUpdated),
967            "quote.accepted" => Ok(QuoteAccepted),
968            "quote.canceled" => Ok(QuoteCanceled),
969            "quote.created" => Ok(QuoteCreated),
970            "quote.finalized" => Ok(QuoteFinalized),
971            "radar.early_fraud_warning.created" => Ok(RadarEarlyFraudWarningCreated),
972            "radar.early_fraud_warning.updated" => Ok(RadarEarlyFraudWarningUpdated),
973            "refund.created" => Ok(RefundCreated),
974            "refund.failed" => Ok(RefundFailed),
975            "refund.updated" => Ok(RefundUpdated),
976            "reporting.report_run.failed" => Ok(ReportingReportRunFailed),
977            "reporting.report_run.succeeded" => Ok(ReportingReportRunSucceeded),
978            "reporting.report_type.updated" => Ok(ReportingReportTypeUpdated),
979            "review.closed" => Ok(ReviewClosed),
980            "review.opened" => Ok(ReviewOpened),
981            "setup_intent.canceled" => Ok(SetupIntentCanceled),
982            "setup_intent.created" => Ok(SetupIntentCreated),
983            "setup_intent.requires_action" => Ok(SetupIntentRequiresAction),
984            "setup_intent.setup_failed" => Ok(SetupIntentSetupFailed),
985            "setup_intent.succeeded" => Ok(SetupIntentSucceeded),
986            "sigma.scheduled_query_run.created" => Ok(SigmaScheduledQueryRunCreated),
987            "source.canceled" => Ok(SourceCanceled),
988            "source.chargeable" => Ok(SourceChargeable),
989            "source.failed" => Ok(SourceFailed),
990            "source.mandate_notification" => Ok(SourceMandateNotification),
991            "source.refund_attributes_required" => Ok(SourceRefundAttributesRequired),
992            "source.transaction.created" => Ok(SourceTransactionCreated),
993            "source.transaction.updated" => Ok(SourceTransactionUpdated),
994            "subscription_schedule.aborted" => Ok(SubscriptionScheduleAborted),
995            "subscription_schedule.canceled" => Ok(SubscriptionScheduleCanceled),
996            "subscription_schedule.completed" => Ok(SubscriptionScheduleCompleted),
997            "subscription_schedule.created" => Ok(SubscriptionScheduleCreated),
998            "subscription_schedule.expiring" => Ok(SubscriptionScheduleExpiring),
999            "subscription_schedule.released" => Ok(SubscriptionScheduleReleased),
1000            "subscription_schedule.updated" => Ok(SubscriptionScheduleUpdated),
1001            "tax.settings.updated" => Ok(TaxSettingsUpdated),
1002            "tax_rate.created" => Ok(TaxRateCreated),
1003            "tax_rate.updated" => Ok(TaxRateUpdated),
1004            "terminal.reader.action_failed" => Ok(TerminalReaderActionFailed),
1005            "terminal.reader.action_succeeded" => Ok(TerminalReaderActionSucceeded),
1006            "terminal.reader.action_updated" => Ok(TerminalReaderActionUpdated),
1007            "test_helpers.test_clock.advancing" => Ok(TestHelpersTestClockAdvancing),
1008            "test_helpers.test_clock.created" => Ok(TestHelpersTestClockCreated),
1009            "test_helpers.test_clock.deleted" => Ok(TestHelpersTestClockDeleted),
1010            "test_helpers.test_clock.internal_failure" => Ok(TestHelpersTestClockInternalFailure),
1011            "test_helpers.test_clock.ready" => Ok(TestHelpersTestClockReady),
1012            "topup.canceled" => Ok(TopupCanceled),
1013            "topup.created" => Ok(TopupCreated),
1014            "topup.failed" => Ok(TopupFailed),
1015            "topup.reversed" => Ok(TopupReversed),
1016            "topup.succeeded" => Ok(TopupSucceeded),
1017            "transfer.created" => Ok(TransferCreated),
1018            "transfer.reversed" => Ok(TransferReversed),
1019            "transfer.updated" => Ok(TransferUpdated),
1020            "treasury.credit_reversal.created" => Ok(TreasuryCreditReversalCreated),
1021            "treasury.credit_reversal.posted" => Ok(TreasuryCreditReversalPosted),
1022            "treasury.debit_reversal.completed" => Ok(TreasuryDebitReversalCompleted),
1023            "treasury.debit_reversal.created" => Ok(TreasuryDebitReversalCreated),
1024            "treasury.debit_reversal.initial_credit_granted" => {
1025                Ok(TreasuryDebitReversalInitialCreditGranted)
1026            }
1027            "treasury.financial_account.closed" => Ok(TreasuryFinancialAccountClosed),
1028            "treasury.financial_account.created" => Ok(TreasuryFinancialAccountCreated),
1029            "treasury.financial_account.features_status_updated" => {
1030                Ok(TreasuryFinancialAccountFeaturesStatusUpdated)
1031            }
1032            "treasury.inbound_transfer.canceled" => Ok(TreasuryInboundTransferCanceled),
1033            "treasury.inbound_transfer.created" => Ok(TreasuryInboundTransferCreated),
1034            "treasury.inbound_transfer.failed" => Ok(TreasuryInboundTransferFailed),
1035            "treasury.inbound_transfer.succeeded" => Ok(TreasuryInboundTransferSucceeded),
1036            "treasury.outbound_payment.canceled" => Ok(TreasuryOutboundPaymentCanceled),
1037            "treasury.outbound_payment.created" => Ok(TreasuryOutboundPaymentCreated),
1038            "treasury.outbound_payment.expected_arrival_date_updated" => {
1039                Ok(TreasuryOutboundPaymentExpectedArrivalDateUpdated)
1040            }
1041            "treasury.outbound_payment.failed" => Ok(TreasuryOutboundPaymentFailed),
1042            "treasury.outbound_payment.posted" => Ok(TreasuryOutboundPaymentPosted),
1043            "treasury.outbound_payment.returned" => Ok(TreasuryOutboundPaymentReturned),
1044            "treasury.outbound_payment.tracking_details_updated" => {
1045                Ok(TreasuryOutboundPaymentTrackingDetailsUpdated)
1046            }
1047            "treasury.outbound_transfer.canceled" => Ok(TreasuryOutboundTransferCanceled),
1048            "treasury.outbound_transfer.created" => Ok(TreasuryOutboundTransferCreated),
1049            "treasury.outbound_transfer.expected_arrival_date_updated" => {
1050                Ok(TreasuryOutboundTransferExpectedArrivalDateUpdated)
1051            }
1052            "treasury.outbound_transfer.failed" => Ok(TreasuryOutboundTransferFailed),
1053            "treasury.outbound_transfer.posted" => Ok(TreasuryOutboundTransferPosted),
1054            "treasury.outbound_transfer.returned" => Ok(TreasuryOutboundTransferReturned),
1055            "treasury.outbound_transfer.tracking_details_updated" => {
1056                Ok(TreasuryOutboundTransferTrackingDetailsUpdated)
1057            }
1058            "treasury.received_credit.created" => Ok(TreasuryReceivedCreditCreated),
1059            "treasury.received_credit.failed" => Ok(TreasuryReceivedCreditFailed),
1060            "treasury.received_credit.succeeded" => Ok(TreasuryReceivedCreditSucceeded),
1061            "treasury.received_debit.created" => Ok(TreasuryReceivedDebitCreated),
1062            v => Ok(Unknown(v.to_owned())),
1063        }
1064    }
1065}
1066impl std::fmt::Display for EventType {
1067    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1068        f.write_str(self.as_str())
1069    }
1070}
1071
1072impl std::fmt::Debug for EventType {
1073    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1074        f.write_str(self.as_str())
1075    }
1076}
1077#[cfg(feature = "serialize")]
1078impl serde::Serialize for EventType {
1079    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1080    where
1081        S: serde::Serializer,
1082    {
1083        serializer.serialize_str(self.as_str())
1084    }
1085}
1086impl miniserde::Deserialize for EventType {
1087    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1088        crate::Place::new(out)
1089    }
1090}
1091
1092impl miniserde::de::Visitor for crate::Place<EventType> {
1093    fn string(&mut self, s: &str) -> miniserde::Result<()> {
1094        use std::str::FromStr;
1095        self.out = Some(EventType::from_str(s).unwrap());
1096        Ok(())
1097    }
1098}
1099
1100stripe_types::impl_from_val_with_from_str!(EventType);
1101#[cfg(feature = "deserialize")]
1102impl<'de> serde::Deserialize<'de> for EventType {
1103    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1104        use std::str::FromStr;
1105        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1106        Ok(Self::from_str(&s).unwrap())
1107    }
1108}
1109impl stripe_types::Object for Event {
1110    type Id = stripe_shared::EventId;
1111    fn id(&self) -> &Self::Id {
1112        &self.id
1113    }
1114
1115    fn into_id(self) -> Self::Id {
1116        self.id
1117    }
1118}
1119stripe_types::def_id!(EventId);