stripe_shared/
payment_intent_card_processing.rs1#[derive(Copy, Clone, Eq, PartialEq)]
2#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
4#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
5pub struct PaymentIntentCardProcessing {
6 pub customer_notification: Option<stripe_shared::PaymentIntentProcessingCustomerNotification>,
7}
8#[cfg(feature = "redact-generated-debug")]
9impl std::fmt::Debug for PaymentIntentCardProcessing {
10 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
11 f.debug_struct("PaymentIntentCardProcessing").finish_non_exhaustive()
12 }
13}
14#[doc(hidden)]
15pub struct PaymentIntentCardProcessingBuilder {
16 customer_notification:
17 Option<Option<stripe_shared::PaymentIntentProcessingCustomerNotification>>,
18}
19
20#[allow(
21 unused_variables,
22 irrefutable_let_patterns,
23 clippy::let_unit_value,
24 clippy::match_single_binding,
25 clippy::single_match
26)]
27const _: () = {
28 use miniserde::de::{Map, Visitor};
29 use miniserde::json::Value;
30 use miniserde::{Deserialize, Result, make_place};
31 use stripe_types::miniserde_helpers::FromValueOpt;
32 use stripe_types::{MapBuilder, ObjectDeser};
33
34 make_place!(Place);
35
36 impl Deserialize for PaymentIntentCardProcessing {
37 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
38 Place::new(out)
39 }
40 }
41
42 struct Builder<'a> {
43 out: &'a mut Option<PaymentIntentCardProcessing>,
44 builder: PaymentIntentCardProcessingBuilder,
45 }
46
47 impl Visitor for Place<PaymentIntentCardProcessing> {
48 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
49 Ok(Box::new(Builder {
50 out: &mut self.out,
51 builder: PaymentIntentCardProcessingBuilder::deser_default(),
52 }))
53 }
54 }
55
56 impl MapBuilder for PaymentIntentCardProcessingBuilder {
57 type Out = PaymentIntentCardProcessing;
58 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
59 Ok(match k {
60 "customer_notification" => Deserialize::begin(&mut self.customer_notification),
61 _ => <dyn Visitor>::ignore(),
62 })
63 }
64
65 fn deser_default() -> Self {
66 Self { customer_notification: Deserialize::default() }
67 }
68
69 fn take_out(&mut self) -> Option<Self::Out> {
70 let (Some(customer_notification),) = (self.customer_notification,) else {
71 return None;
72 };
73 Some(Self::Out { customer_notification })
74 }
75 }
76
77 impl Map for Builder<'_> {
78 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
79 self.builder.key(k)
80 }
81
82 fn finish(&mut self) -> Result<()> {
83 *self.out = self.builder.take_out();
84 Ok(())
85 }
86 }
87
88 impl ObjectDeser for PaymentIntentCardProcessing {
89 type Builder = PaymentIntentCardProcessingBuilder;
90 }
91
92 impl FromValueOpt for PaymentIntentCardProcessing {
93 fn from_value(v: Value) -> Option<Self> {
94 let Value::Object(obj) = v else {
95 return None;
96 };
97 let mut b = PaymentIntentCardProcessingBuilder::deser_default();
98 for (k, v) in obj {
99 match k.as_str() {
100 "customer_notification" => {
101 b.customer_notification = FromValueOpt::from_value(v)
102 }
103 _ => {}
104 }
105 }
106 b.take_out()
107 }
108 }
109};