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 { approval_requested: Some(None), completes_at: Some(None) }
72 }
73
74 fn take_out(&mut self) -> Option<Self::Out> {
75 let (Some(approval_requested), Some(completes_at)) =
76 (self.approval_requested, self.completes_at)
77 else {
78 return None;
79 };
80 Some(Self::Out { approval_requested, completes_at })
81 }
82 }
83
84 impl Map for Builder<'_> {
85 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
86 self.builder.key(k)
87 }
88
89 fn finish(&mut self) -> Result<()> {
90 *self.out = self.builder.take_out();
91 Ok(())
92 }
93 }
94
95 impl ObjectDeser for PaymentIntentProcessingCustomerNotification {
96 type Builder = PaymentIntentProcessingCustomerNotificationBuilder;
97 }
98
99 impl FromValueOpt for PaymentIntentProcessingCustomerNotification {
100 fn from_value(v: Value) -> Option<Self> {
101 let Value::Object(obj) = v else {
102 return None;
103 };
104 let mut b = PaymentIntentProcessingCustomerNotificationBuilder::deser_default();
105 for (k, v) in obj {
106 match k.as_str() {
107 "approval_requested" => b.approval_requested = FromValueOpt::from_value(v),
108 "completes_at" => b.completes_at = FromValueOpt::from_value(v),
109 _ => {}
110 }
111 }
112 b.take_out()
113 }
114 }
115};