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