1#[derive(Clone)]
15#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
16#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
17pub struct PaymentIntent {
18 pub allowed_payment_method_types:
21 Option<Vec<stripe_shared::PaymentIntentAllowedPaymentMethodTypes>>,
22 pub amount: i64,
27 pub amount_capturable: i64,
29 pub amount_details: Option<stripe_shared::PaymentFlowsAmountDetails>,
30 pub amount_received: i64,
32 pub application: Option<stripe_types::Expandable<stripe_shared::Application>>,
34 pub application_fee_amount: Option<i64>,
38 pub automatic_payment_methods:
40 Option<stripe_shared::PaymentFlowsAutomaticPaymentMethodsPaymentIntent>,
41 pub canceled_at: Option<stripe_types::Timestamp>,
44 pub cancellation_reason: Option<PaymentIntentCancellationReason>,
46 pub capture_method: stripe_shared::PaymentIntentCaptureMethod,
48 pub client_secret: Option<String>,
56 pub confirmation_method: stripe_shared::PaymentIntentConfirmationMethod,
58 pub created: stripe_types::Timestamp,
60 pub currency: stripe_types::Currency,
63 pub customer: Option<stripe_types::Expandable<stripe_shared::Customer>>,
70 pub customer_account: Option<String>,
77 pub description: Option<String>,
79 pub excluded_payment_method_types:
81 Option<Vec<stripe_shared::PaymentIntentExcludedPaymentMethodTypes>>,
82 pub hooks: Option<stripe_shared::PaymentFlowsPaymentIntentAsyncWorkflows>,
83 pub id: stripe_shared::PaymentIntentId,
85 pub last_payment_error: Option<Box<stripe_shared::ApiErrors>>,
88 pub latest_charge: Option<stripe_types::Expandable<stripe_shared::Charge>>,
91 pub livemode: bool,
94 pub managed_payments: Option<stripe_shared::SmorResourceManagedPayments>,
96 pub metadata: std::collections::HashMap<String, String>,
100 pub next_action: Option<stripe_shared::PaymentIntentNextAction>,
102 pub on_behalf_of: Option<stripe_types::Expandable<stripe_shared::Account>>,
106 pub payment_details: Option<stripe_shared::PaymentFlowsPaymentDetails>,
107 pub payment_method: Option<stripe_types::Expandable<stripe_shared::PaymentMethod>>,
109 pub payment_method_configuration_details:
111 Option<stripe_shared::PaymentMethodConfigBizPaymentMethodConfigurationDetails>,
112 pub payment_method_options: Option<stripe_shared::PaymentIntentPaymentMethodOptions>,
114 pub payment_method_types: Vec<String>,
118 pub presentment_details: Option<stripe_shared::PaymentFlowsPaymentIntentPresentmentDetails>,
119 pub processing: Option<stripe_shared::PaymentIntentProcessing>,
121 pub receipt_email: Option<String>,
124 pub review: Option<stripe_types::Expandable<stripe_shared::Review>>,
126 pub setup_future_usage: Option<stripe_shared::PaymentIntentSetupFutureUsage>,
135 pub shipping: Option<stripe_shared::Shipping>,
137 pub source: Option<stripe_types::Expandable<stripe_shared::PaymentSource>>,
140 pub statement_descriptor: Option<String>,
147 pub statement_descriptor_suffix: Option<String>,
150 pub status: PaymentIntentStatus,
153 pub transfer_data: Option<stripe_shared::TransferData>,
156 pub transfer_group: Option<String>,
159}
160#[cfg(feature = "redact-generated-debug")]
161impl std::fmt::Debug for PaymentIntent {
162 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
163 f.debug_struct("PaymentIntent").finish_non_exhaustive()
164 }
165}
166#[doc(hidden)]
167pub struct PaymentIntentBuilder {
168 allowed_payment_method_types:
169 Option<Option<Vec<stripe_shared::PaymentIntentAllowedPaymentMethodTypes>>>,
170 amount: Option<i64>,
171 amount_capturable: Option<i64>,
172 amount_details: Option<Option<stripe_shared::PaymentFlowsAmountDetails>>,
173 amount_received: Option<i64>,
174 application: Option<Option<stripe_types::Expandable<stripe_shared::Application>>>,
175 application_fee_amount: Option<Option<i64>>,
176 automatic_payment_methods:
177 Option<Option<stripe_shared::PaymentFlowsAutomaticPaymentMethodsPaymentIntent>>,
178 canceled_at: Option<Option<stripe_types::Timestamp>>,
179 cancellation_reason: Option<Option<PaymentIntentCancellationReason>>,
180 capture_method: Option<stripe_shared::PaymentIntentCaptureMethod>,
181 client_secret: Option<Option<String>>,
182 confirmation_method: Option<stripe_shared::PaymentIntentConfirmationMethod>,
183 created: Option<stripe_types::Timestamp>,
184 currency: Option<stripe_types::Currency>,
185 customer: Option<Option<stripe_types::Expandable<stripe_shared::Customer>>>,
186 customer_account: Option<Option<String>>,
187 description: Option<Option<String>>,
188 excluded_payment_method_types:
189 Option<Option<Vec<stripe_shared::PaymentIntentExcludedPaymentMethodTypes>>>,
190 hooks: Option<Option<stripe_shared::PaymentFlowsPaymentIntentAsyncWorkflows>>,
191 id: Option<stripe_shared::PaymentIntentId>,
192 last_payment_error: Option<Option<Box<stripe_shared::ApiErrors>>>,
193 latest_charge: Option<Option<stripe_types::Expandable<stripe_shared::Charge>>>,
194 livemode: Option<bool>,
195 managed_payments: Option<Option<stripe_shared::SmorResourceManagedPayments>>,
196 metadata: Option<std::collections::HashMap<String, String>>,
197 next_action: Option<Option<stripe_shared::PaymentIntentNextAction>>,
198 on_behalf_of: Option<Option<stripe_types::Expandable<stripe_shared::Account>>>,
199 payment_details: Option<Option<stripe_shared::PaymentFlowsPaymentDetails>>,
200 payment_method: Option<Option<stripe_types::Expandable<stripe_shared::PaymentMethod>>>,
201 payment_method_configuration_details:
202 Option<Option<stripe_shared::PaymentMethodConfigBizPaymentMethodConfigurationDetails>>,
203 payment_method_options: Option<Option<stripe_shared::PaymentIntentPaymentMethodOptions>>,
204 payment_method_types: Option<Vec<String>>,
205 presentment_details: Option<Option<stripe_shared::PaymentFlowsPaymentIntentPresentmentDetails>>,
206 processing: Option<Option<stripe_shared::PaymentIntentProcessing>>,
207 receipt_email: Option<Option<String>>,
208 review: Option<Option<stripe_types::Expandable<stripe_shared::Review>>>,
209 setup_future_usage: Option<Option<stripe_shared::PaymentIntentSetupFutureUsage>>,
210 shipping: Option<Option<stripe_shared::Shipping>>,
211 source: Option<Option<stripe_types::Expandable<stripe_shared::PaymentSource>>>,
212 statement_descriptor: Option<Option<String>>,
213 statement_descriptor_suffix: Option<Option<String>>,
214 status: Option<PaymentIntentStatus>,
215 transfer_data: Option<Option<stripe_shared::TransferData>>,
216 transfer_group: Option<Option<String>>,
217}
218
219#[allow(
220 unused_variables,
221 irrefutable_let_patterns,
222 clippy::let_unit_value,
223 clippy::match_single_binding,
224 clippy::single_match
225)]
226const _: () = {
227 use miniserde::de::{Map, Visitor};
228 use miniserde::json::Value;
229 use miniserde::{Deserialize, Result, make_place};
230 use stripe_types::miniserde_helpers::FromValueOpt;
231 use stripe_types::{MapBuilder, ObjectDeser};
232
233 make_place!(Place);
234
235 impl Deserialize for PaymentIntent {
236 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
237 Place::new(out)
238 }
239 }
240
241 struct Builder<'a> {
242 out: &'a mut Option<PaymentIntent>,
243 builder: PaymentIntentBuilder,
244 }
245
246 impl Visitor for Place<PaymentIntent> {
247 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
248 Ok(Box::new(Builder {
249 out: &mut self.out,
250 builder: PaymentIntentBuilder::deser_default(),
251 }))
252 }
253 }
254
255 impl MapBuilder for PaymentIntentBuilder {
256 type Out = PaymentIntent;
257 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
258 Ok(match k {
259 "allowed_payment_method_types" => {
260 Deserialize::begin(&mut self.allowed_payment_method_types)
261 }
262 "amount" => Deserialize::begin(&mut self.amount),
263 "amount_capturable" => Deserialize::begin(&mut self.amount_capturable),
264 "amount_details" => Deserialize::begin(&mut self.amount_details),
265 "amount_received" => Deserialize::begin(&mut self.amount_received),
266 "application" => Deserialize::begin(&mut self.application),
267 "application_fee_amount" => Deserialize::begin(&mut self.application_fee_amount),
268 "automatic_payment_methods" => {
269 Deserialize::begin(&mut self.automatic_payment_methods)
270 }
271 "canceled_at" => Deserialize::begin(&mut self.canceled_at),
272 "cancellation_reason" => Deserialize::begin(&mut self.cancellation_reason),
273 "capture_method" => Deserialize::begin(&mut self.capture_method),
274 "client_secret" => Deserialize::begin(&mut self.client_secret),
275 "confirmation_method" => Deserialize::begin(&mut self.confirmation_method),
276 "created" => Deserialize::begin(&mut self.created),
277 "currency" => Deserialize::begin(&mut self.currency),
278 "customer" => Deserialize::begin(&mut self.customer),
279 "customer_account" => Deserialize::begin(&mut self.customer_account),
280 "description" => Deserialize::begin(&mut self.description),
281 "excluded_payment_method_types" => {
282 Deserialize::begin(&mut self.excluded_payment_method_types)
283 }
284 "hooks" => Deserialize::begin(&mut self.hooks),
285 "id" => Deserialize::begin(&mut self.id),
286 "last_payment_error" => Deserialize::begin(&mut self.last_payment_error),
287 "latest_charge" => Deserialize::begin(&mut self.latest_charge),
288 "livemode" => Deserialize::begin(&mut self.livemode),
289 "managed_payments" => Deserialize::begin(&mut self.managed_payments),
290 "metadata" => Deserialize::begin(&mut self.metadata),
291 "next_action" => Deserialize::begin(&mut self.next_action),
292 "on_behalf_of" => Deserialize::begin(&mut self.on_behalf_of),
293 "payment_details" => Deserialize::begin(&mut self.payment_details),
294 "payment_method" => Deserialize::begin(&mut self.payment_method),
295 "payment_method_configuration_details" => {
296 Deserialize::begin(&mut self.payment_method_configuration_details)
297 }
298 "payment_method_options" => Deserialize::begin(&mut self.payment_method_options),
299 "payment_method_types" => Deserialize::begin(&mut self.payment_method_types),
300 "presentment_details" => Deserialize::begin(&mut self.presentment_details),
301 "processing" => Deserialize::begin(&mut self.processing),
302 "receipt_email" => Deserialize::begin(&mut self.receipt_email),
303 "review" => Deserialize::begin(&mut self.review),
304 "setup_future_usage" => Deserialize::begin(&mut self.setup_future_usage),
305 "shipping" => Deserialize::begin(&mut self.shipping),
306 "source" => Deserialize::begin(&mut self.source),
307 "statement_descriptor" => Deserialize::begin(&mut self.statement_descriptor),
308 "statement_descriptor_suffix" => {
309 Deserialize::begin(&mut self.statement_descriptor_suffix)
310 }
311 "status" => Deserialize::begin(&mut self.status),
312 "transfer_data" => Deserialize::begin(&mut self.transfer_data),
313 "transfer_group" => Deserialize::begin(&mut self.transfer_group),
314 _ => <dyn Visitor>::ignore(),
315 })
316 }
317
318 fn deser_default() -> Self {
319 Self {
320 allowed_payment_method_types: Some(None),
321 amount: None,
322 amount_capturable: None,
323 amount_details: Some(None),
324 amount_received: None,
325 application: Some(None),
326 application_fee_amount: Some(None),
327 automatic_payment_methods: Some(None),
328 canceled_at: Some(None),
329 cancellation_reason: Some(None),
330 capture_method: None,
331 client_secret: Some(None),
332 confirmation_method: None,
333 created: None,
334 currency: None,
335 customer: Some(None),
336 customer_account: Some(None),
337 description: Some(None),
338 excluded_payment_method_types: Some(None),
339 hooks: Some(None),
340 id: None,
341 last_payment_error: Some(None),
342 latest_charge: Some(None),
343 livemode: None,
344 managed_payments: Some(None),
345 metadata: None,
346 next_action: Some(None),
347 on_behalf_of: Some(None),
348 payment_details: Some(None),
349 payment_method: Some(None),
350 payment_method_configuration_details: Some(None),
351 payment_method_options: Some(None),
352 payment_method_types: None,
353 presentment_details: Some(None),
354 processing: Some(None),
355 receipt_email: Some(None),
356 review: Some(None),
357 setup_future_usage: Some(None),
358 shipping: Some(None),
359 source: Some(None),
360 statement_descriptor: Some(None),
361 statement_descriptor_suffix: Some(None),
362 status: None,
363 transfer_data: Some(None),
364 transfer_group: Some(None),
365 }
366 }
367
368 fn take_out(&mut self) -> Option<Self::Out> {
369 let (
370 Some(allowed_payment_method_types),
371 Some(amount),
372 Some(amount_capturable),
373 Some(amount_details),
374 Some(amount_received),
375 Some(application),
376 Some(application_fee_amount),
377 Some(automatic_payment_methods),
378 Some(canceled_at),
379 Some(cancellation_reason),
380 Some(capture_method),
381 Some(client_secret),
382 Some(confirmation_method),
383 Some(created),
384 Some(currency),
385 Some(customer),
386 Some(customer_account),
387 Some(description),
388 Some(excluded_payment_method_types),
389 Some(hooks),
390 Some(id),
391 Some(last_payment_error),
392 Some(latest_charge),
393 Some(livemode),
394 Some(managed_payments),
395 Some(metadata),
396 Some(next_action),
397 Some(on_behalf_of),
398 Some(payment_details),
399 Some(payment_method),
400 Some(payment_method_configuration_details),
401 Some(payment_method_options),
402 Some(payment_method_types),
403 Some(presentment_details),
404 Some(processing),
405 Some(receipt_email),
406 Some(review),
407 Some(setup_future_usage),
408 Some(shipping),
409 Some(source),
410 Some(statement_descriptor),
411 Some(statement_descriptor_suffix),
412 Some(status),
413 Some(transfer_data),
414 Some(transfer_group),
415 ) = (
416 self.allowed_payment_method_types.take(),
417 self.amount,
418 self.amount_capturable,
419 self.amount_details.take(),
420 self.amount_received,
421 self.application.take(),
422 self.application_fee_amount,
423 self.automatic_payment_methods.take(),
424 self.canceled_at,
425 self.cancellation_reason.take(),
426 self.capture_method.take(),
427 self.client_secret.take(),
428 self.confirmation_method.take(),
429 self.created,
430 self.currency.take(),
431 self.customer.take(),
432 self.customer_account.take(),
433 self.description.take(),
434 self.excluded_payment_method_types.take(),
435 self.hooks.take(),
436 self.id.take(),
437 self.last_payment_error.take(),
438 self.latest_charge.take(),
439 self.livemode,
440 self.managed_payments,
441 self.metadata.take(),
442 self.next_action.take(),
443 self.on_behalf_of.take(),
444 self.payment_details.take(),
445 self.payment_method.take(),
446 self.payment_method_configuration_details.take(),
447 self.payment_method_options.take(),
448 self.payment_method_types.take(),
449 self.presentment_details.take(),
450 self.processing.take(),
451 self.receipt_email.take(),
452 self.review.take(),
453 self.setup_future_usage.take(),
454 self.shipping.take(),
455 self.source.take(),
456 self.statement_descriptor.take(),
457 self.statement_descriptor_suffix.take(),
458 self.status.take(),
459 self.transfer_data.take(),
460 self.transfer_group.take(),
461 )
462 else {
463 return None;
464 };
465 Some(Self::Out {
466 allowed_payment_method_types,
467 amount,
468 amount_capturable,
469 amount_details,
470 amount_received,
471 application,
472 application_fee_amount,
473 automatic_payment_methods,
474 canceled_at,
475 cancellation_reason,
476 capture_method,
477 client_secret,
478 confirmation_method,
479 created,
480 currency,
481 customer,
482 customer_account,
483 description,
484 excluded_payment_method_types,
485 hooks,
486 id,
487 last_payment_error,
488 latest_charge,
489 livemode,
490 managed_payments,
491 metadata,
492 next_action,
493 on_behalf_of,
494 payment_details,
495 payment_method,
496 payment_method_configuration_details,
497 payment_method_options,
498 payment_method_types,
499 presentment_details,
500 processing,
501 receipt_email,
502 review,
503 setup_future_usage,
504 shipping,
505 source,
506 statement_descriptor,
507 statement_descriptor_suffix,
508 status,
509 transfer_data,
510 transfer_group,
511 })
512 }
513 }
514
515 impl Map for Builder<'_> {
516 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
517 self.builder.key(k)
518 }
519
520 fn finish(&mut self) -> Result<()> {
521 *self.out = self.builder.take_out();
522 Ok(())
523 }
524 }
525
526 impl ObjectDeser for PaymentIntent {
527 type Builder = PaymentIntentBuilder;
528 }
529
530 impl FromValueOpt for PaymentIntent {
531 fn from_value(v: Value) -> Option<Self> {
532 let Value::Object(obj) = v else {
533 return None;
534 };
535 let mut b = PaymentIntentBuilder::deser_default();
536 for (k, v) in obj {
537 match k.as_str() {
538 "allowed_payment_method_types" => {
539 b.allowed_payment_method_types = FromValueOpt::from_value(v)
540 }
541 "amount" => b.amount = FromValueOpt::from_value(v),
542 "amount_capturable" => b.amount_capturable = FromValueOpt::from_value(v),
543 "amount_details" => b.amount_details = FromValueOpt::from_value(v),
544 "amount_received" => b.amount_received = FromValueOpt::from_value(v),
545 "application" => b.application = FromValueOpt::from_value(v),
546 "application_fee_amount" => {
547 b.application_fee_amount = FromValueOpt::from_value(v)
548 }
549 "automatic_payment_methods" => {
550 b.automatic_payment_methods = FromValueOpt::from_value(v)
551 }
552 "canceled_at" => b.canceled_at = FromValueOpt::from_value(v),
553 "cancellation_reason" => b.cancellation_reason = FromValueOpt::from_value(v),
554 "capture_method" => b.capture_method = FromValueOpt::from_value(v),
555 "client_secret" => b.client_secret = FromValueOpt::from_value(v),
556 "confirmation_method" => b.confirmation_method = FromValueOpt::from_value(v),
557 "created" => b.created = FromValueOpt::from_value(v),
558 "currency" => b.currency = FromValueOpt::from_value(v),
559 "customer" => b.customer = FromValueOpt::from_value(v),
560 "customer_account" => b.customer_account = FromValueOpt::from_value(v),
561 "description" => b.description = FromValueOpt::from_value(v),
562 "excluded_payment_method_types" => {
563 b.excluded_payment_method_types = FromValueOpt::from_value(v)
564 }
565 "hooks" => b.hooks = FromValueOpt::from_value(v),
566 "id" => b.id = FromValueOpt::from_value(v),
567 "last_payment_error" => b.last_payment_error = FromValueOpt::from_value(v),
568 "latest_charge" => b.latest_charge = FromValueOpt::from_value(v),
569 "livemode" => b.livemode = FromValueOpt::from_value(v),
570 "managed_payments" => b.managed_payments = FromValueOpt::from_value(v),
571 "metadata" => b.metadata = FromValueOpt::from_value(v),
572 "next_action" => b.next_action = FromValueOpt::from_value(v),
573 "on_behalf_of" => b.on_behalf_of = FromValueOpt::from_value(v),
574 "payment_details" => b.payment_details = FromValueOpt::from_value(v),
575 "payment_method" => b.payment_method = FromValueOpt::from_value(v),
576 "payment_method_configuration_details" => {
577 b.payment_method_configuration_details = FromValueOpt::from_value(v)
578 }
579 "payment_method_options" => {
580 b.payment_method_options = FromValueOpt::from_value(v)
581 }
582 "payment_method_types" => b.payment_method_types = FromValueOpt::from_value(v),
583 "presentment_details" => b.presentment_details = FromValueOpt::from_value(v),
584 "processing" => b.processing = FromValueOpt::from_value(v),
585 "receipt_email" => b.receipt_email = FromValueOpt::from_value(v),
586 "review" => b.review = FromValueOpt::from_value(v),
587 "setup_future_usage" => b.setup_future_usage = FromValueOpt::from_value(v),
588 "shipping" => b.shipping = FromValueOpt::from_value(v),
589 "source" => b.source = FromValueOpt::from_value(v),
590 "statement_descriptor" => b.statement_descriptor = FromValueOpt::from_value(v),
591 "statement_descriptor_suffix" => {
592 b.statement_descriptor_suffix = FromValueOpt::from_value(v)
593 }
594 "status" => b.status = FromValueOpt::from_value(v),
595 "transfer_data" => b.transfer_data = FromValueOpt::from_value(v),
596 "transfer_group" => b.transfer_group = FromValueOpt::from_value(v),
597 _ => {}
598 }
599 }
600 b.take_out()
601 }
602 }
603};
604#[cfg(feature = "serialize")]
605impl serde::Serialize for PaymentIntent {
606 fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
607 use serde::ser::SerializeStruct;
608 let mut s = s.serialize_struct("PaymentIntent", 46)?;
609 s.serialize_field("allowed_payment_method_types", &self.allowed_payment_method_types)?;
610 s.serialize_field("amount", &self.amount)?;
611 s.serialize_field("amount_capturable", &self.amount_capturable)?;
612 s.serialize_field("amount_details", &self.amount_details)?;
613 s.serialize_field("amount_received", &self.amount_received)?;
614 s.serialize_field("application", &self.application)?;
615 s.serialize_field("application_fee_amount", &self.application_fee_amount)?;
616 s.serialize_field("automatic_payment_methods", &self.automatic_payment_methods)?;
617 s.serialize_field("canceled_at", &self.canceled_at)?;
618 s.serialize_field("cancellation_reason", &self.cancellation_reason)?;
619 s.serialize_field("capture_method", &self.capture_method)?;
620 s.serialize_field("client_secret", &self.client_secret)?;
621 s.serialize_field("confirmation_method", &self.confirmation_method)?;
622 s.serialize_field("created", &self.created)?;
623 s.serialize_field("currency", &self.currency)?;
624 s.serialize_field("customer", &self.customer)?;
625 s.serialize_field("customer_account", &self.customer_account)?;
626 s.serialize_field("description", &self.description)?;
627 s.serialize_field("excluded_payment_method_types", &self.excluded_payment_method_types)?;
628 s.serialize_field("hooks", &self.hooks)?;
629 s.serialize_field("id", &self.id)?;
630 s.serialize_field("last_payment_error", &self.last_payment_error)?;
631 s.serialize_field("latest_charge", &self.latest_charge)?;
632 s.serialize_field("livemode", &self.livemode)?;
633 s.serialize_field("managed_payments", &self.managed_payments)?;
634 s.serialize_field("metadata", &self.metadata)?;
635 s.serialize_field("next_action", &self.next_action)?;
636 s.serialize_field("on_behalf_of", &self.on_behalf_of)?;
637 s.serialize_field("payment_details", &self.payment_details)?;
638 s.serialize_field("payment_method", &self.payment_method)?;
639 s.serialize_field(
640 "payment_method_configuration_details",
641 &self.payment_method_configuration_details,
642 )?;
643 s.serialize_field("payment_method_options", &self.payment_method_options)?;
644 s.serialize_field("payment_method_types", &self.payment_method_types)?;
645 s.serialize_field("presentment_details", &self.presentment_details)?;
646 s.serialize_field("processing", &self.processing)?;
647 s.serialize_field("receipt_email", &self.receipt_email)?;
648 s.serialize_field("review", &self.review)?;
649 s.serialize_field("setup_future_usage", &self.setup_future_usage)?;
650 s.serialize_field("shipping", &self.shipping)?;
651 s.serialize_field("source", &self.source)?;
652 s.serialize_field("statement_descriptor", &self.statement_descriptor)?;
653 s.serialize_field("statement_descriptor_suffix", &self.statement_descriptor_suffix)?;
654 s.serialize_field("status", &self.status)?;
655 s.serialize_field("transfer_data", &self.transfer_data)?;
656 s.serialize_field("transfer_group", &self.transfer_group)?;
657
658 s.serialize_field("object", "payment_intent")?;
659 s.end()
660 }
661}
662#[derive(Clone, Eq, PartialEq)]
664#[non_exhaustive]
665pub enum PaymentIntentCancellationReason {
666 Abandoned,
667 Automatic,
668 Duplicate,
669 Expired,
670 FailedInvoice,
671 Fraudulent,
672 RequestedByCustomer,
673 VoidInvoice,
674 Unknown(String),
676}
677impl PaymentIntentCancellationReason {
678 pub fn as_str(&self) -> &str {
679 use PaymentIntentCancellationReason::*;
680 match self {
681 Abandoned => "abandoned",
682 Automatic => "automatic",
683 Duplicate => "duplicate",
684 Expired => "expired",
685 FailedInvoice => "failed_invoice",
686 Fraudulent => "fraudulent",
687 RequestedByCustomer => "requested_by_customer",
688 VoidInvoice => "void_invoice",
689 Unknown(v) => v,
690 }
691 }
692}
693
694impl std::str::FromStr for PaymentIntentCancellationReason {
695 type Err = std::convert::Infallible;
696 fn from_str(s: &str) -> Result<Self, Self::Err> {
697 use PaymentIntentCancellationReason::*;
698 match s {
699 "abandoned" => Ok(Abandoned),
700 "automatic" => Ok(Automatic),
701 "duplicate" => Ok(Duplicate),
702 "expired" => Ok(Expired),
703 "failed_invoice" => Ok(FailedInvoice),
704 "fraudulent" => Ok(Fraudulent),
705 "requested_by_customer" => Ok(RequestedByCustomer),
706 "void_invoice" => Ok(VoidInvoice),
707 v => {
708 tracing::warn!(
709 "Unknown value '{}' for enum '{}'",
710 v,
711 "PaymentIntentCancellationReason"
712 );
713 Ok(Unknown(v.to_owned()))
714 }
715 }
716 }
717}
718impl std::fmt::Display for PaymentIntentCancellationReason {
719 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
720 f.write_str(self.as_str())
721 }
722}
723
724#[cfg(not(feature = "redact-generated-debug"))]
725impl std::fmt::Debug for PaymentIntentCancellationReason {
726 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
727 f.write_str(self.as_str())
728 }
729}
730#[cfg(feature = "redact-generated-debug")]
731impl std::fmt::Debug for PaymentIntentCancellationReason {
732 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
733 f.debug_struct(stringify!(PaymentIntentCancellationReason)).finish_non_exhaustive()
734 }
735}
736#[cfg(feature = "serialize")]
737impl serde::Serialize for PaymentIntentCancellationReason {
738 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
739 where
740 S: serde::Serializer,
741 {
742 serializer.serialize_str(self.as_str())
743 }
744}
745impl miniserde::Deserialize for PaymentIntentCancellationReason {
746 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
747 crate::Place::new(out)
748 }
749}
750
751impl miniserde::de::Visitor for crate::Place<PaymentIntentCancellationReason> {
752 fn string(&mut self, s: &str) -> miniserde::Result<()> {
753 use std::str::FromStr;
754 self.out = Some(PaymentIntentCancellationReason::from_str(s).expect("infallible"));
755 Ok(())
756 }
757}
758
759stripe_types::impl_from_val_with_from_str!(PaymentIntentCancellationReason);
760#[cfg(feature = "deserialize")]
761impl<'de> serde::Deserialize<'de> for PaymentIntentCancellationReason {
762 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
763 use std::str::FromStr;
764 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
765 Ok(Self::from_str(&s).expect("infallible"))
766 }
767}
768#[derive(Clone, Eq, PartialEq)]
771#[non_exhaustive]
772pub enum PaymentIntentStatus {
773 Canceled,
774 Processing,
775 RequiresAction,
776 RequiresCapture,
777 RequiresConfirmation,
778 RequiresPaymentMethod,
779 Succeeded,
780 Unknown(String),
782}
783impl PaymentIntentStatus {
784 pub fn as_str(&self) -> &str {
785 use PaymentIntentStatus::*;
786 match self {
787 Canceled => "canceled",
788 Processing => "processing",
789 RequiresAction => "requires_action",
790 RequiresCapture => "requires_capture",
791 RequiresConfirmation => "requires_confirmation",
792 RequiresPaymentMethod => "requires_payment_method",
793 Succeeded => "succeeded",
794 Unknown(v) => v,
795 }
796 }
797}
798
799impl std::str::FromStr for PaymentIntentStatus {
800 type Err = std::convert::Infallible;
801 fn from_str(s: &str) -> Result<Self, Self::Err> {
802 use PaymentIntentStatus::*;
803 match s {
804 "canceled" => Ok(Canceled),
805 "processing" => Ok(Processing),
806 "requires_action" => Ok(RequiresAction),
807 "requires_capture" => Ok(RequiresCapture),
808 "requires_confirmation" => Ok(RequiresConfirmation),
809 "requires_payment_method" => Ok(RequiresPaymentMethod),
810 "succeeded" => Ok(Succeeded),
811 v => {
812 tracing::warn!("Unknown value '{}' for enum '{}'", v, "PaymentIntentStatus");
813 Ok(Unknown(v.to_owned()))
814 }
815 }
816 }
817}
818impl std::fmt::Display for PaymentIntentStatus {
819 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
820 f.write_str(self.as_str())
821 }
822}
823
824#[cfg(not(feature = "redact-generated-debug"))]
825impl std::fmt::Debug for PaymentIntentStatus {
826 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
827 f.write_str(self.as_str())
828 }
829}
830#[cfg(feature = "redact-generated-debug")]
831impl std::fmt::Debug for PaymentIntentStatus {
832 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
833 f.debug_struct(stringify!(PaymentIntentStatus)).finish_non_exhaustive()
834 }
835}
836#[cfg(feature = "serialize")]
837impl serde::Serialize for PaymentIntentStatus {
838 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
839 where
840 S: serde::Serializer,
841 {
842 serializer.serialize_str(self.as_str())
843 }
844}
845impl miniserde::Deserialize for PaymentIntentStatus {
846 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
847 crate::Place::new(out)
848 }
849}
850
851impl miniserde::de::Visitor for crate::Place<PaymentIntentStatus> {
852 fn string(&mut self, s: &str) -> miniserde::Result<()> {
853 use std::str::FromStr;
854 self.out = Some(PaymentIntentStatus::from_str(s).expect("infallible"));
855 Ok(())
856 }
857}
858
859stripe_types::impl_from_val_with_from_str!(PaymentIntentStatus);
860#[cfg(feature = "deserialize")]
861impl<'de> serde::Deserialize<'de> for PaymentIntentStatus {
862 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
863 use std::str::FromStr;
864 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
865 Ok(Self::from_str(&s).expect("infallible"))
866 }
867}
868impl stripe_types::Object for PaymentIntent {
869 type Id = stripe_shared::PaymentIntentId;
870 fn id(&self) -> &Self::Id {
871 &self.id
872 }
873
874 fn into_id(self) -> Self::Id {
875 self.id
876 }
877}
878stripe_types::def_id!(PaymentIntentId);
879#[derive(Clone, Eq, PartialEq)]
880#[non_exhaustive]
881pub enum PaymentIntentAllowedPaymentMethodTypes {
882 AcssDebit,
883 Affirm,
884 AfterpayClearpay,
885 Alipay,
886 Alma,
887 AmazonPay,
888 AuBecsDebit,
889 BacsDebit,
890 Bancontact,
891 Billie,
892 Bizum,
893 Blik,
894 BokuPromptpay,
895 Boleto,
896 CapchasePay,
897 Card,
898 Cashapp,
899 CheckScan,
900 ClickToPay,
901 Crypto,
902 CustomerBalance,
903 DemoPay,
904 Duitnow,
905 DummyAuthPush,
906 DummyPassthroughCard,
907 Edenred,
908 Eps,
909 Fpx,
910 Gcash,
911 Getbalance,
912 GiftCard,
913 Giropay,
914 Gopay,
915 Grabpay,
916 IdBankTransfer,
917 Ideal,
918 KakaoPay,
919 Klarna,
920 Knet,
921 Konbini,
922 KrCard,
923 KrMarket,
924 Kriya,
925 Link,
926 MbWay,
927 Mobilepay,
928 Momo,
929 Mondu,
930 Multibanco,
931 NaverPay,
932 Netbanking,
933 NgBank,
934 NgBankTransfer,
935 NgCard,
936 NgMarket,
937 NgUssd,
938 NgWallet,
939 NzBankAccount,
940 Octopus,
941 Oxxo,
942 P24,
943 PaperCheck,
944 PayByBank,
945 Payco,
946 Paynow,
947 Paypal,
948 Paypay,
949 Payto,
950 Pix,
951 Promptpay,
952 Qris,
953 Rechnung,
954 RevolutPay,
955 SamsungPay,
956 Satispay,
957 Scalapay,
958 SepaDebit,
959 Sequra,
960 ShopPay,
961 Shopeepay,
962 Sofort,
963 SouthKoreaMarket,
964 StripeBalance,
965 Sunbit,
966 Swish,
967 Tamara,
968 TestPay,
969 Truemoney,
970 Twint,
971 Upi,
972 UsBankAccount,
973 UsCashVoucher,
974 Vipps,
975 WechatPay,
976 Wero,
977 Zip,
978 Unknown(String),
980}
981impl PaymentIntentAllowedPaymentMethodTypes {
982 pub fn as_str(&self) -> &str {
983 use PaymentIntentAllowedPaymentMethodTypes::*;
984 match self {
985 AcssDebit => "acss_debit",
986 Affirm => "affirm",
987 AfterpayClearpay => "afterpay_clearpay",
988 Alipay => "alipay",
989 Alma => "alma",
990 AmazonPay => "amazon_pay",
991 AuBecsDebit => "au_becs_debit",
992 BacsDebit => "bacs_debit",
993 Bancontact => "bancontact",
994 Billie => "billie",
995 Bizum => "bizum",
996 Blik => "blik",
997 BokuPromptpay => "boku_promptpay",
998 Boleto => "boleto",
999 CapchasePay => "capchase_pay",
1000 Card => "card",
1001 Cashapp => "cashapp",
1002 CheckScan => "check_scan",
1003 ClickToPay => "click_to_pay",
1004 Crypto => "crypto",
1005 CustomerBalance => "customer_balance",
1006 DemoPay => "demo_pay",
1007 Duitnow => "duitnow",
1008 DummyAuthPush => "dummy_auth_push",
1009 DummyPassthroughCard => "dummy_passthrough_card",
1010 Edenred => "edenred",
1011 Eps => "eps",
1012 Fpx => "fpx",
1013 Gcash => "gcash",
1014 Getbalance => "getbalance",
1015 GiftCard => "gift_card",
1016 Giropay => "giropay",
1017 Gopay => "gopay",
1018 Grabpay => "grabpay",
1019 IdBankTransfer => "id_bank_transfer",
1020 Ideal => "ideal",
1021 KakaoPay => "kakao_pay",
1022 Klarna => "klarna",
1023 Knet => "knet",
1024 Konbini => "konbini",
1025 KrCard => "kr_card",
1026 KrMarket => "kr_market",
1027 Kriya => "kriya",
1028 Link => "link",
1029 MbWay => "mb_way",
1030 Mobilepay => "mobilepay",
1031 Momo => "momo",
1032 Mondu => "mondu",
1033 Multibanco => "multibanco",
1034 NaverPay => "naver_pay",
1035 Netbanking => "netbanking",
1036 NgBank => "ng_bank",
1037 NgBankTransfer => "ng_bank_transfer",
1038 NgCard => "ng_card",
1039 NgMarket => "ng_market",
1040 NgUssd => "ng_ussd",
1041 NgWallet => "ng_wallet",
1042 NzBankAccount => "nz_bank_account",
1043 Octopus => "octopus",
1044 Oxxo => "oxxo",
1045 P24 => "p24",
1046 PaperCheck => "paper_check",
1047 PayByBank => "pay_by_bank",
1048 Payco => "payco",
1049 Paynow => "paynow",
1050 Paypal => "paypal",
1051 Paypay => "paypay",
1052 Payto => "payto",
1053 Pix => "pix",
1054 Promptpay => "promptpay",
1055 Qris => "qris",
1056 Rechnung => "rechnung",
1057 RevolutPay => "revolut_pay",
1058 SamsungPay => "samsung_pay",
1059 Satispay => "satispay",
1060 Scalapay => "scalapay",
1061 SepaDebit => "sepa_debit",
1062 Sequra => "sequra",
1063 ShopPay => "shop_pay",
1064 Shopeepay => "shopeepay",
1065 Sofort => "sofort",
1066 SouthKoreaMarket => "south_korea_market",
1067 StripeBalance => "stripe_balance",
1068 Sunbit => "sunbit",
1069 Swish => "swish",
1070 Tamara => "tamara",
1071 TestPay => "test_pay",
1072 Truemoney => "truemoney",
1073 Twint => "twint",
1074 Upi => "upi",
1075 UsBankAccount => "us_bank_account",
1076 UsCashVoucher => "us_cash_voucher",
1077 Vipps => "vipps",
1078 WechatPay => "wechat_pay",
1079 Wero => "wero",
1080 Zip => "zip",
1081 Unknown(v) => v,
1082 }
1083 }
1084}
1085
1086impl std::str::FromStr for PaymentIntentAllowedPaymentMethodTypes {
1087 type Err = std::convert::Infallible;
1088 fn from_str(s: &str) -> Result<Self, Self::Err> {
1089 use PaymentIntentAllowedPaymentMethodTypes::*;
1090 match s {
1091 "acss_debit" => Ok(AcssDebit),
1092 "affirm" => Ok(Affirm),
1093 "afterpay_clearpay" => Ok(AfterpayClearpay),
1094 "alipay" => Ok(Alipay),
1095 "alma" => Ok(Alma),
1096 "amazon_pay" => Ok(AmazonPay),
1097 "au_becs_debit" => Ok(AuBecsDebit),
1098 "bacs_debit" => Ok(BacsDebit),
1099 "bancontact" => Ok(Bancontact),
1100 "billie" => Ok(Billie),
1101 "bizum" => Ok(Bizum),
1102 "blik" => Ok(Blik),
1103 "boku_promptpay" => Ok(BokuPromptpay),
1104 "boleto" => Ok(Boleto),
1105 "capchase_pay" => Ok(CapchasePay),
1106 "card" => Ok(Card),
1107 "cashapp" => Ok(Cashapp),
1108 "check_scan" => Ok(CheckScan),
1109 "click_to_pay" => Ok(ClickToPay),
1110 "crypto" => Ok(Crypto),
1111 "customer_balance" => Ok(CustomerBalance),
1112 "demo_pay" => Ok(DemoPay),
1113 "duitnow" => Ok(Duitnow),
1114 "dummy_auth_push" => Ok(DummyAuthPush),
1115 "dummy_passthrough_card" => Ok(DummyPassthroughCard),
1116 "edenred" => Ok(Edenred),
1117 "eps" => Ok(Eps),
1118 "fpx" => Ok(Fpx),
1119 "gcash" => Ok(Gcash),
1120 "getbalance" => Ok(Getbalance),
1121 "gift_card" => Ok(GiftCard),
1122 "giropay" => Ok(Giropay),
1123 "gopay" => Ok(Gopay),
1124 "grabpay" => Ok(Grabpay),
1125 "id_bank_transfer" => Ok(IdBankTransfer),
1126 "ideal" => Ok(Ideal),
1127 "kakao_pay" => Ok(KakaoPay),
1128 "klarna" => Ok(Klarna),
1129 "knet" => Ok(Knet),
1130 "konbini" => Ok(Konbini),
1131 "kr_card" => Ok(KrCard),
1132 "kr_market" => Ok(KrMarket),
1133 "kriya" => Ok(Kriya),
1134 "link" => Ok(Link),
1135 "mb_way" => Ok(MbWay),
1136 "mobilepay" => Ok(Mobilepay),
1137 "momo" => Ok(Momo),
1138 "mondu" => Ok(Mondu),
1139 "multibanco" => Ok(Multibanco),
1140 "naver_pay" => Ok(NaverPay),
1141 "netbanking" => Ok(Netbanking),
1142 "ng_bank" => Ok(NgBank),
1143 "ng_bank_transfer" => Ok(NgBankTransfer),
1144 "ng_card" => Ok(NgCard),
1145 "ng_market" => Ok(NgMarket),
1146 "ng_ussd" => Ok(NgUssd),
1147 "ng_wallet" => Ok(NgWallet),
1148 "nz_bank_account" => Ok(NzBankAccount),
1149 "octopus" => Ok(Octopus),
1150 "oxxo" => Ok(Oxxo),
1151 "p24" => Ok(P24),
1152 "paper_check" => Ok(PaperCheck),
1153 "pay_by_bank" => Ok(PayByBank),
1154 "payco" => Ok(Payco),
1155 "paynow" => Ok(Paynow),
1156 "paypal" => Ok(Paypal),
1157 "paypay" => Ok(Paypay),
1158 "payto" => Ok(Payto),
1159 "pix" => Ok(Pix),
1160 "promptpay" => Ok(Promptpay),
1161 "qris" => Ok(Qris),
1162 "rechnung" => Ok(Rechnung),
1163 "revolut_pay" => Ok(RevolutPay),
1164 "samsung_pay" => Ok(SamsungPay),
1165 "satispay" => Ok(Satispay),
1166 "scalapay" => Ok(Scalapay),
1167 "sepa_debit" => Ok(SepaDebit),
1168 "sequra" => Ok(Sequra),
1169 "shop_pay" => Ok(ShopPay),
1170 "shopeepay" => Ok(Shopeepay),
1171 "sofort" => Ok(Sofort),
1172 "south_korea_market" => Ok(SouthKoreaMarket),
1173 "stripe_balance" => Ok(StripeBalance),
1174 "sunbit" => Ok(Sunbit),
1175 "swish" => Ok(Swish),
1176 "tamara" => Ok(Tamara),
1177 "test_pay" => Ok(TestPay),
1178 "truemoney" => Ok(Truemoney),
1179 "twint" => Ok(Twint),
1180 "upi" => Ok(Upi),
1181 "us_bank_account" => Ok(UsBankAccount),
1182 "us_cash_voucher" => Ok(UsCashVoucher),
1183 "vipps" => Ok(Vipps),
1184 "wechat_pay" => Ok(WechatPay),
1185 "wero" => Ok(Wero),
1186 "zip" => Ok(Zip),
1187 v => {
1188 tracing::warn!(
1189 "Unknown value '{}' for enum '{}'",
1190 v,
1191 "PaymentIntentAllowedPaymentMethodTypes"
1192 );
1193 Ok(Unknown(v.to_owned()))
1194 }
1195 }
1196 }
1197}
1198impl std::fmt::Display for PaymentIntentAllowedPaymentMethodTypes {
1199 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1200 f.write_str(self.as_str())
1201 }
1202}
1203
1204#[cfg(not(feature = "redact-generated-debug"))]
1205impl std::fmt::Debug for PaymentIntentAllowedPaymentMethodTypes {
1206 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1207 f.write_str(self.as_str())
1208 }
1209}
1210#[cfg(feature = "redact-generated-debug")]
1211impl std::fmt::Debug for PaymentIntentAllowedPaymentMethodTypes {
1212 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1213 f.debug_struct(stringify!(PaymentIntentAllowedPaymentMethodTypes)).finish_non_exhaustive()
1214 }
1215}
1216impl serde::Serialize for PaymentIntentAllowedPaymentMethodTypes {
1217 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1218 where
1219 S: serde::Serializer,
1220 {
1221 serializer.serialize_str(self.as_str())
1222 }
1223}
1224impl miniserde::Deserialize for PaymentIntentAllowedPaymentMethodTypes {
1225 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1226 crate::Place::new(out)
1227 }
1228}
1229
1230impl miniserde::de::Visitor for crate::Place<PaymentIntentAllowedPaymentMethodTypes> {
1231 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1232 use std::str::FromStr;
1233 self.out = Some(PaymentIntentAllowedPaymentMethodTypes::from_str(s).expect("infallible"));
1234 Ok(())
1235 }
1236}
1237
1238stripe_types::impl_from_val_with_from_str!(PaymentIntentAllowedPaymentMethodTypes);
1239#[cfg(feature = "deserialize")]
1240impl<'de> serde::Deserialize<'de> for PaymentIntentAllowedPaymentMethodTypes {
1241 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1242 use std::str::FromStr;
1243 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1244 Ok(Self::from_str(&s).expect("infallible"))
1245 }
1246}
1247#[derive(Clone, Eq, PartialEq)]
1248#[non_exhaustive]
1249pub enum PaymentIntentCaptureMethod {
1250 Automatic,
1251 AutomaticAsync,
1252 Manual,
1253 Unknown(String),
1255}
1256impl PaymentIntentCaptureMethod {
1257 pub fn as_str(&self) -> &str {
1258 use PaymentIntentCaptureMethod::*;
1259 match self {
1260 Automatic => "automatic",
1261 AutomaticAsync => "automatic_async",
1262 Manual => "manual",
1263 Unknown(v) => v,
1264 }
1265 }
1266}
1267
1268impl std::str::FromStr for PaymentIntentCaptureMethod {
1269 type Err = std::convert::Infallible;
1270 fn from_str(s: &str) -> Result<Self, Self::Err> {
1271 use PaymentIntentCaptureMethod::*;
1272 match s {
1273 "automatic" => Ok(Automatic),
1274 "automatic_async" => Ok(AutomaticAsync),
1275 "manual" => Ok(Manual),
1276 v => {
1277 tracing::warn!("Unknown value '{}' for enum '{}'", v, "PaymentIntentCaptureMethod");
1278 Ok(Unknown(v.to_owned()))
1279 }
1280 }
1281 }
1282}
1283impl std::fmt::Display for PaymentIntentCaptureMethod {
1284 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1285 f.write_str(self.as_str())
1286 }
1287}
1288
1289#[cfg(not(feature = "redact-generated-debug"))]
1290impl std::fmt::Debug for PaymentIntentCaptureMethod {
1291 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1292 f.write_str(self.as_str())
1293 }
1294}
1295#[cfg(feature = "redact-generated-debug")]
1296impl std::fmt::Debug for PaymentIntentCaptureMethod {
1297 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1298 f.debug_struct(stringify!(PaymentIntentCaptureMethod)).finish_non_exhaustive()
1299 }
1300}
1301impl serde::Serialize for PaymentIntentCaptureMethod {
1302 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1303 where
1304 S: serde::Serializer,
1305 {
1306 serializer.serialize_str(self.as_str())
1307 }
1308}
1309impl miniserde::Deserialize for PaymentIntentCaptureMethod {
1310 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1311 crate::Place::new(out)
1312 }
1313}
1314
1315impl miniserde::de::Visitor for crate::Place<PaymentIntentCaptureMethod> {
1316 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1317 use std::str::FromStr;
1318 self.out = Some(PaymentIntentCaptureMethod::from_str(s).expect("infallible"));
1319 Ok(())
1320 }
1321}
1322
1323stripe_types::impl_from_val_with_from_str!(PaymentIntentCaptureMethod);
1324#[cfg(feature = "deserialize")]
1325impl<'de> serde::Deserialize<'de> for PaymentIntentCaptureMethod {
1326 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1327 use std::str::FromStr;
1328 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1329 Ok(Self::from_str(&s).expect("infallible"))
1330 }
1331}
1332#[derive(Clone, Eq, PartialEq)]
1333#[non_exhaustive]
1334pub enum PaymentIntentConfirmationMethod {
1335 Automatic,
1336 Manual,
1337 Unknown(String),
1339}
1340impl PaymentIntentConfirmationMethod {
1341 pub fn as_str(&self) -> &str {
1342 use PaymentIntentConfirmationMethod::*;
1343 match self {
1344 Automatic => "automatic",
1345 Manual => "manual",
1346 Unknown(v) => v,
1347 }
1348 }
1349}
1350
1351impl std::str::FromStr for PaymentIntentConfirmationMethod {
1352 type Err = std::convert::Infallible;
1353 fn from_str(s: &str) -> Result<Self, Self::Err> {
1354 use PaymentIntentConfirmationMethod::*;
1355 match s {
1356 "automatic" => Ok(Automatic),
1357 "manual" => Ok(Manual),
1358 v => {
1359 tracing::warn!(
1360 "Unknown value '{}' for enum '{}'",
1361 v,
1362 "PaymentIntentConfirmationMethod"
1363 );
1364 Ok(Unknown(v.to_owned()))
1365 }
1366 }
1367 }
1368}
1369impl std::fmt::Display for PaymentIntentConfirmationMethod {
1370 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1371 f.write_str(self.as_str())
1372 }
1373}
1374
1375#[cfg(not(feature = "redact-generated-debug"))]
1376impl std::fmt::Debug for PaymentIntentConfirmationMethod {
1377 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1378 f.write_str(self.as_str())
1379 }
1380}
1381#[cfg(feature = "redact-generated-debug")]
1382impl std::fmt::Debug for PaymentIntentConfirmationMethod {
1383 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1384 f.debug_struct(stringify!(PaymentIntentConfirmationMethod)).finish_non_exhaustive()
1385 }
1386}
1387impl serde::Serialize for PaymentIntentConfirmationMethod {
1388 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1389 where
1390 S: serde::Serializer,
1391 {
1392 serializer.serialize_str(self.as_str())
1393 }
1394}
1395impl miniserde::Deserialize for PaymentIntentConfirmationMethod {
1396 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1397 crate::Place::new(out)
1398 }
1399}
1400
1401impl miniserde::de::Visitor for crate::Place<PaymentIntentConfirmationMethod> {
1402 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1403 use std::str::FromStr;
1404 self.out = Some(PaymentIntentConfirmationMethod::from_str(s).expect("infallible"));
1405 Ok(())
1406 }
1407}
1408
1409stripe_types::impl_from_val_with_from_str!(PaymentIntentConfirmationMethod);
1410#[cfg(feature = "deserialize")]
1411impl<'de> serde::Deserialize<'de> for PaymentIntentConfirmationMethod {
1412 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1413 use std::str::FromStr;
1414 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1415 Ok(Self::from_str(&s).expect("infallible"))
1416 }
1417}
1418#[derive(Clone, Eq, PartialEq)]
1419#[non_exhaustive]
1420pub enum PaymentIntentExcludedPaymentMethodTypes {
1421 AcssDebit,
1422 Affirm,
1423 AfterpayClearpay,
1424 Alipay,
1425 Alma,
1426 AmazonPay,
1427 AuBecsDebit,
1428 BacsDebit,
1429 Bancontact,
1430 Billie,
1431 Bizum,
1432 Blik,
1433 Boleto,
1434 Card,
1435 Cashapp,
1436 Crypto,
1437 CustomerBalance,
1438 Eps,
1439 Fpx,
1440 Giropay,
1441 Grabpay,
1442 Ideal,
1443 KakaoPay,
1444 Klarna,
1445 Konbini,
1446 KrCard,
1447 MbWay,
1448 Mobilepay,
1449 Multibanco,
1450 NaverPay,
1451 NzBankAccount,
1452 Oxxo,
1453 P24,
1454 PayByBank,
1455 Payco,
1456 Paynow,
1457 Paypal,
1458 Payto,
1459 Pix,
1460 Promptpay,
1461 RevolutPay,
1462 SamsungPay,
1463 Satispay,
1464 Scalapay,
1465 SepaDebit,
1466 Sofort,
1467 Sunbit,
1468 Swish,
1469 Twint,
1470 Upi,
1471 UsBankAccount,
1472 WechatPay,
1473 Zip,
1474 Unknown(String),
1476}
1477impl PaymentIntentExcludedPaymentMethodTypes {
1478 pub fn as_str(&self) -> &str {
1479 use PaymentIntentExcludedPaymentMethodTypes::*;
1480 match self {
1481 AcssDebit => "acss_debit",
1482 Affirm => "affirm",
1483 AfterpayClearpay => "afterpay_clearpay",
1484 Alipay => "alipay",
1485 Alma => "alma",
1486 AmazonPay => "amazon_pay",
1487 AuBecsDebit => "au_becs_debit",
1488 BacsDebit => "bacs_debit",
1489 Bancontact => "bancontact",
1490 Billie => "billie",
1491 Bizum => "bizum",
1492 Blik => "blik",
1493 Boleto => "boleto",
1494 Card => "card",
1495 Cashapp => "cashapp",
1496 Crypto => "crypto",
1497 CustomerBalance => "customer_balance",
1498 Eps => "eps",
1499 Fpx => "fpx",
1500 Giropay => "giropay",
1501 Grabpay => "grabpay",
1502 Ideal => "ideal",
1503 KakaoPay => "kakao_pay",
1504 Klarna => "klarna",
1505 Konbini => "konbini",
1506 KrCard => "kr_card",
1507 MbWay => "mb_way",
1508 Mobilepay => "mobilepay",
1509 Multibanco => "multibanco",
1510 NaverPay => "naver_pay",
1511 NzBankAccount => "nz_bank_account",
1512 Oxxo => "oxxo",
1513 P24 => "p24",
1514 PayByBank => "pay_by_bank",
1515 Payco => "payco",
1516 Paynow => "paynow",
1517 Paypal => "paypal",
1518 Payto => "payto",
1519 Pix => "pix",
1520 Promptpay => "promptpay",
1521 RevolutPay => "revolut_pay",
1522 SamsungPay => "samsung_pay",
1523 Satispay => "satispay",
1524 Scalapay => "scalapay",
1525 SepaDebit => "sepa_debit",
1526 Sofort => "sofort",
1527 Sunbit => "sunbit",
1528 Swish => "swish",
1529 Twint => "twint",
1530 Upi => "upi",
1531 UsBankAccount => "us_bank_account",
1532 WechatPay => "wechat_pay",
1533 Zip => "zip",
1534 Unknown(v) => v,
1535 }
1536 }
1537}
1538
1539impl std::str::FromStr for PaymentIntentExcludedPaymentMethodTypes {
1540 type Err = std::convert::Infallible;
1541 fn from_str(s: &str) -> Result<Self, Self::Err> {
1542 use PaymentIntentExcludedPaymentMethodTypes::*;
1543 match s {
1544 "acss_debit" => Ok(AcssDebit),
1545 "affirm" => Ok(Affirm),
1546 "afterpay_clearpay" => Ok(AfterpayClearpay),
1547 "alipay" => Ok(Alipay),
1548 "alma" => Ok(Alma),
1549 "amazon_pay" => Ok(AmazonPay),
1550 "au_becs_debit" => Ok(AuBecsDebit),
1551 "bacs_debit" => Ok(BacsDebit),
1552 "bancontact" => Ok(Bancontact),
1553 "billie" => Ok(Billie),
1554 "bizum" => Ok(Bizum),
1555 "blik" => Ok(Blik),
1556 "boleto" => Ok(Boleto),
1557 "card" => Ok(Card),
1558 "cashapp" => Ok(Cashapp),
1559 "crypto" => Ok(Crypto),
1560 "customer_balance" => Ok(CustomerBalance),
1561 "eps" => Ok(Eps),
1562 "fpx" => Ok(Fpx),
1563 "giropay" => Ok(Giropay),
1564 "grabpay" => Ok(Grabpay),
1565 "ideal" => Ok(Ideal),
1566 "kakao_pay" => Ok(KakaoPay),
1567 "klarna" => Ok(Klarna),
1568 "konbini" => Ok(Konbini),
1569 "kr_card" => Ok(KrCard),
1570 "mb_way" => Ok(MbWay),
1571 "mobilepay" => Ok(Mobilepay),
1572 "multibanco" => Ok(Multibanco),
1573 "naver_pay" => Ok(NaverPay),
1574 "nz_bank_account" => Ok(NzBankAccount),
1575 "oxxo" => Ok(Oxxo),
1576 "p24" => Ok(P24),
1577 "pay_by_bank" => Ok(PayByBank),
1578 "payco" => Ok(Payco),
1579 "paynow" => Ok(Paynow),
1580 "paypal" => Ok(Paypal),
1581 "payto" => Ok(Payto),
1582 "pix" => Ok(Pix),
1583 "promptpay" => Ok(Promptpay),
1584 "revolut_pay" => Ok(RevolutPay),
1585 "samsung_pay" => Ok(SamsungPay),
1586 "satispay" => Ok(Satispay),
1587 "scalapay" => Ok(Scalapay),
1588 "sepa_debit" => Ok(SepaDebit),
1589 "sofort" => Ok(Sofort),
1590 "sunbit" => Ok(Sunbit),
1591 "swish" => Ok(Swish),
1592 "twint" => Ok(Twint),
1593 "upi" => Ok(Upi),
1594 "us_bank_account" => Ok(UsBankAccount),
1595 "wechat_pay" => Ok(WechatPay),
1596 "zip" => Ok(Zip),
1597 v => {
1598 tracing::warn!(
1599 "Unknown value '{}' for enum '{}'",
1600 v,
1601 "PaymentIntentExcludedPaymentMethodTypes"
1602 );
1603 Ok(Unknown(v.to_owned()))
1604 }
1605 }
1606 }
1607}
1608impl std::fmt::Display for PaymentIntentExcludedPaymentMethodTypes {
1609 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1610 f.write_str(self.as_str())
1611 }
1612}
1613
1614#[cfg(not(feature = "redact-generated-debug"))]
1615impl std::fmt::Debug for PaymentIntentExcludedPaymentMethodTypes {
1616 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1617 f.write_str(self.as_str())
1618 }
1619}
1620#[cfg(feature = "redact-generated-debug")]
1621impl std::fmt::Debug for PaymentIntentExcludedPaymentMethodTypes {
1622 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1623 f.debug_struct(stringify!(PaymentIntentExcludedPaymentMethodTypes)).finish_non_exhaustive()
1624 }
1625}
1626impl serde::Serialize for PaymentIntentExcludedPaymentMethodTypes {
1627 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1628 where
1629 S: serde::Serializer,
1630 {
1631 serializer.serialize_str(self.as_str())
1632 }
1633}
1634impl miniserde::Deserialize for PaymentIntentExcludedPaymentMethodTypes {
1635 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1636 crate::Place::new(out)
1637 }
1638}
1639
1640impl miniserde::de::Visitor for crate::Place<PaymentIntentExcludedPaymentMethodTypes> {
1641 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1642 use std::str::FromStr;
1643 self.out = Some(PaymentIntentExcludedPaymentMethodTypes::from_str(s).expect("infallible"));
1644 Ok(())
1645 }
1646}
1647
1648stripe_types::impl_from_val_with_from_str!(PaymentIntentExcludedPaymentMethodTypes);
1649#[cfg(feature = "deserialize")]
1650impl<'de> serde::Deserialize<'de> for PaymentIntentExcludedPaymentMethodTypes {
1651 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1652 use std::str::FromStr;
1653 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1654 Ok(Self::from_str(&s).expect("infallible"))
1655 }
1656}
1657#[derive(Clone, Eq, PartialEq)]
1658#[non_exhaustive]
1659pub enum PaymentIntentSetupFutureUsage {
1660 OffSession,
1661 OnSession,
1662 Unknown(String),
1664}
1665impl PaymentIntentSetupFutureUsage {
1666 pub fn as_str(&self) -> &str {
1667 use PaymentIntentSetupFutureUsage::*;
1668 match self {
1669 OffSession => "off_session",
1670 OnSession => "on_session",
1671 Unknown(v) => v,
1672 }
1673 }
1674}
1675
1676impl std::str::FromStr for PaymentIntentSetupFutureUsage {
1677 type Err = std::convert::Infallible;
1678 fn from_str(s: &str) -> Result<Self, Self::Err> {
1679 use PaymentIntentSetupFutureUsage::*;
1680 match s {
1681 "off_session" => Ok(OffSession),
1682 "on_session" => Ok(OnSession),
1683 v => {
1684 tracing::warn!(
1685 "Unknown value '{}' for enum '{}'",
1686 v,
1687 "PaymentIntentSetupFutureUsage"
1688 );
1689 Ok(Unknown(v.to_owned()))
1690 }
1691 }
1692 }
1693}
1694impl std::fmt::Display for PaymentIntentSetupFutureUsage {
1695 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1696 f.write_str(self.as_str())
1697 }
1698}
1699
1700#[cfg(not(feature = "redact-generated-debug"))]
1701impl std::fmt::Debug for PaymentIntentSetupFutureUsage {
1702 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1703 f.write_str(self.as_str())
1704 }
1705}
1706#[cfg(feature = "redact-generated-debug")]
1707impl std::fmt::Debug for PaymentIntentSetupFutureUsage {
1708 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1709 f.debug_struct(stringify!(PaymentIntentSetupFutureUsage)).finish_non_exhaustive()
1710 }
1711}
1712impl serde::Serialize for PaymentIntentSetupFutureUsage {
1713 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1714 where
1715 S: serde::Serializer,
1716 {
1717 serializer.serialize_str(self.as_str())
1718 }
1719}
1720impl miniserde::Deserialize for PaymentIntentSetupFutureUsage {
1721 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1722 crate::Place::new(out)
1723 }
1724}
1725
1726impl miniserde::de::Visitor for crate::Place<PaymentIntentSetupFutureUsage> {
1727 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1728 use std::str::FromStr;
1729 self.out = Some(PaymentIntentSetupFutureUsage::from_str(s).expect("infallible"));
1730 Ok(())
1731 }
1732}
1733
1734stripe_types::impl_from_val_with_from_str!(PaymentIntentSetupFutureUsage);
1735#[cfg(feature = "deserialize")]
1736impl<'de> serde::Deserialize<'de> for PaymentIntentSetupFutureUsage {
1737 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1738 use std::str::FromStr;
1739 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1740 Ok(Self::from_str(&s).expect("infallible"))
1741 }
1742}