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