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::{Deserialize, Result, make_place};
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 _ => <dyn Visitor>::ignore(),
55 })
56 }
57
58 fn deser_default() -> Self {
59 Self { customer_notification: Deserialize::default() }
60 }
61
62 fn take_out(&mut self) -> Option<Self::Out> {
63 let (Some(customer_notification),) = (self.customer_notification,) else {
64 return None;
65 };
66 Some(Self::Out { customer_notification })
67 }
68 }
69
70 impl Map for Builder<'_> {
71 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
72 self.builder.key(k)
73 }
74
75 fn finish(&mut self) -> Result<()> {
76 *self.out = self.builder.take_out();
77 Ok(())
78 }
79 }
80
81 impl ObjectDeser for PaymentIntentCardProcessing {
82 type Builder = PaymentIntentCardProcessingBuilder;
83 }
84
85 impl FromValueOpt for PaymentIntentCardProcessing {
86 fn from_value(v: Value) -> Option<Self> {
87 let Value::Object(obj) = v else {
88 return None;
89 };
90 let mut b = PaymentIntentCardProcessingBuilder::deser_default();
91 for (k, v) in obj {
92 match k.as_str() {
93 "customer_notification" => {
94 b.customer_notification = FromValueOpt::from_value(v)
95 }
96 _ => {}
97 }
98 }
99 b.take_out()
100 }
101 }
102};