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