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