1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct AccountBusinessProfile {
5 pub annual_revenue: Option<stripe_shared::AccountAnnualRevenue>,
7 pub estimated_worker_count: Option<u64>,
10 pub mcc: Option<String>,
13 pub minority_owned_business_designation:
15 Option<Vec<AccountBusinessProfileMinorityOwnedBusinessDesignation>>,
16 pub monthly_estimated_revenue: Option<stripe_shared::AccountMonthlyEstimatedRevenue>,
17 pub name: Option<String>,
19 pub product_description: Option<String>,
22 pub support_address: Option<stripe_shared::Address>,
24 pub support_email: Option<String>,
26 pub support_phone: Option<String>,
28 pub support_url: Option<String>,
30 pub url: Option<String>,
32}
33#[doc(hidden)]
34pub struct AccountBusinessProfileBuilder {
35 annual_revenue: Option<Option<stripe_shared::AccountAnnualRevenue>>,
36 estimated_worker_count: Option<Option<u64>>,
37 mcc: Option<Option<String>>,
38 minority_owned_business_designation:
39 Option<Option<Vec<AccountBusinessProfileMinorityOwnedBusinessDesignation>>>,
40 monthly_estimated_revenue: Option<Option<stripe_shared::AccountMonthlyEstimatedRevenue>>,
41 name: Option<Option<String>>,
42 product_description: Option<Option<String>>,
43 support_address: Option<Option<stripe_shared::Address>>,
44 support_email: Option<Option<String>>,
45 support_phone: Option<Option<String>>,
46 support_url: Option<Option<String>>,
47 url: Option<Option<String>>,
48}
49
50#[allow(
51 unused_variables,
52 irrefutable_let_patterns,
53 clippy::let_unit_value,
54 clippy::match_single_binding,
55 clippy::single_match
56)]
57const _: () = {
58 use miniserde::de::{Map, Visitor};
59 use miniserde::json::Value;
60 use miniserde::{make_place, Deserialize, Result};
61 use stripe_types::miniserde_helpers::FromValueOpt;
62 use stripe_types::{MapBuilder, ObjectDeser};
63
64 make_place!(Place);
65
66 impl Deserialize for AccountBusinessProfile {
67 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
68 Place::new(out)
69 }
70 }
71
72 struct Builder<'a> {
73 out: &'a mut Option<AccountBusinessProfile>,
74 builder: AccountBusinessProfileBuilder,
75 }
76
77 impl Visitor for Place<AccountBusinessProfile> {
78 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
79 Ok(Box::new(Builder {
80 out: &mut self.out,
81 builder: AccountBusinessProfileBuilder::deser_default(),
82 }))
83 }
84 }
85
86 impl MapBuilder for AccountBusinessProfileBuilder {
87 type Out = AccountBusinessProfile;
88 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
89 Ok(match k {
90 "annual_revenue" => Deserialize::begin(&mut self.annual_revenue),
91 "estimated_worker_count" => Deserialize::begin(&mut self.estimated_worker_count),
92 "mcc" => Deserialize::begin(&mut self.mcc),
93 "minority_owned_business_designation" => {
94 Deserialize::begin(&mut self.minority_owned_business_designation)
95 }
96 "monthly_estimated_revenue" => {
97 Deserialize::begin(&mut self.monthly_estimated_revenue)
98 }
99 "name" => Deserialize::begin(&mut self.name),
100 "product_description" => Deserialize::begin(&mut self.product_description),
101 "support_address" => Deserialize::begin(&mut self.support_address),
102 "support_email" => Deserialize::begin(&mut self.support_email),
103 "support_phone" => Deserialize::begin(&mut self.support_phone),
104 "support_url" => Deserialize::begin(&mut self.support_url),
105 "url" => Deserialize::begin(&mut self.url),
106
107 _ => <dyn Visitor>::ignore(),
108 })
109 }
110
111 fn deser_default() -> Self {
112 Self {
113 annual_revenue: Deserialize::default(),
114 estimated_worker_count: Deserialize::default(),
115 mcc: Deserialize::default(),
116 minority_owned_business_designation: Deserialize::default(),
117 monthly_estimated_revenue: Deserialize::default(),
118 name: Deserialize::default(),
119 product_description: Deserialize::default(),
120 support_address: Deserialize::default(),
121 support_email: Deserialize::default(),
122 support_phone: Deserialize::default(),
123 support_url: Deserialize::default(),
124 url: Deserialize::default(),
125 }
126 }
127
128 fn take_out(&mut self) -> Option<Self::Out> {
129 let (
130 Some(annual_revenue),
131 Some(estimated_worker_count),
132 Some(mcc),
133 Some(minority_owned_business_designation),
134 Some(monthly_estimated_revenue),
135 Some(name),
136 Some(product_description),
137 Some(support_address),
138 Some(support_email),
139 Some(support_phone),
140 Some(support_url),
141 Some(url),
142 ) = (
143 self.annual_revenue.take(),
144 self.estimated_worker_count,
145 self.mcc.take(),
146 self.minority_owned_business_designation.take(),
147 self.monthly_estimated_revenue,
148 self.name.take(),
149 self.product_description.take(),
150 self.support_address.take(),
151 self.support_email.take(),
152 self.support_phone.take(),
153 self.support_url.take(),
154 self.url.take(),
155 )
156 else {
157 return None;
158 };
159 Some(Self::Out {
160 annual_revenue,
161 estimated_worker_count,
162 mcc,
163 minority_owned_business_designation,
164 monthly_estimated_revenue,
165 name,
166 product_description,
167 support_address,
168 support_email,
169 support_phone,
170 support_url,
171 url,
172 })
173 }
174 }
175
176 impl<'a> Map for Builder<'a> {
177 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
178 self.builder.key(k)
179 }
180
181 fn finish(&mut self) -> Result<()> {
182 *self.out = self.builder.take_out();
183 Ok(())
184 }
185 }
186
187 impl ObjectDeser for AccountBusinessProfile {
188 type Builder = AccountBusinessProfileBuilder;
189 }
190
191 impl FromValueOpt for AccountBusinessProfile {
192 fn from_value(v: Value) -> Option<Self> {
193 let Value::Object(obj) = v else {
194 return None;
195 };
196 let mut b = AccountBusinessProfileBuilder::deser_default();
197 for (k, v) in obj {
198 match k.as_str() {
199 "annual_revenue" => b.annual_revenue = FromValueOpt::from_value(v),
200 "estimated_worker_count" => {
201 b.estimated_worker_count = FromValueOpt::from_value(v)
202 }
203 "mcc" => b.mcc = FromValueOpt::from_value(v),
204 "minority_owned_business_designation" => {
205 b.minority_owned_business_designation = FromValueOpt::from_value(v)
206 }
207 "monthly_estimated_revenue" => {
208 b.monthly_estimated_revenue = FromValueOpt::from_value(v)
209 }
210 "name" => b.name = FromValueOpt::from_value(v),
211 "product_description" => b.product_description = FromValueOpt::from_value(v),
212 "support_address" => b.support_address = FromValueOpt::from_value(v),
213 "support_email" => b.support_email = FromValueOpt::from_value(v),
214 "support_phone" => b.support_phone = FromValueOpt::from_value(v),
215 "support_url" => b.support_url = FromValueOpt::from_value(v),
216 "url" => b.url = FromValueOpt::from_value(v),
217
218 _ => {}
219 }
220 }
221 b.take_out()
222 }
223 }
224};
225#[derive(Copy, Clone, Eq, PartialEq)]
227pub enum AccountBusinessProfileMinorityOwnedBusinessDesignation {
228 LgbtqiOwnedBusiness,
229 MinorityOwnedBusiness,
230 NoneOfTheseApply,
231 PreferNotToAnswer,
232 WomenOwnedBusiness,
233}
234impl AccountBusinessProfileMinorityOwnedBusinessDesignation {
235 pub fn as_str(self) -> &'static str {
236 use AccountBusinessProfileMinorityOwnedBusinessDesignation::*;
237 match self {
238 LgbtqiOwnedBusiness => "lgbtqi_owned_business",
239 MinorityOwnedBusiness => "minority_owned_business",
240 NoneOfTheseApply => "none_of_these_apply",
241 PreferNotToAnswer => "prefer_not_to_answer",
242 WomenOwnedBusiness => "women_owned_business",
243 }
244 }
245}
246
247impl std::str::FromStr for AccountBusinessProfileMinorityOwnedBusinessDesignation {
248 type Err = stripe_types::StripeParseError;
249 fn from_str(s: &str) -> Result<Self, Self::Err> {
250 use AccountBusinessProfileMinorityOwnedBusinessDesignation::*;
251 match s {
252 "lgbtqi_owned_business" => Ok(LgbtqiOwnedBusiness),
253 "minority_owned_business" => Ok(MinorityOwnedBusiness),
254 "none_of_these_apply" => Ok(NoneOfTheseApply),
255 "prefer_not_to_answer" => Ok(PreferNotToAnswer),
256 "women_owned_business" => Ok(WomenOwnedBusiness),
257 _ => Err(stripe_types::StripeParseError),
258 }
259 }
260}
261impl std::fmt::Display for AccountBusinessProfileMinorityOwnedBusinessDesignation {
262 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
263 f.write_str(self.as_str())
264 }
265}
266
267impl std::fmt::Debug for AccountBusinessProfileMinorityOwnedBusinessDesignation {
268 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
269 f.write_str(self.as_str())
270 }
271}
272#[cfg(feature = "serialize")]
273impl serde::Serialize for AccountBusinessProfileMinorityOwnedBusinessDesignation {
274 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
275 where
276 S: serde::Serializer,
277 {
278 serializer.serialize_str(self.as_str())
279 }
280}
281impl miniserde::Deserialize for AccountBusinessProfileMinorityOwnedBusinessDesignation {
282 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
283 crate::Place::new(out)
284 }
285}
286
287impl miniserde::de::Visitor
288 for crate::Place<AccountBusinessProfileMinorityOwnedBusinessDesignation>
289{
290 fn string(&mut self, s: &str) -> miniserde::Result<()> {
291 use std::str::FromStr;
292 self.out = Some(
293 AccountBusinessProfileMinorityOwnedBusinessDesignation::from_str(s)
294 .map_err(|_| miniserde::Error)?,
295 );
296 Ok(())
297 }
298}
299
300stripe_types::impl_from_val_with_from_str!(AccountBusinessProfileMinorityOwnedBusinessDesignation);
301#[cfg(feature = "deserialize")]
302impl<'de> serde::Deserialize<'de> for AccountBusinessProfileMinorityOwnedBusinessDesignation {
303 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
304 use std::str::FromStr;
305 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
306 Self::from_str(&s).map_err(|_| {
307 serde::de::Error::custom(
308 "Unknown value for AccountBusinessProfileMinorityOwnedBusinessDesignation",
309 )
310 })
311 }
312}