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