stripe_connect/
connect_embedded_instant_payouts_promotion_features.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 ConnectEmbeddedInstantPayoutsPromotionFeatures {
6 pub disable_stripe_user_authentication: bool,
11 pub external_account_collection: bool,
15 pub instant_payouts: bool,
18}
19#[cfg(feature = "redact-generated-debug")]
20impl std::fmt::Debug for ConnectEmbeddedInstantPayoutsPromotionFeatures {
21 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
22 f.debug_struct("ConnectEmbeddedInstantPayoutsPromotionFeatures").finish_non_exhaustive()
23 }
24}
25#[doc(hidden)]
26pub struct ConnectEmbeddedInstantPayoutsPromotionFeaturesBuilder {
27 disable_stripe_user_authentication: Option<bool>,
28 external_account_collection: Option<bool>,
29 instant_payouts: Option<bool>,
30}
31
32#[allow(
33 unused_variables,
34 irrefutable_let_patterns,
35 clippy::let_unit_value,
36 clippy::match_single_binding,
37 clippy::single_match
38)]
39const _: () = {
40 use miniserde::de::{Map, Visitor};
41 use miniserde::json::Value;
42 use miniserde::{Deserialize, Result, make_place};
43 use stripe_types::miniserde_helpers::FromValueOpt;
44 use stripe_types::{MapBuilder, ObjectDeser};
45
46 make_place!(Place);
47
48 impl Deserialize for ConnectEmbeddedInstantPayoutsPromotionFeatures {
49 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
50 Place::new(out)
51 }
52 }
53
54 struct Builder<'a> {
55 out: &'a mut Option<ConnectEmbeddedInstantPayoutsPromotionFeatures>,
56 builder: ConnectEmbeddedInstantPayoutsPromotionFeaturesBuilder,
57 }
58
59 impl Visitor for Place<ConnectEmbeddedInstantPayoutsPromotionFeatures> {
60 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
61 Ok(Box::new(Builder {
62 out: &mut self.out,
63 builder: ConnectEmbeddedInstantPayoutsPromotionFeaturesBuilder::deser_default(),
64 }))
65 }
66 }
67
68 impl MapBuilder for ConnectEmbeddedInstantPayoutsPromotionFeaturesBuilder {
69 type Out = ConnectEmbeddedInstantPayoutsPromotionFeatures;
70 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
71 Ok(match k {
72 "disable_stripe_user_authentication" => {
73 Deserialize::begin(&mut self.disable_stripe_user_authentication)
74 }
75 "external_account_collection" => {
76 Deserialize::begin(&mut self.external_account_collection)
77 }
78 "instant_payouts" => Deserialize::begin(&mut self.instant_payouts),
79 _ => <dyn Visitor>::ignore(),
80 })
81 }
82
83 fn deser_default() -> Self {
84 Self {
85 disable_stripe_user_authentication: Deserialize::default(),
86 external_account_collection: Deserialize::default(),
87 instant_payouts: Deserialize::default(),
88 }
89 }
90
91 fn take_out(&mut self) -> Option<Self::Out> {
92 let (
93 Some(disable_stripe_user_authentication),
94 Some(external_account_collection),
95 Some(instant_payouts),
96 ) = (
97 self.disable_stripe_user_authentication,
98 self.external_account_collection,
99 self.instant_payouts,
100 )
101 else {
102 return None;
103 };
104 Some(Self::Out {
105 disable_stripe_user_authentication,
106 external_account_collection,
107 instant_payouts,
108 })
109 }
110 }
111
112 impl Map for Builder<'_> {
113 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
114 self.builder.key(k)
115 }
116
117 fn finish(&mut self) -> Result<()> {
118 *self.out = self.builder.take_out();
119 Ok(())
120 }
121 }
122
123 impl ObjectDeser for ConnectEmbeddedInstantPayoutsPromotionFeatures {
124 type Builder = ConnectEmbeddedInstantPayoutsPromotionFeaturesBuilder;
125 }
126
127 impl FromValueOpt for ConnectEmbeddedInstantPayoutsPromotionFeatures {
128 fn from_value(v: Value) -> Option<Self> {
129 let Value::Object(obj) = v else {
130 return None;
131 };
132 let mut b = ConnectEmbeddedInstantPayoutsPromotionFeaturesBuilder::deser_default();
133 for (k, v) in obj {
134 match k.as_str() {
135 "disable_stripe_user_authentication" => {
136 b.disable_stripe_user_authentication = FromValueOpt::from_value(v)
137 }
138 "external_account_collection" => {
139 b.external_account_collection = FromValueOpt::from_value(v)
140 }
141 "instant_payouts" => b.instant_payouts = FromValueOpt::from_value(v),
142 _ => {}
143 }
144 }
145 b.take_out()
146 }
147 }
148};