Skip to main content

stripe_core/token/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Eq, PartialEq)]
6#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
7#[derive(serde::Serialize)]
8struct RetrieveTokenBuilder {
9    #[serde(skip_serializing_if = "Option::is_none")]
10    expand: Option<Vec<String>>,
11}
12#[cfg(feature = "redact-generated-debug")]
13impl std::fmt::Debug for RetrieveTokenBuilder {
14    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
15        f.debug_struct("RetrieveTokenBuilder").finish_non_exhaustive()
16    }
17}
18impl RetrieveTokenBuilder {
19    fn new() -> Self {
20        Self { expand: None }
21    }
22}
23/// Retrieves the token with the given ID.
24#[derive(Clone)]
25#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
26#[derive(serde::Serialize)]
27pub struct RetrieveToken {
28    inner: RetrieveTokenBuilder,
29    token: stripe_core::TokenId,
30}
31#[cfg(feature = "redact-generated-debug")]
32impl std::fmt::Debug for RetrieveToken {
33    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
34        f.debug_struct("RetrieveToken").finish_non_exhaustive()
35    }
36}
37impl RetrieveToken {
38    /// Construct a new `RetrieveToken`.
39    pub fn new(token: impl Into<stripe_core::TokenId>) -> Self {
40        Self { token: token.into(), inner: RetrieveTokenBuilder::new() }
41    }
42    /// Specifies which fields in the response should be expanded.
43    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
44        self.inner.expand = Some(expand.into());
45        self
46    }
47}
48impl RetrieveToken {
49    /// Send the request and return the deserialized response.
50    pub async fn send<C: StripeClient>(
51        &self,
52        client: &C,
53    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
54        self.customize().send(client).await
55    }
56
57    /// Send the request and return the deserialized response, blocking until completion.
58    pub fn send_blocking<C: StripeBlockingClient>(
59        &self,
60        client: &C,
61    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
62        self.customize().send_blocking(client)
63    }
64}
65
66impl StripeRequest for RetrieveToken {
67    type Output = stripe_core::Token;
68
69    fn build(&self) -> RequestBuilder {
70        let token = &self.token;
71        RequestBuilder::new(StripeMethod::Get, format!("/tokens/{token}")).query(&self.inner)
72    }
73}
74#[derive(Clone)]
75#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
76#[derive(serde::Serialize)]
77struct CreateTokenBuilder {
78    #[serde(skip_serializing_if = "Option::is_none")]
79    account: Option<CreateTokenAccount>,
80    #[serde(skip_serializing_if = "Option::is_none")]
81    bank_account: Option<CreateTokenBankAccount>,
82    #[serde(skip_serializing_if = "Option::is_none")]
83    card: Option<CreateTokenCard>,
84    #[serde(skip_serializing_if = "Option::is_none")]
85    customer: Option<String>,
86    #[serde(skip_serializing_if = "Option::is_none")]
87    cvc_update: Option<CreateTokenCvcUpdate>,
88    #[serde(skip_serializing_if = "Option::is_none")]
89    expand: Option<Vec<String>>,
90    #[serde(skip_serializing_if = "Option::is_none")]
91    person: Option<CreateTokenPerson>,
92    #[serde(skip_serializing_if = "Option::is_none")]
93    pii: Option<CreateTokenPii>,
94}
95#[cfg(feature = "redact-generated-debug")]
96impl std::fmt::Debug for CreateTokenBuilder {
97    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
98        f.debug_struct("CreateTokenBuilder").finish_non_exhaustive()
99    }
100}
101impl CreateTokenBuilder {
102    fn new() -> Self {
103        Self {
104            account: None,
105            bank_account: None,
106            card: None,
107            customer: None,
108            cvc_update: None,
109            expand: None,
110            person: None,
111            pii: None,
112        }
113    }
114}
115/// Information for the account this token represents.
116#[derive(Clone)]
117#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
118#[derive(serde::Serialize)]
119pub struct CreateTokenAccount {
120    /// The business type.
121    #[serde(skip_serializing_if = "Option::is_none")]
122    pub business_type: Option<CreateTokenAccountBusinessType>,
123    /// Information about the company or business.
124    #[serde(skip_serializing_if = "Option::is_none")]
125    pub company: Option<CreateTokenAccountCompany>,
126    /// Information about the person represented by the account.
127    #[serde(skip_serializing_if = "Option::is_none")]
128    pub individual: Option<CreateTokenAccountIndividual>,
129    /// Whether the user described by the data in the token has been shown [the Stripe Connected Account Agreement](/connect/account-tokens#stripe-connected-account-agreement).
130    /// When creating an account token to create a new Connect account, this value must be `true`.
131    #[serde(skip_serializing_if = "Option::is_none")]
132    pub tos_shown_and_accepted: Option<bool>,
133}
134#[cfg(feature = "redact-generated-debug")]
135impl std::fmt::Debug for CreateTokenAccount {
136    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
137        f.debug_struct("CreateTokenAccount").finish_non_exhaustive()
138    }
139}
140impl CreateTokenAccount {
141    pub fn new() -> Self {
142        Self { business_type: None, company: None, individual: None, tos_shown_and_accepted: None }
143    }
144}
145impl Default for CreateTokenAccount {
146    fn default() -> Self {
147        Self::new()
148    }
149}
150/// The business type.
151#[derive(Clone, Eq, PartialEq)]
152#[non_exhaustive]
153pub enum CreateTokenAccountBusinessType {
154    Company,
155    GovernmentEntity,
156    Individual,
157    NonProfit,
158    /// An unrecognized value from Stripe. Should not be used as a request parameter.
159    Unknown(String),
160}
161impl CreateTokenAccountBusinessType {
162    pub fn as_str(&self) -> &str {
163        use CreateTokenAccountBusinessType::*;
164        match self {
165            Company => "company",
166            GovernmentEntity => "government_entity",
167            Individual => "individual",
168            NonProfit => "non_profit",
169            Unknown(v) => v,
170        }
171    }
172}
173
174impl std::str::FromStr for CreateTokenAccountBusinessType {
175    type Err = std::convert::Infallible;
176    fn from_str(s: &str) -> Result<Self, Self::Err> {
177        use CreateTokenAccountBusinessType::*;
178        match s {
179            "company" => Ok(Company),
180            "government_entity" => Ok(GovernmentEntity),
181            "individual" => Ok(Individual),
182            "non_profit" => Ok(NonProfit),
183            v => {
184                tracing::warn!(
185                    "Unknown value '{}' for enum '{}'",
186                    v,
187                    "CreateTokenAccountBusinessType"
188                );
189                Ok(Unknown(v.to_owned()))
190            }
191        }
192    }
193}
194impl std::fmt::Display for CreateTokenAccountBusinessType {
195    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
196        f.write_str(self.as_str())
197    }
198}
199
200#[cfg(not(feature = "redact-generated-debug"))]
201impl std::fmt::Debug for CreateTokenAccountBusinessType {
202    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
203        f.write_str(self.as_str())
204    }
205}
206#[cfg(feature = "redact-generated-debug")]
207impl std::fmt::Debug for CreateTokenAccountBusinessType {
208    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
209        f.debug_struct(stringify!(CreateTokenAccountBusinessType)).finish_non_exhaustive()
210    }
211}
212impl serde::Serialize for CreateTokenAccountBusinessType {
213    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
214    where
215        S: serde::Serializer,
216    {
217        serializer.serialize_str(self.as_str())
218    }
219}
220#[cfg(feature = "deserialize")]
221impl<'de> serde::Deserialize<'de> for CreateTokenAccountBusinessType {
222    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
223        use std::str::FromStr;
224        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
225        Ok(Self::from_str(&s).expect("infallible"))
226    }
227}
228/// Information about the company or business.
229#[derive(Clone, Eq, PartialEq)]
230#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
231#[derive(serde::Serialize)]
232pub struct CreateTokenAccountCompany {
233    /// The company's primary address.
234    #[serde(skip_serializing_if = "Option::is_none")]
235    pub address: Option<CreateTokenAccountCompanyAddress>,
236    /// The Kana variation of the company's primary address (Japan only).
237    #[serde(skip_serializing_if = "Option::is_none")]
238    pub address_kana: Option<CreateTokenAccountCompanyAddressKana>,
239    /// The Kanji variation of the company's primary address (Japan only).
240    #[serde(skip_serializing_if = "Option::is_none")]
241    pub address_kanji: Option<CreateTokenAccountCompanyAddressKanji>,
242    /// Whether the company's directors have been provided.
243    /// Set this Boolean to `true` after creating all the company's directors with [the Persons API](/api/persons) for accounts with a `relationship.director` requirement.
244    /// This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided.
245    #[serde(skip_serializing_if = "Option::is_none")]
246    pub directors_provided: Option<bool>,
247    /// This hash is used to attest that the directors information provided to Stripe is both current and correct.
248    #[serde(skip_serializing_if = "Option::is_none")]
249    pub directorship_declaration: Option<CreateTokenAccountCompanyDirectorshipDeclaration>,
250    /// Whether the company's executives have been provided.
251    /// Set this Boolean to `true` after creating all the company's executives with [the Persons API](/api/persons) for accounts with a `relationship.executive` requirement.
252    #[serde(skip_serializing_if = "Option::is_none")]
253    pub executives_provided: Option<bool>,
254    /// The export license ID number of the company, also referred as Import Export Code (India only).
255    #[serde(skip_serializing_if = "Option::is_none")]
256    pub export_license_id: Option<String>,
257    /// The purpose code to use for export transactions (India only).
258    #[serde(skip_serializing_if = "Option::is_none")]
259    pub export_purpose_code: Option<String>,
260    /// The company's legal name.
261    #[serde(skip_serializing_if = "Option::is_none")]
262    pub name: Option<String>,
263    /// The Kana variation of the company's legal name (Japan only).
264    #[serde(skip_serializing_if = "Option::is_none")]
265    pub name_kana: Option<String>,
266    /// The Kanji variation of the company's legal name (Japan only).
267    #[serde(skip_serializing_if = "Option::is_none")]
268    pub name_kanji: Option<String>,
269    /// Whether the company's owners have been provided.
270    /// Set this Boolean to `true` after creating all the company's owners with [the Persons API](/api/persons) for accounts with a `relationship.owner` requirement.
271    #[serde(skip_serializing_if = "Option::is_none")]
272    pub owners_provided: Option<bool>,
273    /// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
274    #[serde(skip_serializing_if = "Option::is_none")]
275    pub ownership_declaration: Option<CreateTokenAccountCompanyOwnershipDeclaration>,
276    /// Whether the user described by the data in the token has been shown the Ownership Declaration and indicated that it is correct.
277    #[serde(skip_serializing_if = "Option::is_none")]
278    pub ownership_declaration_shown_and_signed: Option<bool>,
279    /// This value is used to determine if a business is exempt from providing ultimate beneficial owners.
280    /// See [this support article](https://support.stripe.com/questions/exemption-from-providing-ownership-details) and [changelog](https://docs.stripe.com/changelog/acacia/2025-01-27/ownership-exemption-reason-accounts-api) for more details.
281    #[serde(skip_serializing_if = "Option::is_none")]
282    pub ownership_exemption_reason: Option<CreateTokenAccountCompanyOwnershipExemptionReason>,
283    /// The company's phone number (used for verification).
284    #[serde(skip_serializing_if = "Option::is_none")]
285    pub phone: Option<String>,
286    /// When the business was incorporated or registered.
287    #[serde(skip_serializing_if = "Option::is_none")]
288    pub registration_date: Option<CreateTokenAccountCompanyRegistrationDate>,
289    /// The identification number given to a company when it is registered or incorporated, if distinct from the identification number used for filing taxes.
290    /// (Examples are the CIN for companies and LLP IN for partnerships in India, and the Company Registration Number in Hong Kong).
291    #[serde(skip_serializing_if = "Option::is_none")]
292    pub registration_number: Option<String>,
293    /// This hash is used to attest that the representative is authorized to act as the representative of their legal entity.
294    #[serde(skip_serializing_if = "Option::is_none")]
295    pub representative_declaration: Option<CreateTokenAccountCompanyRepresentativeDeclaration>,
296    /// The category identifying the legal structure of the company or legal entity.
297    /// See [Business structure](/connect/identity-verification#business-structure) for more details.
298    /// Pass an empty string to unset this value.
299    #[serde(skip_serializing_if = "Option::is_none")]
300    pub structure: Option<CreateTokenAccountCompanyStructure>,
301    /// The business ID number of the company, as appropriate for the company’s country.
302    /// (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.).
303    #[serde(skip_serializing_if = "Option::is_none")]
304    pub tax_id: Option<String>,
305    /// The jurisdiction in which the `tax_id` is registered (Germany-based companies only).
306    #[serde(skip_serializing_if = "Option::is_none")]
307    pub tax_id_registrar: Option<String>,
308    /// The VAT number of the company.
309    #[serde(skip_serializing_if = "Option::is_none")]
310    pub vat_id: Option<String>,
311    /// Information on the verification state of the company.
312    #[serde(skip_serializing_if = "Option::is_none")]
313    pub verification: Option<CreateTokenAccountCompanyVerification>,
314}
315#[cfg(feature = "redact-generated-debug")]
316impl std::fmt::Debug for CreateTokenAccountCompany {
317    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
318        f.debug_struct("CreateTokenAccountCompany").finish_non_exhaustive()
319    }
320}
321impl CreateTokenAccountCompany {
322    pub fn new() -> Self {
323        Self {
324            address: None,
325            address_kana: None,
326            address_kanji: None,
327            directors_provided: None,
328            directorship_declaration: None,
329            executives_provided: None,
330            export_license_id: None,
331            export_purpose_code: None,
332            name: None,
333            name_kana: None,
334            name_kanji: None,
335            owners_provided: None,
336            ownership_declaration: None,
337            ownership_declaration_shown_and_signed: None,
338            ownership_exemption_reason: None,
339            phone: None,
340            registration_date: None,
341            registration_number: None,
342            representative_declaration: None,
343            structure: None,
344            tax_id: None,
345            tax_id_registrar: None,
346            vat_id: None,
347            verification: None,
348        }
349    }
350}
351impl Default for CreateTokenAccountCompany {
352    fn default() -> Self {
353        Self::new()
354    }
355}
356/// The company's primary address.
357#[derive(Clone, Eq, PartialEq)]
358#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
359#[derive(serde::Serialize)]
360pub struct CreateTokenAccountCompanyAddress {
361    /// City, district, suburb, town, or village.
362    #[serde(skip_serializing_if = "Option::is_none")]
363    pub city: Option<String>,
364    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
365    #[serde(skip_serializing_if = "Option::is_none")]
366    pub country: Option<String>,
367    /// Address line 1, such as the street, PO Box, or company name.
368    #[serde(skip_serializing_if = "Option::is_none")]
369    pub line1: Option<String>,
370    /// Address line 2, such as the apartment, suite, unit, or building.
371    #[serde(skip_serializing_if = "Option::is_none")]
372    pub line2: Option<String>,
373    /// ZIP or postal code.
374    #[serde(skip_serializing_if = "Option::is_none")]
375    pub postal_code: Option<String>,
376    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
377    #[serde(skip_serializing_if = "Option::is_none")]
378    pub state: Option<String>,
379}
380#[cfg(feature = "redact-generated-debug")]
381impl std::fmt::Debug for CreateTokenAccountCompanyAddress {
382    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
383        f.debug_struct("CreateTokenAccountCompanyAddress").finish_non_exhaustive()
384    }
385}
386impl CreateTokenAccountCompanyAddress {
387    pub fn new() -> Self {
388        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
389    }
390}
391impl Default for CreateTokenAccountCompanyAddress {
392    fn default() -> Self {
393        Self::new()
394    }
395}
396/// The Kana variation of the company's primary address (Japan only).
397#[derive(Clone, Eq, PartialEq)]
398#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
399#[derive(serde::Serialize)]
400pub struct CreateTokenAccountCompanyAddressKana {
401    /// City or ward.
402    #[serde(skip_serializing_if = "Option::is_none")]
403    pub city: Option<String>,
404    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
405    #[serde(skip_serializing_if = "Option::is_none")]
406    pub country: Option<String>,
407    /// Block or building number.
408    #[serde(skip_serializing_if = "Option::is_none")]
409    pub line1: Option<String>,
410    /// Building details.
411    #[serde(skip_serializing_if = "Option::is_none")]
412    pub line2: Option<String>,
413    /// Postal code.
414    #[serde(skip_serializing_if = "Option::is_none")]
415    pub postal_code: Option<String>,
416    /// Prefecture.
417    #[serde(skip_serializing_if = "Option::is_none")]
418    pub state: Option<String>,
419    /// Town or cho-me.
420    #[serde(skip_serializing_if = "Option::is_none")]
421    pub town: Option<String>,
422}
423#[cfg(feature = "redact-generated-debug")]
424impl std::fmt::Debug for CreateTokenAccountCompanyAddressKana {
425    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
426        f.debug_struct("CreateTokenAccountCompanyAddressKana").finish_non_exhaustive()
427    }
428}
429impl CreateTokenAccountCompanyAddressKana {
430    pub fn new() -> Self {
431        Self {
432            city: None,
433            country: None,
434            line1: None,
435            line2: None,
436            postal_code: None,
437            state: None,
438            town: None,
439        }
440    }
441}
442impl Default for CreateTokenAccountCompanyAddressKana {
443    fn default() -> Self {
444        Self::new()
445    }
446}
447/// The Kanji variation of the company's primary address (Japan only).
448#[derive(Clone, Eq, PartialEq)]
449#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
450#[derive(serde::Serialize)]
451pub struct CreateTokenAccountCompanyAddressKanji {
452    /// City or ward.
453    #[serde(skip_serializing_if = "Option::is_none")]
454    pub city: Option<String>,
455    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
456    #[serde(skip_serializing_if = "Option::is_none")]
457    pub country: Option<String>,
458    /// Block or building number.
459    #[serde(skip_serializing_if = "Option::is_none")]
460    pub line1: Option<String>,
461    /// Building details.
462    #[serde(skip_serializing_if = "Option::is_none")]
463    pub line2: Option<String>,
464    /// Postal code.
465    #[serde(skip_serializing_if = "Option::is_none")]
466    pub postal_code: Option<String>,
467    /// Prefecture.
468    #[serde(skip_serializing_if = "Option::is_none")]
469    pub state: Option<String>,
470    /// Town or cho-me.
471    #[serde(skip_serializing_if = "Option::is_none")]
472    pub town: Option<String>,
473}
474#[cfg(feature = "redact-generated-debug")]
475impl std::fmt::Debug for CreateTokenAccountCompanyAddressKanji {
476    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
477        f.debug_struct("CreateTokenAccountCompanyAddressKanji").finish_non_exhaustive()
478    }
479}
480impl CreateTokenAccountCompanyAddressKanji {
481    pub fn new() -> Self {
482        Self {
483            city: None,
484            country: None,
485            line1: None,
486            line2: None,
487            postal_code: None,
488            state: None,
489            town: None,
490        }
491    }
492}
493impl Default for CreateTokenAccountCompanyAddressKanji {
494    fn default() -> Self {
495        Self::new()
496    }
497}
498/// This hash is used to attest that the directors information provided to Stripe is both current and correct.
499#[derive(Clone, Eq, PartialEq)]
500#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
501#[derive(serde::Serialize)]
502pub struct CreateTokenAccountCompanyDirectorshipDeclaration {
503    /// The Unix timestamp marking when the directorship declaration attestation was made.
504    #[serde(skip_serializing_if = "Option::is_none")]
505    pub date: Option<stripe_types::Timestamp>,
506    /// The IP address from which the directorship declaration attestation was made.
507    #[serde(skip_serializing_if = "Option::is_none")]
508    pub ip: Option<String>,
509    /// The user agent of the browser from which the directorship declaration attestation was made.
510    #[serde(skip_serializing_if = "Option::is_none")]
511    pub user_agent: Option<String>,
512}
513#[cfg(feature = "redact-generated-debug")]
514impl std::fmt::Debug for CreateTokenAccountCompanyDirectorshipDeclaration {
515    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
516        f.debug_struct("CreateTokenAccountCompanyDirectorshipDeclaration").finish_non_exhaustive()
517    }
518}
519impl CreateTokenAccountCompanyDirectorshipDeclaration {
520    pub fn new() -> Self {
521        Self { date: None, ip: None, user_agent: None }
522    }
523}
524impl Default for CreateTokenAccountCompanyDirectorshipDeclaration {
525    fn default() -> Self {
526        Self::new()
527    }
528}
529/// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
530#[derive(Clone, Eq, PartialEq)]
531#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
532#[derive(serde::Serialize)]
533pub struct CreateTokenAccountCompanyOwnershipDeclaration {
534    /// The Unix timestamp marking when the beneficial owner attestation was made.
535    #[serde(skip_serializing_if = "Option::is_none")]
536    pub date: Option<stripe_types::Timestamp>,
537    /// The IP address from which the beneficial owner attestation was made.
538    #[serde(skip_serializing_if = "Option::is_none")]
539    pub ip: Option<String>,
540    /// The user agent of the browser from which the beneficial owner attestation was made.
541    #[serde(skip_serializing_if = "Option::is_none")]
542    pub user_agent: Option<String>,
543}
544#[cfg(feature = "redact-generated-debug")]
545impl std::fmt::Debug for CreateTokenAccountCompanyOwnershipDeclaration {
546    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
547        f.debug_struct("CreateTokenAccountCompanyOwnershipDeclaration").finish_non_exhaustive()
548    }
549}
550impl CreateTokenAccountCompanyOwnershipDeclaration {
551    pub fn new() -> Self {
552        Self { date: None, ip: None, user_agent: None }
553    }
554}
555impl Default for CreateTokenAccountCompanyOwnershipDeclaration {
556    fn default() -> Self {
557        Self::new()
558    }
559}
560/// This value is used to determine if a business is exempt from providing ultimate beneficial owners.
561/// See [this support article](https://support.stripe.com/questions/exemption-from-providing-ownership-details) and [changelog](https://docs.stripe.com/changelog/acacia/2025-01-27/ownership-exemption-reason-accounts-api) for more details.
562#[derive(Clone, Eq, PartialEq)]
563#[non_exhaustive]
564pub enum CreateTokenAccountCompanyOwnershipExemptionReason {
565    QualifiedEntityExceedsOwnershipThreshold,
566    QualifiesAsFinancialInstitution,
567    /// An unrecognized value from Stripe. Should not be used as a request parameter.
568    Unknown(String),
569}
570impl CreateTokenAccountCompanyOwnershipExemptionReason {
571    pub fn as_str(&self) -> &str {
572        use CreateTokenAccountCompanyOwnershipExemptionReason::*;
573        match self {
574            QualifiedEntityExceedsOwnershipThreshold => {
575                "qualified_entity_exceeds_ownership_threshold"
576            }
577            QualifiesAsFinancialInstitution => "qualifies_as_financial_institution",
578            Unknown(v) => v,
579        }
580    }
581}
582
583impl std::str::FromStr for CreateTokenAccountCompanyOwnershipExemptionReason {
584    type Err = std::convert::Infallible;
585    fn from_str(s: &str) -> Result<Self, Self::Err> {
586        use CreateTokenAccountCompanyOwnershipExemptionReason::*;
587        match s {
588            "qualified_entity_exceeds_ownership_threshold" => {
589                Ok(QualifiedEntityExceedsOwnershipThreshold)
590            }
591            "qualifies_as_financial_institution" => Ok(QualifiesAsFinancialInstitution),
592            v => {
593                tracing::warn!(
594                    "Unknown value '{}' for enum '{}'",
595                    v,
596                    "CreateTokenAccountCompanyOwnershipExemptionReason"
597                );
598                Ok(Unknown(v.to_owned()))
599            }
600        }
601    }
602}
603impl std::fmt::Display for CreateTokenAccountCompanyOwnershipExemptionReason {
604    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
605        f.write_str(self.as_str())
606    }
607}
608
609#[cfg(not(feature = "redact-generated-debug"))]
610impl std::fmt::Debug for CreateTokenAccountCompanyOwnershipExemptionReason {
611    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
612        f.write_str(self.as_str())
613    }
614}
615#[cfg(feature = "redact-generated-debug")]
616impl std::fmt::Debug for CreateTokenAccountCompanyOwnershipExemptionReason {
617    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
618        f.debug_struct(stringify!(CreateTokenAccountCompanyOwnershipExemptionReason))
619            .finish_non_exhaustive()
620    }
621}
622impl serde::Serialize for CreateTokenAccountCompanyOwnershipExemptionReason {
623    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
624    where
625        S: serde::Serializer,
626    {
627        serializer.serialize_str(self.as_str())
628    }
629}
630#[cfg(feature = "deserialize")]
631impl<'de> serde::Deserialize<'de> for CreateTokenAccountCompanyOwnershipExemptionReason {
632    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
633        use std::str::FromStr;
634        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
635        Ok(Self::from_str(&s).expect("infallible"))
636    }
637}
638/// When the business was incorporated or registered.
639#[derive(Copy, Clone, Eq, PartialEq)]
640#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
641#[derive(serde::Serialize)]
642pub struct CreateTokenAccountCompanyRegistrationDate {
643    /// The day of registration, between 1 and 31.
644    pub day: i64,
645    /// The month of registration, between 1 and 12.
646    pub month: i64,
647    /// The four-digit year of registration.
648    pub year: i64,
649}
650#[cfg(feature = "redact-generated-debug")]
651impl std::fmt::Debug for CreateTokenAccountCompanyRegistrationDate {
652    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
653        f.debug_struct("CreateTokenAccountCompanyRegistrationDate").finish_non_exhaustive()
654    }
655}
656impl CreateTokenAccountCompanyRegistrationDate {
657    pub fn new(day: impl Into<i64>, month: impl Into<i64>, year: impl Into<i64>) -> Self {
658        Self { day: day.into(), month: month.into(), year: year.into() }
659    }
660}
661/// This hash is used to attest that the representative is authorized to act as the representative of their legal entity.
662#[derive(Clone, Eq, PartialEq)]
663#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
664#[derive(serde::Serialize)]
665pub struct CreateTokenAccountCompanyRepresentativeDeclaration {
666    /// The Unix timestamp marking when the representative declaration attestation was made.
667    #[serde(skip_serializing_if = "Option::is_none")]
668    pub date: Option<stripe_types::Timestamp>,
669    /// The IP address from which the representative declaration attestation was made.
670    #[serde(skip_serializing_if = "Option::is_none")]
671    pub ip: Option<String>,
672    /// The user agent of the browser from which the representative declaration attestation was made.
673    #[serde(skip_serializing_if = "Option::is_none")]
674    pub user_agent: Option<String>,
675}
676#[cfg(feature = "redact-generated-debug")]
677impl std::fmt::Debug for CreateTokenAccountCompanyRepresentativeDeclaration {
678    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
679        f.debug_struct("CreateTokenAccountCompanyRepresentativeDeclaration").finish_non_exhaustive()
680    }
681}
682impl CreateTokenAccountCompanyRepresentativeDeclaration {
683    pub fn new() -> Self {
684        Self { date: None, ip: None, user_agent: None }
685    }
686}
687impl Default for CreateTokenAccountCompanyRepresentativeDeclaration {
688    fn default() -> Self {
689        Self::new()
690    }
691}
692/// The category identifying the legal structure of the company or legal entity.
693/// See [Business structure](/connect/identity-verification#business-structure) for more details.
694/// Pass an empty string to unset this value.
695#[derive(Clone, Eq, PartialEq)]
696#[non_exhaustive]
697pub enum CreateTokenAccountCompanyStructure {
698    FreeZoneEstablishment,
699    FreeZoneLlc,
700    GovernmentInstrumentality,
701    GovernmentalUnit,
702    IncorporatedNonProfit,
703    IncorporatedPartnership,
704    LimitedLiabilityPartnership,
705    Llc,
706    MultiMemberLlc,
707    PrivateCompany,
708    PrivateCorporation,
709    PrivatePartnership,
710    PublicCompany,
711    PublicCorporation,
712    PublicPartnership,
713    RegisteredCharity,
714    SingleMemberLlc,
715    SoleEstablishment,
716    SoleProprietorship,
717    TaxExemptGovernmentInstrumentality,
718    UnincorporatedAssociation,
719    UnincorporatedNonProfit,
720    UnincorporatedPartnership,
721    /// An unrecognized value from Stripe. Should not be used as a request parameter.
722    Unknown(String),
723}
724impl CreateTokenAccountCompanyStructure {
725    pub fn as_str(&self) -> &str {
726        use CreateTokenAccountCompanyStructure::*;
727        match self {
728            FreeZoneEstablishment => "free_zone_establishment",
729            FreeZoneLlc => "free_zone_llc",
730            GovernmentInstrumentality => "government_instrumentality",
731            GovernmentalUnit => "governmental_unit",
732            IncorporatedNonProfit => "incorporated_non_profit",
733            IncorporatedPartnership => "incorporated_partnership",
734            LimitedLiabilityPartnership => "limited_liability_partnership",
735            Llc => "llc",
736            MultiMemberLlc => "multi_member_llc",
737            PrivateCompany => "private_company",
738            PrivateCorporation => "private_corporation",
739            PrivatePartnership => "private_partnership",
740            PublicCompany => "public_company",
741            PublicCorporation => "public_corporation",
742            PublicPartnership => "public_partnership",
743            RegisteredCharity => "registered_charity",
744            SingleMemberLlc => "single_member_llc",
745            SoleEstablishment => "sole_establishment",
746            SoleProprietorship => "sole_proprietorship",
747            TaxExemptGovernmentInstrumentality => "tax_exempt_government_instrumentality",
748            UnincorporatedAssociation => "unincorporated_association",
749            UnincorporatedNonProfit => "unincorporated_non_profit",
750            UnincorporatedPartnership => "unincorporated_partnership",
751            Unknown(v) => v,
752        }
753    }
754}
755
756impl std::str::FromStr for CreateTokenAccountCompanyStructure {
757    type Err = std::convert::Infallible;
758    fn from_str(s: &str) -> Result<Self, Self::Err> {
759        use CreateTokenAccountCompanyStructure::*;
760        match s {
761            "free_zone_establishment" => Ok(FreeZoneEstablishment),
762            "free_zone_llc" => Ok(FreeZoneLlc),
763            "government_instrumentality" => Ok(GovernmentInstrumentality),
764            "governmental_unit" => Ok(GovernmentalUnit),
765            "incorporated_non_profit" => Ok(IncorporatedNonProfit),
766            "incorporated_partnership" => Ok(IncorporatedPartnership),
767            "limited_liability_partnership" => Ok(LimitedLiabilityPartnership),
768            "llc" => Ok(Llc),
769            "multi_member_llc" => Ok(MultiMemberLlc),
770            "private_company" => Ok(PrivateCompany),
771            "private_corporation" => Ok(PrivateCorporation),
772            "private_partnership" => Ok(PrivatePartnership),
773            "public_company" => Ok(PublicCompany),
774            "public_corporation" => Ok(PublicCorporation),
775            "public_partnership" => Ok(PublicPartnership),
776            "registered_charity" => Ok(RegisteredCharity),
777            "single_member_llc" => Ok(SingleMemberLlc),
778            "sole_establishment" => Ok(SoleEstablishment),
779            "sole_proprietorship" => Ok(SoleProprietorship),
780            "tax_exempt_government_instrumentality" => Ok(TaxExemptGovernmentInstrumentality),
781            "unincorporated_association" => Ok(UnincorporatedAssociation),
782            "unincorporated_non_profit" => Ok(UnincorporatedNonProfit),
783            "unincorporated_partnership" => Ok(UnincorporatedPartnership),
784            v => {
785                tracing::warn!(
786                    "Unknown value '{}' for enum '{}'",
787                    v,
788                    "CreateTokenAccountCompanyStructure"
789                );
790                Ok(Unknown(v.to_owned()))
791            }
792        }
793    }
794}
795impl std::fmt::Display for CreateTokenAccountCompanyStructure {
796    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
797        f.write_str(self.as_str())
798    }
799}
800
801#[cfg(not(feature = "redact-generated-debug"))]
802impl std::fmt::Debug for CreateTokenAccountCompanyStructure {
803    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
804        f.write_str(self.as_str())
805    }
806}
807#[cfg(feature = "redact-generated-debug")]
808impl std::fmt::Debug for CreateTokenAccountCompanyStructure {
809    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
810        f.debug_struct(stringify!(CreateTokenAccountCompanyStructure)).finish_non_exhaustive()
811    }
812}
813impl serde::Serialize for CreateTokenAccountCompanyStructure {
814    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
815    where
816        S: serde::Serializer,
817    {
818        serializer.serialize_str(self.as_str())
819    }
820}
821#[cfg(feature = "deserialize")]
822impl<'de> serde::Deserialize<'de> for CreateTokenAccountCompanyStructure {
823    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
824        use std::str::FromStr;
825        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
826        Ok(Self::from_str(&s).expect("infallible"))
827    }
828}
829/// Information on the verification state of the company.
830#[derive(Clone, Eq, PartialEq)]
831#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
832#[derive(serde::Serialize)]
833pub struct CreateTokenAccountCompanyVerification {
834    /// A document verifying the business.
835    #[serde(skip_serializing_if = "Option::is_none")]
836    pub document: Option<CreateTokenAccountCompanyVerificationDocument>,
837}
838#[cfg(feature = "redact-generated-debug")]
839impl std::fmt::Debug for CreateTokenAccountCompanyVerification {
840    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
841        f.debug_struct("CreateTokenAccountCompanyVerification").finish_non_exhaustive()
842    }
843}
844impl CreateTokenAccountCompanyVerification {
845    pub fn new() -> Self {
846        Self { document: None }
847    }
848}
849impl Default for CreateTokenAccountCompanyVerification {
850    fn default() -> Self {
851        Self::new()
852    }
853}
854/// A document verifying the business.
855#[derive(Clone, Eq, PartialEq)]
856#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
857#[derive(serde::Serialize)]
858pub struct CreateTokenAccountCompanyVerificationDocument {
859    /// The back of a document returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `additional_verification`.
860    /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size.
861    #[serde(skip_serializing_if = "Option::is_none")]
862    pub back: Option<String>,
863    /// The front of a document returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `additional_verification`.
864    /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size.
865    #[serde(skip_serializing_if = "Option::is_none")]
866    pub front: Option<String>,
867}
868#[cfg(feature = "redact-generated-debug")]
869impl std::fmt::Debug for CreateTokenAccountCompanyVerificationDocument {
870    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
871        f.debug_struct("CreateTokenAccountCompanyVerificationDocument").finish_non_exhaustive()
872    }
873}
874impl CreateTokenAccountCompanyVerificationDocument {
875    pub fn new() -> Self {
876        Self { back: None, front: None }
877    }
878}
879impl Default for CreateTokenAccountCompanyVerificationDocument {
880    fn default() -> Self {
881        Self::new()
882    }
883}
884/// Information about the person represented by the account.
885#[derive(Clone)]
886#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
887#[derive(serde::Serialize)]
888pub struct CreateTokenAccountIndividual {
889    /// The individual's primary address.
890    #[serde(skip_serializing_if = "Option::is_none")]
891    pub address: Option<CreateTokenAccountIndividualAddress>,
892    /// The Kana variation of the individual's primary address (Japan only).
893    #[serde(skip_serializing_if = "Option::is_none")]
894    pub address_kana: Option<CreateTokenAccountIndividualAddressKana>,
895    /// The Kanji variation of the individual's primary address (Japan only).
896    #[serde(skip_serializing_if = "Option::is_none")]
897    pub address_kanji: Option<CreateTokenAccountIndividualAddressKanji>,
898    /// The individual's date of birth.
899    #[serde(skip_serializing_if = "Option::is_none")]
900    pub dob: Option<DateOfBirthSpecs>,
901    /// The individual's email address.
902    #[serde(skip_serializing_if = "Option::is_none")]
903    pub email: Option<String>,
904    /// The individual's first name.
905    #[serde(skip_serializing_if = "Option::is_none")]
906    pub first_name: Option<String>,
907    /// The Kana variation of the individual's first name (Japan only).
908    #[serde(skip_serializing_if = "Option::is_none")]
909    pub first_name_kana: Option<String>,
910    /// The Kanji variation of the individual's first name (Japan only).
911    #[serde(skip_serializing_if = "Option::is_none")]
912    pub first_name_kanji: Option<String>,
913    /// A list of alternate names or aliases that the individual is known by.
914    #[serde(skip_serializing_if = "Option::is_none")]
915    pub full_name_aliases: Option<Vec<String>>,
916    /// The individual's gender
917    #[serde(skip_serializing_if = "Option::is_none")]
918    pub gender: Option<String>,
919    /// The government-issued ID number of the individual, as appropriate for the representative's country.
920    /// (Examples are a Social Security Number in the U.S., or a Social Insurance Number in Canada).
921    /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](/js/tokens/create_token?type=pii).
922    #[serde(skip_serializing_if = "Option::is_none")]
923    pub id_number: Option<String>,
924    /// The government-issued secondary ID number of the individual, as appropriate for the representative's country, will be used for enhanced verification checks.
925    /// In Thailand, this would be the laser code found on the back of an ID card.
926    /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](/js/tokens/create_token?type=pii).
927    #[serde(skip_serializing_if = "Option::is_none")]
928    pub id_number_secondary: Option<String>,
929    /// The individual's last name.
930    #[serde(skip_serializing_if = "Option::is_none")]
931    pub last_name: Option<String>,
932    /// The Kana variation of the individual's last name (Japan only).
933    #[serde(skip_serializing_if = "Option::is_none")]
934    pub last_name_kana: Option<String>,
935    /// The Kanji variation of the individual's last name (Japan only).
936    #[serde(skip_serializing_if = "Option::is_none")]
937    pub last_name_kanji: Option<String>,
938    /// The individual's maiden name.
939    #[serde(skip_serializing_if = "Option::is_none")]
940    pub maiden_name: Option<String>,
941    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
942    /// This can be useful for storing additional information about the object in a structured format.
943    /// Individual keys can be unset by posting an empty value to them.
944    /// All keys can be unset by posting an empty value to `metadata`.
945    #[serde(skip_serializing_if = "Option::is_none")]
946    pub metadata: Option<std::collections::HashMap<String, String>>,
947    /// The individual's phone number.
948    #[serde(skip_serializing_if = "Option::is_none")]
949    pub phone: Option<String>,
950    /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
951    #[serde(skip_serializing_if = "Option::is_none")]
952    pub political_exposure: Option<CreateTokenAccountIndividualPoliticalExposure>,
953    /// The individual's registered address.
954    #[serde(skip_serializing_if = "Option::is_none")]
955    pub registered_address: Option<CreateTokenAccountIndividualRegisteredAddress>,
956    /// Describes the person’s relationship to the account.
957    #[serde(skip_serializing_if = "Option::is_none")]
958    pub relationship: Option<CreateTokenAccountIndividualRelationship>,
959    /// The last four digits of the individual's Social Security Number (U.S. only).
960    #[serde(skip_serializing_if = "Option::is_none")]
961    pub ssn_last_4: Option<String>,
962    /// The individual's verification document information.
963    #[serde(skip_serializing_if = "Option::is_none")]
964    pub verification: Option<PersonVerificationSpecs>,
965}
966#[cfg(feature = "redact-generated-debug")]
967impl std::fmt::Debug for CreateTokenAccountIndividual {
968    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
969        f.debug_struct("CreateTokenAccountIndividual").finish_non_exhaustive()
970    }
971}
972impl CreateTokenAccountIndividual {
973    pub fn new() -> Self {
974        Self {
975            address: None,
976            address_kana: None,
977            address_kanji: None,
978            dob: None,
979            email: None,
980            first_name: None,
981            first_name_kana: None,
982            first_name_kanji: None,
983            full_name_aliases: None,
984            gender: None,
985            id_number: None,
986            id_number_secondary: None,
987            last_name: None,
988            last_name_kana: None,
989            last_name_kanji: None,
990            maiden_name: None,
991            metadata: None,
992            phone: None,
993            political_exposure: None,
994            registered_address: None,
995            relationship: None,
996            ssn_last_4: None,
997            verification: None,
998        }
999    }
1000}
1001impl Default for CreateTokenAccountIndividual {
1002    fn default() -> Self {
1003        Self::new()
1004    }
1005}
1006/// The individual's primary address.
1007#[derive(Clone, Eq, PartialEq)]
1008#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1009#[derive(serde::Serialize)]
1010pub struct CreateTokenAccountIndividualAddress {
1011    /// City, district, suburb, town, or village.
1012    #[serde(skip_serializing_if = "Option::is_none")]
1013    pub city: Option<String>,
1014    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1015    #[serde(skip_serializing_if = "Option::is_none")]
1016    pub country: Option<String>,
1017    /// Address line 1, such as the street, PO Box, or company name.
1018    #[serde(skip_serializing_if = "Option::is_none")]
1019    pub line1: Option<String>,
1020    /// Address line 2, such as the apartment, suite, unit, or building.
1021    #[serde(skip_serializing_if = "Option::is_none")]
1022    pub line2: Option<String>,
1023    /// ZIP or postal code.
1024    #[serde(skip_serializing_if = "Option::is_none")]
1025    pub postal_code: Option<String>,
1026    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
1027    #[serde(skip_serializing_if = "Option::is_none")]
1028    pub state: Option<String>,
1029}
1030#[cfg(feature = "redact-generated-debug")]
1031impl std::fmt::Debug for CreateTokenAccountIndividualAddress {
1032    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1033        f.debug_struct("CreateTokenAccountIndividualAddress").finish_non_exhaustive()
1034    }
1035}
1036impl CreateTokenAccountIndividualAddress {
1037    pub fn new() -> Self {
1038        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
1039    }
1040}
1041impl Default for CreateTokenAccountIndividualAddress {
1042    fn default() -> Self {
1043        Self::new()
1044    }
1045}
1046/// The Kana variation of the individual's primary address (Japan only).
1047#[derive(Clone, Eq, PartialEq)]
1048#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1049#[derive(serde::Serialize)]
1050pub struct CreateTokenAccountIndividualAddressKana {
1051    /// City or ward.
1052    #[serde(skip_serializing_if = "Option::is_none")]
1053    pub city: Option<String>,
1054    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1055    #[serde(skip_serializing_if = "Option::is_none")]
1056    pub country: Option<String>,
1057    /// Block or building number.
1058    #[serde(skip_serializing_if = "Option::is_none")]
1059    pub line1: Option<String>,
1060    /// Building details.
1061    #[serde(skip_serializing_if = "Option::is_none")]
1062    pub line2: Option<String>,
1063    /// Postal code.
1064    #[serde(skip_serializing_if = "Option::is_none")]
1065    pub postal_code: Option<String>,
1066    /// Prefecture.
1067    #[serde(skip_serializing_if = "Option::is_none")]
1068    pub state: Option<String>,
1069    /// Town or cho-me.
1070    #[serde(skip_serializing_if = "Option::is_none")]
1071    pub town: Option<String>,
1072}
1073#[cfg(feature = "redact-generated-debug")]
1074impl std::fmt::Debug for CreateTokenAccountIndividualAddressKana {
1075    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1076        f.debug_struct("CreateTokenAccountIndividualAddressKana").finish_non_exhaustive()
1077    }
1078}
1079impl CreateTokenAccountIndividualAddressKana {
1080    pub fn new() -> Self {
1081        Self {
1082            city: None,
1083            country: None,
1084            line1: None,
1085            line2: None,
1086            postal_code: None,
1087            state: None,
1088            town: None,
1089        }
1090    }
1091}
1092impl Default for CreateTokenAccountIndividualAddressKana {
1093    fn default() -> Self {
1094        Self::new()
1095    }
1096}
1097/// The Kanji variation of the individual's primary address (Japan only).
1098#[derive(Clone, Eq, PartialEq)]
1099#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1100#[derive(serde::Serialize)]
1101pub struct CreateTokenAccountIndividualAddressKanji {
1102    /// City or ward.
1103    #[serde(skip_serializing_if = "Option::is_none")]
1104    pub city: Option<String>,
1105    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1106    #[serde(skip_serializing_if = "Option::is_none")]
1107    pub country: Option<String>,
1108    /// Block or building number.
1109    #[serde(skip_serializing_if = "Option::is_none")]
1110    pub line1: Option<String>,
1111    /// Building details.
1112    #[serde(skip_serializing_if = "Option::is_none")]
1113    pub line2: Option<String>,
1114    /// Postal code.
1115    #[serde(skip_serializing_if = "Option::is_none")]
1116    pub postal_code: Option<String>,
1117    /// Prefecture.
1118    #[serde(skip_serializing_if = "Option::is_none")]
1119    pub state: Option<String>,
1120    /// Town or cho-me.
1121    #[serde(skip_serializing_if = "Option::is_none")]
1122    pub town: Option<String>,
1123}
1124#[cfg(feature = "redact-generated-debug")]
1125impl std::fmt::Debug for CreateTokenAccountIndividualAddressKanji {
1126    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1127        f.debug_struct("CreateTokenAccountIndividualAddressKanji").finish_non_exhaustive()
1128    }
1129}
1130impl CreateTokenAccountIndividualAddressKanji {
1131    pub fn new() -> Self {
1132        Self {
1133            city: None,
1134            country: None,
1135            line1: None,
1136            line2: None,
1137            postal_code: None,
1138            state: None,
1139            town: None,
1140        }
1141    }
1142}
1143impl Default for CreateTokenAccountIndividualAddressKanji {
1144    fn default() -> Self {
1145        Self::new()
1146    }
1147}
1148/// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
1149#[derive(Clone, Eq, PartialEq)]
1150#[non_exhaustive]
1151pub enum CreateTokenAccountIndividualPoliticalExposure {
1152    Existing,
1153    None,
1154    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1155    Unknown(String),
1156}
1157impl CreateTokenAccountIndividualPoliticalExposure {
1158    pub fn as_str(&self) -> &str {
1159        use CreateTokenAccountIndividualPoliticalExposure::*;
1160        match self {
1161            Existing => "existing",
1162            None => "none",
1163            Unknown(v) => v,
1164        }
1165    }
1166}
1167
1168impl std::str::FromStr for CreateTokenAccountIndividualPoliticalExposure {
1169    type Err = std::convert::Infallible;
1170    fn from_str(s: &str) -> Result<Self, Self::Err> {
1171        use CreateTokenAccountIndividualPoliticalExposure::*;
1172        match s {
1173            "existing" => Ok(Existing),
1174            "none" => Ok(None),
1175            v => {
1176                tracing::warn!(
1177                    "Unknown value '{}' for enum '{}'",
1178                    v,
1179                    "CreateTokenAccountIndividualPoliticalExposure"
1180                );
1181                Ok(Unknown(v.to_owned()))
1182            }
1183        }
1184    }
1185}
1186impl std::fmt::Display for CreateTokenAccountIndividualPoliticalExposure {
1187    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1188        f.write_str(self.as_str())
1189    }
1190}
1191
1192#[cfg(not(feature = "redact-generated-debug"))]
1193impl std::fmt::Debug for CreateTokenAccountIndividualPoliticalExposure {
1194    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1195        f.write_str(self.as_str())
1196    }
1197}
1198#[cfg(feature = "redact-generated-debug")]
1199impl std::fmt::Debug for CreateTokenAccountIndividualPoliticalExposure {
1200    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1201        f.debug_struct(stringify!(CreateTokenAccountIndividualPoliticalExposure))
1202            .finish_non_exhaustive()
1203    }
1204}
1205impl serde::Serialize for CreateTokenAccountIndividualPoliticalExposure {
1206    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1207    where
1208        S: serde::Serializer,
1209    {
1210        serializer.serialize_str(self.as_str())
1211    }
1212}
1213#[cfg(feature = "deserialize")]
1214impl<'de> serde::Deserialize<'de> for CreateTokenAccountIndividualPoliticalExposure {
1215    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1216        use std::str::FromStr;
1217        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1218        Ok(Self::from_str(&s).expect("infallible"))
1219    }
1220}
1221/// The individual's registered address.
1222#[derive(Clone, Eq, PartialEq)]
1223#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1224#[derive(serde::Serialize)]
1225pub struct CreateTokenAccountIndividualRegisteredAddress {
1226    /// City, district, suburb, town, or village.
1227    #[serde(skip_serializing_if = "Option::is_none")]
1228    pub city: Option<String>,
1229    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1230    #[serde(skip_serializing_if = "Option::is_none")]
1231    pub country: Option<String>,
1232    /// Address line 1, such as the street, PO Box, or company name.
1233    #[serde(skip_serializing_if = "Option::is_none")]
1234    pub line1: Option<String>,
1235    /// Address line 2, such as the apartment, suite, unit, or building.
1236    #[serde(skip_serializing_if = "Option::is_none")]
1237    pub line2: Option<String>,
1238    /// ZIP or postal code.
1239    #[serde(skip_serializing_if = "Option::is_none")]
1240    pub postal_code: Option<String>,
1241    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
1242    #[serde(skip_serializing_if = "Option::is_none")]
1243    pub state: Option<String>,
1244}
1245#[cfg(feature = "redact-generated-debug")]
1246impl std::fmt::Debug for CreateTokenAccountIndividualRegisteredAddress {
1247    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1248        f.debug_struct("CreateTokenAccountIndividualRegisteredAddress").finish_non_exhaustive()
1249    }
1250}
1251impl CreateTokenAccountIndividualRegisteredAddress {
1252    pub fn new() -> Self {
1253        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
1254    }
1255}
1256impl Default for CreateTokenAccountIndividualRegisteredAddress {
1257    fn default() -> Self {
1258        Self::new()
1259    }
1260}
1261/// Describes the person’s relationship to the account.
1262#[derive(Clone)]
1263#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1264#[derive(serde::Serialize)]
1265pub struct CreateTokenAccountIndividualRelationship {
1266    /// Whether the person is a director of the account's legal entity.
1267    /// Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations.
1268    #[serde(skip_serializing_if = "Option::is_none")]
1269    pub director: Option<bool>,
1270    /// Whether the person has significant responsibility to control, manage, or direct the organization.
1271    #[serde(skip_serializing_if = "Option::is_none")]
1272    pub executive: Option<bool>,
1273    /// Whether the person is an owner of the account’s legal entity.
1274    #[serde(skip_serializing_if = "Option::is_none")]
1275    pub owner: Option<bool>,
1276    /// The percent owned by the person of the account's legal entity.
1277    #[serde(skip_serializing_if = "Option::is_none")]
1278    pub percent_ownership: Option<f64>,
1279    /// The person's title (e.g., CEO, Support Engineer).
1280    #[serde(skip_serializing_if = "Option::is_none")]
1281    pub title: Option<String>,
1282}
1283#[cfg(feature = "redact-generated-debug")]
1284impl std::fmt::Debug for CreateTokenAccountIndividualRelationship {
1285    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1286        f.debug_struct("CreateTokenAccountIndividualRelationship").finish_non_exhaustive()
1287    }
1288}
1289impl CreateTokenAccountIndividualRelationship {
1290    pub fn new() -> Self {
1291        Self { director: None, executive: None, owner: None, percent_ownership: None, title: None }
1292    }
1293}
1294impl Default for CreateTokenAccountIndividualRelationship {
1295    fn default() -> Self {
1296        Self::new()
1297    }
1298}
1299/// The bank account this token will represent.
1300#[derive(Clone, Eq, PartialEq)]
1301#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1302#[derive(serde::Serialize)]
1303pub struct CreateTokenBankAccount {
1304    /// The name of the person or business that owns the bank account.
1305    /// This field is required when attaching the bank account to a `Customer` object.
1306    #[serde(skip_serializing_if = "Option::is_none")]
1307    pub account_holder_name: Option<String>,
1308    /// The type of entity that holds the account.
1309    /// It can be `company` or `individual`.
1310    /// This field is required when attaching the bank account to a `Customer` object.
1311    #[serde(skip_serializing_if = "Option::is_none")]
1312    pub account_holder_type: Option<CreateTokenBankAccountAccountHolderType>,
1313    /// The account number for the bank account, in string form. Must be a checking account.
1314    pub account_number: String,
1315    /// The bank account type.
1316    /// This can only be `checking` or `savings` in most countries.
1317    /// In Japan, this can only be `futsu` or `toza`.
1318    #[serde(skip_serializing_if = "Option::is_none")]
1319    pub account_type: Option<CreateTokenBankAccountAccountType>,
1320    /// The country in which the bank account is located.
1321    pub country: String,
1322    /// The currency the bank account is in.
1323    /// This must be a country/currency pairing that [Stripe supports.](https://docs.stripe.com/payouts).
1324    #[serde(skip_serializing_if = "Option::is_none")]
1325    pub currency: Option<stripe_types::Currency>,
1326    /// The ID of a Payment Method with a `type` of `us_bank_account`.
1327    /// The Payment Method's bank account information will be copied and returned as a Bank Account Token.
1328    /// This parameter is exclusive with respect to all other parameters in the `bank_account` hash.
1329    /// You must include the top-level `customer` parameter if the Payment Method is attached to a `Customer` object.
1330    /// If the Payment Method is not attached to a `Customer` object, it will be consumed and cannot be used again.
1331    /// You may not use Payment Methods which were created by a Setup Intent with `attach_to_self=true`.
1332    #[serde(skip_serializing_if = "Option::is_none")]
1333    pub payment_method: Option<String>,
1334    /// The routing number, sort code, or other country-appropriate institution number for the bank account.
1335    /// For US bank accounts, this is required and should be the ACH routing number, not the wire routing number.
1336    /// If you are providing an IBAN for `account_number`, this field is not required.
1337    #[serde(skip_serializing_if = "Option::is_none")]
1338    pub routing_number: Option<String>,
1339}
1340#[cfg(feature = "redact-generated-debug")]
1341impl std::fmt::Debug for CreateTokenBankAccount {
1342    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1343        f.debug_struct("CreateTokenBankAccount").finish_non_exhaustive()
1344    }
1345}
1346impl CreateTokenBankAccount {
1347    pub fn new(account_number: impl Into<String>, country: impl Into<String>) -> Self {
1348        Self {
1349            account_holder_name: None,
1350            account_holder_type: None,
1351            account_number: account_number.into(),
1352            account_type: None,
1353            country: country.into(),
1354            currency: None,
1355            payment_method: None,
1356            routing_number: None,
1357        }
1358    }
1359}
1360/// The type of entity that holds the account.
1361/// It can be `company` or `individual`.
1362/// This field is required when attaching the bank account to a `Customer` object.
1363#[derive(Clone, Eq, PartialEq)]
1364#[non_exhaustive]
1365pub enum CreateTokenBankAccountAccountHolderType {
1366    Company,
1367    Individual,
1368    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1369    Unknown(String),
1370}
1371impl CreateTokenBankAccountAccountHolderType {
1372    pub fn as_str(&self) -> &str {
1373        use CreateTokenBankAccountAccountHolderType::*;
1374        match self {
1375            Company => "company",
1376            Individual => "individual",
1377            Unknown(v) => v,
1378        }
1379    }
1380}
1381
1382impl std::str::FromStr for CreateTokenBankAccountAccountHolderType {
1383    type Err = std::convert::Infallible;
1384    fn from_str(s: &str) -> Result<Self, Self::Err> {
1385        use CreateTokenBankAccountAccountHolderType::*;
1386        match s {
1387            "company" => Ok(Company),
1388            "individual" => Ok(Individual),
1389            v => {
1390                tracing::warn!(
1391                    "Unknown value '{}' for enum '{}'",
1392                    v,
1393                    "CreateTokenBankAccountAccountHolderType"
1394                );
1395                Ok(Unknown(v.to_owned()))
1396            }
1397        }
1398    }
1399}
1400impl std::fmt::Display for CreateTokenBankAccountAccountHolderType {
1401    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1402        f.write_str(self.as_str())
1403    }
1404}
1405
1406#[cfg(not(feature = "redact-generated-debug"))]
1407impl std::fmt::Debug for CreateTokenBankAccountAccountHolderType {
1408    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1409        f.write_str(self.as_str())
1410    }
1411}
1412#[cfg(feature = "redact-generated-debug")]
1413impl std::fmt::Debug for CreateTokenBankAccountAccountHolderType {
1414    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1415        f.debug_struct(stringify!(CreateTokenBankAccountAccountHolderType)).finish_non_exhaustive()
1416    }
1417}
1418impl serde::Serialize for CreateTokenBankAccountAccountHolderType {
1419    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1420    where
1421        S: serde::Serializer,
1422    {
1423        serializer.serialize_str(self.as_str())
1424    }
1425}
1426#[cfg(feature = "deserialize")]
1427impl<'de> serde::Deserialize<'de> for CreateTokenBankAccountAccountHolderType {
1428    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1429        use std::str::FromStr;
1430        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1431        Ok(Self::from_str(&s).expect("infallible"))
1432    }
1433}
1434/// The bank account type.
1435/// This can only be `checking` or `savings` in most countries.
1436/// In Japan, this can only be `futsu` or `toza`.
1437#[derive(Clone, Eq, PartialEq)]
1438#[non_exhaustive]
1439pub enum CreateTokenBankAccountAccountType {
1440    Checking,
1441    Futsu,
1442    Savings,
1443    Toza,
1444    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1445    Unknown(String),
1446}
1447impl CreateTokenBankAccountAccountType {
1448    pub fn as_str(&self) -> &str {
1449        use CreateTokenBankAccountAccountType::*;
1450        match self {
1451            Checking => "checking",
1452            Futsu => "futsu",
1453            Savings => "savings",
1454            Toza => "toza",
1455            Unknown(v) => v,
1456        }
1457    }
1458}
1459
1460impl std::str::FromStr for CreateTokenBankAccountAccountType {
1461    type Err = std::convert::Infallible;
1462    fn from_str(s: &str) -> Result<Self, Self::Err> {
1463        use CreateTokenBankAccountAccountType::*;
1464        match s {
1465            "checking" => Ok(Checking),
1466            "futsu" => Ok(Futsu),
1467            "savings" => Ok(Savings),
1468            "toza" => Ok(Toza),
1469            v => {
1470                tracing::warn!(
1471                    "Unknown value '{}' for enum '{}'",
1472                    v,
1473                    "CreateTokenBankAccountAccountType"
1474                );
1475                Ok(Unknown(v.to_owned()))
1476            }
1477        }
1478    }
1479}
1480impl std::fmt::Display for CreateTokenBankAccountAccountType {
1481    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1482        f.write_str(self.as_str())
1483    }
1484}
1485
1486#[cfg(not(feature = "redact-generated-debug"))]
1487impl std::fmt::Debug for CreateTokenBankAccountAccountType {
1488    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1489        f.write_str(self.as_str())
1490    }
1491}
1492#[cfg(feature = "redact-generated-debug")]
1493impl std::fmt::Debug for CreateTokenBankAccountAccountType {
1494    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1495        f.debug_struct(stringify!(CreateTokenBankAccountAccountType)).finish_non_exhaustive()
1496    }
1497}
1498impl serde::Serialize for CreateTokenBankAccountAccountType {
1499    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1500    where
1501        S: serde::Serializer,
1502    {
1503        serializer.serialize_str(self.as_str())
1504    }
1505}
1506#[cfg(feature = "deserialize")]
1507impl<'de> serde::Deserialize<'de> for CreateTokenBankAccountAccountType {
1508    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1509        use std::str::FromStr;
1510        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1511        Ok(Self::from_str(&s).expect("infallible"))
1512    }
1513}
1514/// The card this token will represent.
1515/// If you also pass in a customer, the card must be the ID of a card belonging to the customer.
1516/// Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below.
1517#[derive(Clone, Eq, PartialEq)]
1518#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1519#[derive(serde::Serialize)]
1520#[serde(rename_all = "snake_case")]
1521pub enum CreateTokenCard {
1522    #[serde(untagged)]
1523    CreditCardSpecs(CreateTokenCreditCardSpecs),
1524    #[serde(untagged)]
1525    String(String),
1526}
1527#[cfg(feature = "redact-generated-debug")]
1528impl std::fmt::Debug for CreateTokenCard {
1529    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1530        f.debug_struct("CreateTokenCard").finish_non_exhaustive()
1531    }
1532}
1533/// The card this token will represent.
1534/// If you also pass in a customer, the card must be the ID of a card belonging to the customer.
1535/// Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below.
1536#[derive(Clone, Eq, PartialEq)]
1537#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1538#[derive(serde::Serialize)]
1539pub struct CreateTokenCreditCardSpecs {
1540    /// City / District / Suburb / Town / Village.
1541    #[serde(skip_serializing_if = "Option::is_none")]
1542    pub address_city: Option<String>,
1543    /// Billing address country, if provided.
1544    #[serde(skip_serializing_if = "Option::is_none")]
1545    pub address_country: Option<String>,
1546    /// Address line 1 (Street address / PO Box / Company name).
1547    #[serde(skip_serializing_if = "Option::is_none")]
1548    pub address_line1: Option<String>,
1549    /// Address line 2 (Apartment / Suite / Unit / Building).
1550    #[serde(skip_serializing_if = "Option::is_none")]
1551    pub address_line2: Option<String>,
1552    /// State / County / Province / Region.
1553    #[serde(skip_serializing_if = "Option::is_none")]
1554    pub address_state: Option<String>,
1555    /// ZIP or postal code.
1556    #[serde(skip_serializing_if = "Option::is_none")]
1557    pub address_zip: Option<String>,
1558    /// Required in order to add the card to an account; in all other cases, this parameter is not used.
1559    /// When added to an account, the card (which must be a debit card) can be used as a transfer destination for funds in this currency.
1560    #[serde(skip_serializing_if = "Option::is_none")]
1561    pub currency: Option<stripe_types::Currency>,
1562    /// Card security code. Highly recommended to always include this value.
1563    #[serde(skip_serializing_if = "Option::is_none")]
1564    pub cvc: Option<String>,
1565    /// Two-digit number representing the card's expiration month.
1566    pub exp_month: String,
1567    /// Two- or four-digit number representing the card's expiration year.
1568    pub exp_year: String,
1569    /// Cardholder's full name.
1570    #[serde(skip_serializing_if = "Option::is_none")]
1571    pub name: Option<String>,
1572    /// Contains information about card networks used to process the payment.
1573    #[serde(skip_serializing_if = "Option::is_none")]
1574    pub networks: Option<CreateTokenCreditCardSpecsNetworks>,
1575    /// The card number, as a string without any separators.
1576    pub number: String,
1577}
1578#[cfg(feature = "redact-generated-debug")]
1579impl std::fmt::Debug for CreateTokenCreditCardSpecs {
1580    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1581        f.debug_struct("CreateTokenCreditCardSpecs").finish_non_exhaustive()
1582    }
1583}
1584impl CreateTokenCreditCardSpecs {
1585    pub fn new(
1586        exp_month: impl Into<String>,
1587        exp_year: impl Into<String>,
1588        number: impl Into<String>,
1589    ) -> Self {
1590        Self {
1591            address_city: None,
1592            address_country: None,
1593            address_line1: None,
1594            address_line2: None,
1595            address_state: None,
1596            address_zip: None,
1597            currency: None,
1598            cvc: None,
1599            exp_month: exp_month.into(),
1600            exp_year: exp_year.into(),
1601            name: None,
1602            networks: None,
1603            number: number.into(),
1604        }
1605    }
1606}
1607/// Contains information about card networks used to process the payment.
1608#[derive(Clone, Eq, PartialEq)]
1609#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1610#[derive(serde::Serialize)]
1611pub struct CreateTokenCreditCardSpecsNetworks {
1612    /// The customer's preferred card network for co-branded cards.
1613    /// Supports `cartes_bancaires`, `mastercard`, or `visa`.
1614    /// Selection of a network that does not apply to the card will be stored as `invalid_preference` on the card.
1615    #[serde(skip_serializing_if = "Option::is_none")]
1616    pub preferred: Option<CreateTokenCreditCardSpecsNetworksPreferred>,
1617}
1618#[cfg(feature = "redact-generated-debug")]
1619impl std::fmt::Debug for CreateTokenCreditCardSpecsNetworks {
1620    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1621        f.debug_struct("CreateTokenCreditCardSpecsNetworks").finish_non_exhaustive()
1622    }
1623}
1624impl CreateTokenCreditCardSpecsNetworks {
1625    pub fn new() -> Self {
1626        Self { preferred: None }
1627    }
1628}
1629impl Default for CreateTokenCreditCardSpecsNetworks {
1630    fn default() -> Self {
1631        Self::new()
1632    }
1633}
1634/// The customer's preferred card network for co-branded cards.
1635/// Supports `cartes_bancaires`, `mastercard`, or `visa`.
1636/// Selection of a network that does not apply to the card will be stored as `invalid_preference` on the card.
1637#[derive(Clone, Eq, PartialEq)]
1638#[non_exhaustive]
1639pub enum CreateTokenCreditCardSpecsNetworksPreferred {
1640    CartesBancaires,
1641    Mastercard,
1642    Visa,
1643    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1644    Unknown(String),
1645}
1646impl CreateTokenCreditCardSpecsNetworksPreferred {
1647    pub fn as_str(&self) -> &str {
1648        use CreateTokenCreditCardSpecsNetworksPreferred::*;
1649        match self {
1650            CartesBancaires => "cartes_bancaires",
1651            Mastercard => "mastercard",
1652            Visa => "visa",
1653            Unknown(v) => v,
1654        }
1655    }
1656}
1657
1658impl std::str::FromStr for CreateTokenCreditCardSpecsNetworksPreferred {
1659    type Err = std::convert::Infallible;
1660    fn from_str(s: &str) -> Result<Self, Self::Err> {
1661        use CreateTokenCreditCardSpecsNetworksPreferred::*;
1662        match s {
1663            "cartes_bancaires" => Ok(CartesBancaires),
1664            "mastercard" => Ok(Mastercard),
1665            "visa" => Ok(Visa),
1666            v => {
1667                tracing::warn!(
1668                    "Unknown value '{}' for enum '{}'",
1669                    v,
1670                    "CreateTokenCreditCardSpecsNetworksPreferred"
1671                );
1672                Ok(Unknown(v.to_owned()))
1673            }
1674        }
1675    }
1676}
1677impl std::fmt::Display for CreateTokenCreditCardSpecsNetworksPreferred {
1678    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1679        f.write_str(self.as_str())
1680    }
1681}
1682
1683#[cfg(not(feature = "redact-generated-debug"))]
1684impl std::fmt::Debug for CreateTokenCreditCardSpecsNetworksPreferred {
1685    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1686        f.write_str(self.as_str())
1687    }
1688}
1689#[cfg(feature = "redact-generated-debug")]
1690impl std::fmt::Debug for CreateTokenCreditCardSpecsNetworksPreferred {
1691    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1692        f.debug_struct(stringify!(CreateTokenCreditCardSpecsNetworksPreferred))
1693            .finish_non_exhaustive()
1694    }
1695}
1696impl serde::Serialize for CreateTokenCreditCardSpecsNetworksPreferred {
1697    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1698    where
1699        S: serde::Serializer,
1700    {
1701        serializer.serialize_str(self.as_str())
1702    }
1703}
1704#[cfg(feature = "deserialize")]
1705impl<'de> serde::Deserialize<'de> for CreateTokenCreditCardSpecsNetworksPreferred {
1706    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1707        use std::str::FromStr;
1708        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1709        Ok(Self::from_str(&s).expect("infallible"))
1710    }
1711}
1712/// The updated CVC value this token represents.
1713#[derive(Clone, Eq, PartialEq)]
1714#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1715#[derive(serde::Serialize)]
1716pub struct CreateTokenCvcUpdate {
1717    /// The CVC value, in string form.
1718    pub cvc: String,
1719}
1720#[cfg(feature = "redact-generated-debug")]
1721impl std::fmt::Debug for CreateTokenCvcUpdate {
1722    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1723        f.debug_struct("CreateTokenCvcUpdate").finish_non_exhaustive()
1724    }
1725}
1726impl CreateTokenCvcUpdate {
1727    pub fn new(cvc: impl Into<String>) -> Self {
1728        Self { cvc: cvc.into() }
1729    }
1730}
1731/// Information for the person this token represents.
1732#[derive(Clone)]
1733#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1734#[derive(serde::Serialize)]
1735pub struct CreateTokenPerson {
1736    /// Details on the legal guardian's or authorizer's acceptance of the required Stripe agreements.
1737    #[serde(skip_serializing_if = "Option::is_none")]
1738    pub additional_tos_acceptances: Option<CreateTokenPersonAdditionalTosAcceptances>,
1739    /// The person's address.
1740    #[serde(skip_serializing_if = "Option::is_none")]
1741    pub address: Option<CreateTokenPersonAddress>,
1742    /// The Kana variation of the person's address (Japan only).
1743    #[serde(skip_serializing_if = "Option::is_none")]
1744    pub address_kana: Option<CreateTokenPersonAddressKana>,
1745    /// The Kanji variation of the person's address (Japan only).
1746    #[serde(skip_serializing_if = "Option::is_none")]
1747    pub address_kanji: Option<CreateTokenPersonAddressKanji>,
1748    /// The person's date of birth.
1749    #[serde(skip_serializing_if = "Option::is_none")]
1750    pub dob: Option<DateOfBirthSpecs>,
1751    /// Documents that may be submitted to satisfy various informational requests.
1752    #[serde(skip_serializing_if = "Option::is_none")]
1753    pub documents: Option<CreateTokenPersonDocuments>,
1754    /// The person's email address.
1755    #[serde(skip_serializing_if = "Option::is_none")]
1756    pub email: Option<String>,
1757    /// The person's first name.
1758    #[serde(skip_serializing_if = "Option::is_none")]
1759    pub first_name: Option<String>,
1760    /// The Kana variation of the person's first name (Japan only).
1761    #[serde(skip_serializing_if = "Option::is_none")]
1762    pub first_name_kana: Option<String>,
1763    /// The Kanji variation of the person's first name (Japan only).
1764    #[serde(skip_serializing_if = "Option::is_none")]
1765    pub first_name_kanji: Option<String>,
1766    /// A list of alternate names or aliases that the person is known by.
1767    #[serde(skip_serializing_if = "Option::is_none")]
1768    pub full_name_aliases: Option<Vec<String>>,
1769    /// The person's gender (International regulations require either "male" or "female").
1770    #[serde(skip_serializing_if = "Option::is_none")]
1771    pub gender: Option<String>,
1772    /// The person's ID number, as appropriate for their country.
1773    /// For example, a social security number in the U.S., social insurance number in Canada, etc.
1774    /// Instead of the number itself, you can also provide a [PII token provided by Stripe.js](https://docs.stripe.com/js/tokens/create_token?type=pii).
1775    #[serde(skip_serializing_if = "Option::is_none")]
1776    pub id_number: Option<String>,
1777    /// The person's secondary ID number, as appropriate for their country, will be used for enhanced verification checks.
1778    /// In Thailand, this would be the laser code found on the back of an ID card.
1779    /// Instead of the number itself, you can also provide a [PII token provided by Stripe.js](https://docs.stripe.com/js/tokens/create_token?type=pii).
1780    #[serde(skip_serializing_if = "Option::is_none")]
1781    pub id_number_secondary: Option<String>,
1782    /// The person's last name.
1783    #[serde(skip_serializing_if = "Option::is_none")]
1784    pub last_name: Option<String>,
1785    /// The Kana variation of the person's last name (Japan only).
1786    #[serde(skip_serializing_if = "Option::is_none")]
1787    pub last_name_kana: Option<String>,
1788    /// The Kanji variation of the person's last name (Japan only).
1789    #[serde(skip_serializing_if = "Option::is_none")]
1790    pub last_name_kanji: Option<String>,
1791    /// The person's maiden name.
1792    #[serde(skip_serializing_if = "Option::is_none")]
1793    pub maiden_name: Option<String>,
1794    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
1795    /// This can be useful for storing additional information about the object in a structured format.
1796    /// Individual keys can be unset by posting an empty value to them.
1797    /// All keys can be unset by posting an empty value to `metadata`.
1798    #[serde(skip_serializing_if = "Option::is_none")]
1799    pub metadata: Option<std::collections::HashMap<String, String>>,
1800    /// The country where the person is a national.
1801    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)), or "XX" if unavailable.
1802    #[serde(skip_serializing_if = "Option::is_none")]
1803    pub nationality: Option<String>,
1804    /// The person's phone number.
1805    #[serde(skip_serializing_if = "Option::is_none")]
1806    pub phone: Option<String>,
1807    /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
1808    #[serde(skip_serializing_if = "Option::is_none")]
1809    pub political_exposure: Option<CreateTokenPersonPoliticalExposure>,
1810    /// The person's registered address.
1811    #[serde(skip_serializing_if = "Option::is_none")]
1812    pub registered_address: Option<CreateTokenPersonRegisteredAddress>,
1813    /// The relationship that this person has with the account's legal entity.
1814    #[serde(skip_serializing_if = "Option::is_none")]
1815    pub relationship: Option<CreateTokenPersonRelationship>,
1816    /// The last four digits of the person's Social Security number (U.S. only).
1817    #[serde(skip_serializing_if = "Option::is_none")]
1818    pub ssn_last_4: Option<String>,
1819    /// Demographic data related to the person.
1820    #[serde(skip_serializing_if = "Option::is_none")]
1821    pub us_cfpb_data: Option<CreateTokenPersonUsCfpbData>,
1822    /// The person's verification status.
1823    #[serde(skip_serializing_if = "Option::is_none")]
1824    pub verification: Option<PersonVerificationSpecs>,
1825}
1826#[cfg(feature = "redact-generated-debug")]
1827impl std::fmt::Debug for CreateTokenPerson {
1828    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1829        f.debug_struct("CreateTokenPerson").finish_non_exhaustive()
1830    }
1831}
1832impl CreateTokenPerson {
1833    pub fn new() -> Self {
1834        Self {
1835            additional_tos_acceptances: None,
1836            address: None,
1837            address_kana: None,
1838            address_kanji: None,
1839            dob: None,
1840            documents: None,
1841            email: None,
1842            first_name: None,
1843            first_name_kana: None,
1844            first_name_kanji: None,
1845            full_name_aliases: None,
1846            gender: None,
1847            id_number: None,
1848            id_number_secondary: None,
1849            last_name: None,
1850            last_name_kana: None,
1851            last_name_kanji: None,
1852            maiden_name: None,
1853            metadata: None,
1854            nationality: None,
1855            phone: None,
1856            political_exposure: None,
1857            registered_address: None,
1858            relationship: None,
1859            ssn_last_4: None,
1860            us_cfpb_data: None,
1861            verification: None,
1862        }
1863    }
1864}
1865impl Default for CreateTokenPerson {
1866    fn default() -> Self {
1867        Self::new()
1868    }
1869}
1870/// Details on the legal guardian's or authorizer's acceptance of the required Stripe agreements.
1871#[derive(Clone, Eq, PartialEq)]
1872#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1873#[derive(serde::Serialize)]
1874pub struct CreateTokenPersonAdditionalTosAcceptances {
1875    /// Details on the legal guardian's acceptance of the main Stripe service agreement.
1876    #[serde(skip_serializing_if = "Option::is_none")]
1877    pub account: Option<CreateTokenPersonAdditionalTosAcceptancesAccount>,
1878}
1879#[cfg(feature = "redact-generated-debug")]
1880impl std::fmt::Debug for CreateTokenPersonAdditionalTosAcceptances {
1881    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1882        f.debug_struct("CreateTokenPersonAdditionalTosAcceptances").finish_non_exhaustive()
1883    }
1884}
1885impl CreateTokenPersonAdditionalTosAcceptances {
1886    pub fn new() -> Self {
1887        Self { account: None }
1888    }
1889}
1890impl Default for CreateTokenPersonAdditionalTosAcceptances {
1891    fn default() -> Self {
1892        Self::new()
1893    }
1894}
1895/// Details on the legal guardian's acceptance of the main Stripe service agreement.
1896#[derive(Clone, Eq, PartialEq)]
1897#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1898#[derive(serde::Serialize)]
1899pub struct CreateTokenPersonAdditionalTosAcceptancesAccount {
1900    /// The Unix timestamp marking when the account representative accepted the service agreement.
1901    #[serde(skip_serializing_if = "Option::is_none")]
1902    pub date: Option<stripe_types::Timestamp>,
1903    /// The IP address from which the account representative accepted the service agreement.
1904    #[serde(skip_serializing_if = "Option::is_none")]
1905    pub ip: Option<String>,
1906    /// The user agent of the browser from which the account representative accepted the service agreement.
1907    #[serde(skip_serializing_if = "Option::is_none")]
1908    pub user_agent: Option<String>,
1909}
1910#[cfg(feature = "redact-generated-debug")]
1911impl std::fmt::Debug for CreateTokenPersonAdditionalTosAcceptancesAccount {
1912    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1913        f.debug_struct("CreateTokenPersonAdditionalTosAcceptancesAccount").finish_non_exhaustive()
1914    }
1915}
1916impl CreateTokenPersonAdditionalTosAcceptancesAccount {
1917    pub fn new() -> Self {
1918        Self { date: None, ip: None, user_agent: None }
1919    }
1920}
1921impl Default for CreateTokenPersonAdditionalTosAcceptancesAccount {
1922    fn default() -> Self {
1923        Self::new()
1924    }
1925}
1926/// The person's address.
1927#[derive(Clone, Eq, PartialEq)]
1928#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1929#[derive(serde::Serialize)]
1930pub struct CreateTokenPersonAddress {
1931    /// City, district, suburb, town, or village.
1932    #[serde(skip_serializing_if = "Option::is_none")]
1933    pub city: Option<String>,
1934    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1935    #[serde(skip_serializing_if = "Option::is_none")]
1936    pub country: Option<String>,
1937    /// Address line 1, such as the street, PO Box, or company name.
1938    #[serde(skip_serializing_if = "Option::is_none")]
1939    pub line1: Option<String>,
1940    /// Address line 2, such as the apartment, suite, unit, or building.
1941    #[serde(skip_serializing_if = "Option::is_none")]
1942    pub line2: Option<String>,
1943    /// ZIP or postal code.
1944    #[serde(skip_serializing_if = "Option::is_none")]
1945    pub postal_code: Option<String>,
1946    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
1947    #[serde(skip_serializing_if = "Option::is_none")]
1948    pub state: Option<String>,
1949}
1950#[cfg(feature = "redact-generated-debug")]
1951impl std::fmt::Debug for CreateTokenPersonAddress {
1952    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1953        f.debug_struct("CreateTokenPersonAddress").finish_non_exhaustive()
1954    }
1955}
1956impl CreateTokenPersonAddress {
1957    pub fn new() -> Self {
1958        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
1959    }
1960}
1961impl Default for CreateTokenPersonAddress {
1962    fn default() -> Self {
1963        Self::new()
1964    }
1965}
1966/// The Kana variation of the person's address (Japan only).
1967#[derive(Clone, Eq, PartialEq)]
1968#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1969#[derive(serde::Serialize)]
1970pub struct CreateTokenPersonAddressKana {
1971    /// City or ward.
1972    #[serde(skip_serializing_if = "Option::is_none")]
1973    pub city: Option<String>,
1974    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1975    #[serde(skip_serializing_if = "Option::is_none")]
1976    pub country: Option<String>,
1977    /// Block or building number.
1978    #[serde(skip_serializing_if = "Option::is_none")]
1979    pub line1: Option<String>,
1980    /// Building details.
1981    #[serde(skip_serializing_if = "Option::is_none")]
1982    pub line2: Option<String>,
1983    /// Postal code.
1984    #[serde(skip_serializing_if = "Option::is_none")]
1985    pub postal_code: Option<String>,
1986    /// Prefecture.
1987    #[serde(skip_serializing_if = "Option::is_none")]
1988    pub state: Option<String>,
1989    /// Town or cho-me.
1990    #[serde(skip_serializing_if = "Option::is_none")]
1991    pub town: Option<String>,
1992}
1993#[cfg(feature = "redact-generated-debug")]
1994impl std::fmt::Debug for CreateTokenPersonAddressKana {
1995    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1996        f.debug_struct("CreateTokenPersonAddressKana").finish_non_exhaustive()
1997    }
1998}
1999impl CreateTokenPersonAddressKana {
2000    pub fn new() -> Self {
2001        Self {
2002            city: None,
2003            country: None,
2004            line1: None,
2005            line2: None,
2006            postal_code: None,
2007            state: None,
2008            town: None,
2009        }
2010    }
2011}
2012impl Default for CreateTokenPersonAddressKana {
2013    fn default() -> Self {
2014        Self::new()
2015    }
2016}
2017/// The Kanji variation of the person's address (Japan only).
2018#[derive(Clone, Eq, PartialEq)]
2019#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2020#[derive(serde::Serialize)]
2021pub struct CreateTokenPersonAddressKanji {
2022    /// City or ward.
2023    #[serde(skip_serializing_if = "Option::is_none")]
2024    pub city: Option<String>,
2025    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
2026    #[serde(skip_serializing_if = "Option::is_none")]
2027    pub country: Option<String>,
2028    /// Block or building number.
2029    #[serde(skip_serializing_if = "Option::is_none")]
2030    pub line1: Option<String>,
2031    /// Building details.
2032    #[serde(skip_serializing_if = "Option::is_none")]
2033    pub line2: Option<String>,
2034    /// Postal code.
2035    #[serde(skip_serializing_if = "Option::is_none")]
2036    pub postal_code: Option<String>,
2037    /// Prefecture.
2038    #[serde(skip_serializing_if = "Option::is_none")]
2039    pub state: Option<String>,
2040    /// Town or cho-me.
2041    #[serde(skip_serializing_if = "Option::is_none")]
2042    pub town: Option<String>,
2043}
2044#[cfg(feature = "redact-generated-debug")]
2045impl std::fmt::Debug for CreateTokenPersonAddressKanji {
2046    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2047        f.debug_struct("CreateTokenPersonAddressKanji").finish_non_exhaustive()
2048    }
2049}
2050impl CreateTokenPersonAddressKanji {
2051    pub fn new() -> Self {
2052        Self {
2053            city: None,
2054            country: None,
2055            line1: None,
2056            line2: None,
2057            postal_code: None,
2058            state: None,
2059            town: None,
2060        }
2061    }
2062}
2063impl Default for CreateTokenPersonAddressKanji {
2064    fn default() -> Self {
2065        Self::new()
2066    }
2067}
2068/// Documents that may be submitted to satisfy various informational requests.
2069#[derive(Clone, Eq, PartialEq)]
2070#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2071#[derive(serde::Serialize)]
2072pub struct CreateTokenPersonDocuments {
2073    /// One or more documents that demonstrate proof that this person is authorized to represent the company.
2074    #[serde(skip_serializing_if = "Option::is_none")]
2075    pub company_authorization: Option<DocumentsParam>,
2076    /// One or more documents showing the person's passport page with photo and personal data.
2077    #[serde(skip_serializing_if = "Option::is_none")]
2078    pub passport: Option<DocumentsParam>,
2079    /// One or more documents showing the person's visa required for living in the country where they are residing.
2080    #[serde(skip_serializing_if = "Option::is_none")]
2081    pub visa: Option<DocumentsParam>,
2082}
2083#[cfg(feature = "redact-generated-debug")]
2084impl std::fmt::Debug for CreateTokenPersonDocuments {
2085    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2086        f.debug_struct("CreateTokenPersonDocuments").finish_non_exhaustive()
2087    }
2088}
2089impl CreateTokenPersonDocuments {
2090    pub fn new() -> Self {
2091        Self { company_authorization: None, passport: None, visa: None }
2092    }
2093}
2094impl Default for CreateTokenPersonDocuments {
2095    fn default() -> Self {
2096        Self::new()
2097    }
2098}
2099/// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
2100#[derive(Clone, Eq, PartialEq)]
2101#[non_exhaustive]
2102pub enum CreateTokenPersonPoliticalExposure {
2103    Existing,
2104    None,
2105    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2106    Unknown(String),
2107}
2108impl CreateTokenPersonPoliticalExposure {
2109    pub fn as_str(&self) -> &str {
2110        use CreateTokenPersonPoliticalExposure::*;
2111        match self {
2112            Existing => "existing",
2113            None => "none",
2114            Unknown(v) => v,
2115        }
2116    }
2117}
2118
2119impl std::str::FromStr for CreateTokenPersonPoliticalExposure {
2120    type Err = std::convert::Infallible;
2121    fn from_str(s: &str) -> Result<Self, Self::Err> {
2122        use CreateTokenPersonPoliticalExposure::*;
2123        match s {
2124            "existing" => Ok(Existing),
2125            "none" => Ok(None),
2126            v => {
2127                tracing::warn!(
2128                    "Unknown value '{}' for enum '{}'",
2129                    v,
2130                    "CreateTokenPersonPoliticalExposure"
2131                );
2132                Ok(Unknown(v.to_owned()))
2133            }
2134        }
2135    }
2136}
2137impl std::fmt::Display for CreateTokenPersonPoliticalExposure {
2138    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2139        f.write_str(self.as_str())
2140    }
2141}
2142
2143#[cfg(not(feature = "redact-generated-debug"))]
2144impl std::fmt::Debug for CreateTokenPersonPoliticalExposure {
2145    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2146        f.write_str(self.as_str())
2147    }
2148}
2149#[cfg(feature = "redact-generated-debug")]
2150impl std::fmt::Debug for CreateTokenPersonPoliticalExposure {
2151    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2152        f.debug_struct(stringify!(CreateTokenPersonPoliticalExposure)).finish_non_exhaustive()
2153    }
2154}
2155impl serde::Serialize for CreateTokenPersonPoliticalExposure {
2156    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2157    where
2158        S: serde::Serializer,
2159    {
2160        serializer.serialize_str(self.as_str())
2161    }
2162}
2163#[cfg(feature = "deserialize")]
2164impl<'de> serde::Deserialize<'de> for CreateTokenPersonPoliticalExposure {
2165    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2166        use std::str::FromStr;
2167        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2168        Ok(Self::from_str(&s).expect("infallible"))
2169    }
2170}
2171/// The person's registered address.
2172#[derive(Clone, Eq, PartialEq)]
2173#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2174#[derive(serde::Serialize)]
2175pub struct CreateTokenPersonRegisteredAddress {
2176    /// City, district, suburb, town, or village.
2177    #[serde(skip_serializing_if = "Option::is_none")]
2178    pub city: Option<String>,
2179    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
2180    #[serde(skip_serializing_if = "Option::is_none")]
2181    pub country: Option<String>,
2182    /// Address line 1, such as the street, PO Box, or company name.
2183    #[serde(skip_serializing_if = "Option::is_none")]
2184    pub line1: Option<String>,
2185    /// Address line 2, such as the apartment, suite, unit, or building.
2186    #[serde(skip_serializing_if = "Option::is_none")]
2187    pub line2: Option<String>,
2188    /// ZIP or postal code.
2189    #[serde(skip_serializing_if = "Option::is_none")]
2190    pub postal_code: Option<String>,
2191    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
2192    #[serde(skip_serializing_if = "Option::is_none")]
2193    pub state: Option<String>,
2194}
2195#[cfg(feature = "redact-generated-debug")]
2196impl std::fmt::Debug for CreateTokenPersonRegisteredAddress {
2197    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2198        f.debug_struct("CreateTokenPersonRegisteredAddress").finish_non_exhaustive()
2199    }
2200}
2201impl CreateTokenPersonRegisteredAddress {
2202    pub fn new() -> Self {
2203        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
2204    }
2205}
2206impl Default for CreateTokenPersonRegisteredAddress {
2207    fn default() -> Self {
2208        Self::new()
2209    }
2210}
2211/// The relationship that this person has with the account's legal entity.
2212#[derive(Clone)]
2213#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2214#[derive(serde::Serialize)]
2215pub struct CreateTokenPersonRelationship {
2216    /// Whether the person is the authorizer of the account's representative.
2217    #[serde(skip_serializing_if = "Option::is_none")]
2218    pub authorizer: Option<bool>,
2219    /// Whether the person is a director of the account's legal entity.
2220    /// Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations.
2221    #[serde(skip_serializing_if = "Option::is_none")]
2222    pub director: Option<bool>,
2223    /// Whether the person has significant responsibility to control, manage, or direct the organization.
2224    #[serde(skip_serializing_if = "Option::is_none")]
2225    pub executive: Option<bool>,
2226    /// Whether the person is the legal guardian of the account's representative.
2227    #[serde(skip_serializing_if = "Option::is_none")]
2228    pub legal_guardian: Option<bool>,
2229    /// Whether the person is an owner of the account’s legal entity.
2230    #[serde(skip_serializing_if = "Option::is_none")]
2231    pub owner: Option<bool>,
2232    /// The percent owned by the person of the account's legal entity.
2233    #[serde(skip_serializing_if = "Option::is_none")]
2234    pub percent_ownership: Option<f64>,
2235    /// Whether the person is authorized as the primary representative of the account.
2236    /// This is the person nominated by the business to provide information about themselves, and general information about the account.
2237    /// There can only be one representative at any given time.
2238    /// At the time the account is created, this person should be set to the person responsible for opening the account.
2239    #[serde(skip_serializing_if = "Option::is_none")]
2240    pub representative: Option<bool>,
2241    /// The person's title (e.g., CEO, Support Engineer).
2242    #[serde(skip_serializing_if = "Option::is_none")]
2243    pub title: Option<String>,
2244}
2245#[cfg(feature = "redact-generated-debug")]
2246impl std::fmt::Debug for CreateTokenPersonRelationship {
2247    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2248        f.debug_struct("CreateTokenPersonRelationship").finish_non_exhaustive()
2249    }
2250}
2251impl CreateTokenPersonRelationship {
2252    pub fn new() -> Self {
2253        Self {
2254            authorizer: None,
2255            director: None,
2256            executive: None,
2257            legal_guardian: None,
2258            owner: None,
2259            percent_ownership: None,
2260            representative: None,
2261            title: None,
2262        }
2263    }
2264}
2265impl Default for CreateTokenPersonRelationship {
2266    fn default() -> Self {
2267        Self::new()
2268    }
2269}
2270/// Demographic data related to the person.
2271#[derive(Clone, Eq, PartialEq)]
2272#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2273#[derive(serde::Serialize)]
2274pub struct CreateTokenPersonUsCfpbData {
2275    /// The persons ethnicity details
2276    #[serde(skip_serializing_if = "Option::is_none")]
2277    pub ethnicity_details: Option<CreateTokenPersonUsCfpbDataEthnicityDetails>,
2278    /// The persons race details
2279    #[serde(skip_serializing_if = "Option::is_none")]
2280    pub race_details: Option<CreateTokenPersonUsCfpbDataRaceDetails>,
2281    /// The persons self-identified gender
2282    #[serde(skip_serializing_if = "Option::is_none")]
2283    pub self_identified_gender: Option<String>,
2284}
2285#[cfg(feature = "redact-generated-debug")]
2286impl std::fmt::Debug for CreateTokenPersonUsCfpbData {
2287    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2288        f.debug_struct("CreateTokenPersonUsCfpbData").finish_non_exhaustive()
2289    }
2290}
2291impl CreateTokenPersonUsCfpbData {
2292    pub fn new() -> Self {
2293        Self { ethnicity_details: None, race_details: None, self_identified_gender: None }
2294    }
2295}
2296impl Default for CreateTokenPersonUsCfpbData {
2297    fn default() -> Self {
2298        Self::new()
2299    }
2300}
2301/// The persons ethnicity details
2302#[derive(Clone, Eq, PartialEq)]
2303#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2304#[derive(serde::Serialize)]
2305pub struct CreateTokenPersonUsCfpbDataEthnicityDetails {
2306    /// The persons ethnicity
2307    #[serde(skip_serializing_if = "Option::is_none")]
2308    pub ethnicity: Option<Vec<CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity>>,
2309    /// Please specify your origin, when other is selected.
2310    #[serde(skip_serializing_if = "Option::is_none")]
2311    pub ethnicity_other: Option<String>,
2312}
2313#[cfg(feature = "redact-generated-debug")]
2314impl std::fmt::Debug for CreateTokenPersonUsCfpbDataEthnicityDetails {
2315    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2316        f.debug_struct("CreateTokenPersonUsCfpbDataEthnicityDetails").finish_non_exhaustive()
2317    }
2318}
2319impl CreateTokenPersonUsCfpbDataEthnicityDetails {
2320    pub fn new() -> Self {
2321        Self { ethnicity: None, ethnicity_other: None }
2322    }
2323}
2324impl Default for CreateTokenPersonUsCfpbDataEthnicityDetails {
2325    fn default() -> Self {
2326        Self::new()
2327    }
2328}
2329/// The persons ethnicity
2330#[derive(Clone, Eq, PartialEq)]
2331#[non_exhaustive]
2332pub enum CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2333    Cuban,
2334    HispanicOrLatino,
2335    Mexican,
2336    NotHispanicOrLatino,
2337    OtherHispanicOrLatino,
2338    PreferNotToAnswer,
2339    PuertoRican,
2340    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2341    Unknown(String),
2342}
2343impl CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2344    pub fn as_str(&self) -> &str {
2345        use CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity::*;
2346        match self {
2347            Cuban => "cuban",
2348            HispanicOrLatino => "hispanic_or_latino",
2349            Mexican => "mexican",
2350            NotHispanicOrLatino => "not_hispanic_or_latino",
2351            OtherHispanicOrLatino => "other_hispanic_or_latino",
2352            PreferNotToAnswer => "prefer_not_to_answer",
2353            PuertoRican => "puerto_rican",
2354            Unknown(v) => v,
2355        }
2356    }
2357}
2358
2359impl std::str::FromStr for CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2360    type Err = std::convert::Infallible;
2361    fn from_str(s: &str) -> Result<Self, Self::Err> {
2362        use CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity::*;
2363        match s {
2364            "cuban" => Ok(Cuban),
2365            "hispanic_or_latino" => Ok(HispanicOrLatino),
2366            "mexican" => Ok(Mexican),
2367            "not_hispanic_or_latino" => Ok(NotHispanicOrLatino),
2368            "other_hispanic_or_latino" => Ok(OtherHispanicOrLatino),
2369            "prefer_not_to_answer" => Ok(PreferNotToAnswer),
2370            "puerto_rican" => Ok(PuertoRican),
2371            v => {
2372                tracing::warn!(
2373                    "Unknown value '{}' for enum '{}'",
2374                    v,
2375                    "CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity"
2376                );
2377                Ok(Unknown(v.to_owned()))
2378            }
2379        }
2380    }
2381}
2382impl std::fmt::Display for CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2383    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2384        f.write_str(self.as_str())
2385    }
2386}
2387
2388#[cfg(not(feature = "redact-generated-debug"))]
2389impl std::fmt::Debug for CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2390    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2391        f.write_str(self.as_str())
2392    }
2393}
2394#[cfg(feature = "redact-generated-debug")]
2395impl std::fmt::Debug for CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2396    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2397        f.debug_struct(stringify!(CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity))
2398            .finish_non_exhaustive()
2399    }
2400}
2401impl serde::Serialize for CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2402    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2403    where
2404        S: serde::Serializer,
2405    {
2406        serializer.serialize_str(self.as_str())
2407    }
2408}
2409#[cfg(feature = "deserialize")]
2410impl<'de> serde::Deserialize<'de> for CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2411    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2412        use std::str::FromStr;
2413        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2414        Ok(Self::from_str(&s).expect("infallible"))
2415    }
2416}
2417/// The persons race details
2418#[derive(Clone, Eq, PartialEq)]
2419#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2420#[derive(serde::Serialize)]
2421pub struct CreateTokenPersonUsCfpbDataRaceDetails {
2422    /// The persons race.
2423    #[serde(skip_serializing_if = "Option::is_none")]
2424    pub race: Option<Vec<CreateTokenPersonUsCfpbDataRaceDetailsRace>>,
2425    /// Please specify your race, when other is selected.
2426    #[serde(skip_serializing_if = "Option::is_none")]
2427    pub race_other: Option<String>,
2428}
2429#[cfg(feature = "redact-generated-debug")]
2430impl std::fmt::Debug for CreateTokenPersonUsCfpbDataRaceDetails {
2431    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2432        f.debug_struct("CreateTokenPersonUsCfpbDataRaceDetails").finish_non_exhaustive()
2433    }
2434}
2435impl CreateTokenPersonUsCfpbDataRaceDetails {
2436    pub fn new() -> Self {
2437        Self { race: None, race_other: None }
2438    }
2439}
2440impl Default for CreateTokenPersonUsCfpbDataRaceDetails {
2441    fn default() -> Self {
2442        Self::new()
2443    }
2444}
2445/// The persons race.
2446#[derive(Clone, Eq, PartialEq)]
2447#[non_exhaustive]
2448pub enum CreateTokenPersonUsCfpbDataRaceDetailsRace {
2449    AfricanAmerican,
2450    AmericanIndianOrAlaskaNative,
2451    Asian,
2452    AsianIndian,
2453    BlackOrAfricanAmerican,
2454    Chinese,
2455    Ethiopian,
2456    Filipino,
2457    GuamanianOrChamorro,
2458    Haitian,
2459    Jamaican,
2460    Japanese,
2461    Korean,
2462    NativeHawaiian,
2463    NativeHawaiianOrOtherPacificIslander,
2464    Nigerian,
2465    OtherAsian,
2466    OtherBlackOrAfricanAmerican,
2467    OtherPacificIslander,
2468    PreferNotToAnswer,
2469    Samoan,
2470    Somali,
2471    Vietnamese,
2472    White,
2473    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2474    Unknown(String),
2475}
2476impl CreateTokenPersonUsCfpbDataRaceDetailsRace {
2477    pub fn as_str(&self) -> &str {
2478        use CreateTokenPersonUsCfpbDataRaceDetailsRace::*;
2479        match self {
2480            AfricanAmerican => "african_american",
2481            AmericanIndianOrAlaskaNative => "american_indian_or_alaska_native",
2482            Asian => "asian",
2483            AsianIndian => "asian_indian",
2484            BlackOrAfricanAmerican => "black_or_african_american",
2485            Chinese => "chinese",
2486            Ethiopian => "ethiopian",
2487            Filipino => "filipino",
2488            GuamanianOrChamorro => "guamanian_or_chamorro",
2489            Haitian => "haitian",
2490            Jamaican => "jamaican",
2491            Japanese => "japanese",
2492            Korean => "korean",
2493            NativeHawaiian => "native_hawaiian",
2494            NativeHawaiianOrOtherPacificIslander => "native_hawaiian_or_other_pacific_islander",
2495            Nigerian => "nigerian",
2496            OtherAsian => "other_asian",
2497            OtherBlackOrAfricanAmerican => "other_black_or_african_american",
2498            OtherPacificIslander => "other_pacific_islander",
2499            PreferNotToAnswer => "prefer_not_to_answer",
2500            Samoan => "samoan",
2501            Somali => "somali",
2502            Vietnamese => "vietnamese",
2503            White => "white",
2504            Unknown(v) => v,
2505        }
2506    }
2507}
2508
2509impl std::str::FromStr for CreateTokenPersonUsCfpbDataRaceDetailsRace {
2510    type Err = std::convert::Infallible;
2511    fn from_str(s: &str) -> Result<Self, Self::Err> {
2512        use CreateTokenPersonUsCfpbDataRaceDetailsRace::*;
2513        match s {
2514            "african_american" => Ok(AfricanAmerican),
2515            "american_indian_or_alaska_native" => Ok(AmericanIndianOrAlaskaNative),
2516            "asian" => Ok(Asian),
2517            "asian_indian" => Ok(AsianIndian),
2518            "black_or_african_american" => Ok(BlackOrAfricanAmerican),
2519            "chinese" => Ok(Chinese),
2520            "ethiopian" => Ok(Ethiopian),
2521            "filipino" => Ok(Filipino),
2522            "guamanian_or_chamorro" => Ok(GuamanianOrChamorro),
2523            "haitian" => Ok(Haitian),
2524            "jamaican" => Ok(Jamaican),
2525            "japanese" => Ok(Japanese),
2526            "korean" => Ok(Korean),
2527            "native_hawaiian" => Ok(NativeHawaiian),
2528            "native_hawaiian_or_other_pacific_islander" => Ok(NativeHawaiianOrOtherPacificIslander),
2529            "nigerian" => Ok(Nigerian),
2530            "other_asian" => Ok(OtherAsian),
2531            "other_black_or_african_american" => Ok(OtherBlackOrAfricanAmerican),
2532            "other_pacific_islander" => Ok(OtherPacificIslander),
2533            "prefer_not_to_answer" => Ok(PreferNotToAnswer),
2534            "samoan" => Ok(Samoan),
2535            "somali" => Ok(Somali),
2536            "vietnamese" => Ok(Vietnamese),
2537            "white" => Ok(White),
2538            v => {
2539                tracing::warn!(
2540                    "Unknown value '{}' for enum '{}'",
2541                    v,
2542                    "CreateTokenPersonUsCfpbDataRaceDetailsRace"
2543                );
2544                Ok(Unknown(v.to_owned()))
2545            }
2546        }
2547    }
2548}
2549impl std::fmt::Display for CreateTokenPersonUsCfpbDataRaceDetailsRace {
2550    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2551        f.write_str(self.as_str())
2552    }
2553}
2554
2555#[cfg(not(feature = "redact-generated-debug"))]
2556impl std::fmt::Debug for CreateTokenPersonUsCfpbDataRaceDetailsRace {
2557    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2558        f.write_str(self.as_str())
2559    }
2560}
2561#[cfg(feature = "redact-generated-debug")]
2562impl std::fmt::Debug for CreateTokenPersonUsCfpbDataRaceDetailsRace {
2563    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2564        f.debug_struct(stringify!(CreateTokenPersonUsCfpbDataRaceDetailsRace))
2565            .finish_non_exhaustive()
2566    }
2567}
2568impl serde::Serialize for CreateTokenPersonUsCfpbDataRaceDetailsRace {
2569    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2570    where
2571        S: serde::Serializer,
2572    {
2573        serializer.serialize_str(self.as_str())
2574    }
2575}
2576#[cfg(feature = "deserialize")]
2577impl<'de> serde::Deserialize<'de> for CreateTokenPersonUsCfpbDataRaceDetailsRace {
2578    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2579        use std::str::FromStr;
2580        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2581        Ok(Self::from_str(&s).expect("infallible"))
2582    }
2583}
2584/// The PII this token represents.
2585#[derive(Clone, Eq, PartialEq)]
2586#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2587#[derive(serde::Serialize)]
2588pub struct CreateTokenPii {
2589    /// The `id_number` for the PII, in string form.
2590    #[serde(skip_serializing_if = "Option::is_none")]
2591    pub id_number: Option<String>,
2592}
2593#[cfg(feature = "redact-generated-debug")]
2594impl std::fmt::Debug for CreateTokenPii {
2595    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2596        f.debug_struct("CreateTokenPii").finish_non_exhaustive()
2597    }
2598}
2599impl CreateTokenPii {
2600    pub fn new() -> Self {
2601        Self { id_number: None }
2602    }
2603}
2604impl Default for CreateTokenPii {
2605    fn default() -> Self {
2606        Self::new()
2607    }
2608}
2609/// Creates a single-use token that represents a bank account’s details.
2610/// You can use this token with any v1 API method in place of a bank account dictionary.
2611/// You can only use this token once.
2612/// To do so, attach it to a [connected account](https://stripe.com/docs/api#accounts) where <a href="/api/accounts/object#account_object-controller-requirement_collection">controller.requirement_collection</a> is `application`, which includes Custom accounts.
2613#[derive(Clone)]
2614#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2615#[derive(serde::Serialize)]
2616pub struct CreateToken {
2617    inner: CreateTokenBuilder,
2618}
2619#[cfg(feature = "redact-generated-debug")]
2620impl std::fmt::Debug for CreateToken {
2621    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2622        f.debug_struct("CreateToken").finish_non_exhaustive()
2623    }
2624}
2625impl CreateToken {
2626    /// Construct a new `CreateToken`.
2627    pub fn new() -> Self {
2628        Self { inner: CreateTokenBuilder::new() }
2629    }
2630    /// Information for the account this token represents.
2631    pub fn account(mut self, account: impl Into<CreateTokenAccount>) -> Self {
2632        self.inner.account = Some(account.into());
2633        self
2634    }
2635    /// The bank account this token will represent.
2636    pub fn bank_account(mut self, bank_account: impl Into<CreateTokenBankAccount>) -> Self {
2637        self.inner.bank_account = Some(bank_account.into());
2638        self
2639    }
2640    /// The card this token will represent.
2641    /// If you also pass in a customer, the card must be the ID of a card belonging to the customer.
2642    /// Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below.
2643    pub fn card(mut self, card: impl Into<CreateTokenCard>) -> Self {
2644        self.inner.card = Some(card.into());
2645        self
2646    }
2647    /// Create a token for the customer, which is owned by the application's account.
2648    /// You can only use this with an [OAuth access token](https://docs.stripe.com/connect/standard-accounts) or [Stripe-Account header](https://docs.stripe.com/connect/authentication).
2649    /// Learn more about [cloning saved payment methods](https://docs.stripe.com/connect/cloning-saved-payment-methods).
2650    pub fn customer(mut self, customer: impl Into<String>) -> Self {
2651        self.inner.customer = Some(customer.into());
2652        self
2653    }
2654    /// The updated CVC value this token represents.
2655    pub fn cvc_update(mut self, cvc_update: impl Into<CreateTokenCvcUpdate>) -> Self {
2656        self.inner.cvc_update = Some(cvc_update.into());
2657        self
2658    }
2659    /// Specifies which fields in the response should be expanded.
2660    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2661        self.inner.expand = Some(expand.into());
2662        self
2663    }
2664    /// Information for the person this token represents.
2665    pub fn person(mut self, person: impl Into<CreateTokenPerson>) -> Self {
2666        self.inner.person = Some(person.into());
2667        self
2668    }
2669    /// The PII this token represents.
2670    pub fn pii(mut self, pii: impl Into<CreateTokenPii>) -> Self {
2671        self.inner.pii = Some(pii.into());
2672        self
2673    }
2674}
2675impl Default for CreateToken {
2676    fn default() -> Self {
2677        Self::new()
2678    }
2679}
2680impl CreateToken {
2681    /// Send the request and return the deserialized response.
2682    pub async fn send<C: StripeClient>(
2683        &self,
2684        client: &C,
2685    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2686        self.customize().send(client).await
2687    }
2688
2689    /// Send the request and return the deserialized response, blocking until completion.
2690    pub fn send_blocking<C: StripeBlockingClient>(
2691        &self,
2692        client: &C,
2693    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2694        self.customize().send_blocking(client)
2695    }
2696}
2697
2698impl StripeRequest for CreateToken {
2699    type Output = stripe_core::Token;
2700
2701    fn build(&self) -> RequestBuilder {
2702        RequestBuilder::new(StripeMethod::Post, "/tokens").form(&self.inner)
2703    }
2704}
2705
2706#[derive(Copy, Clone, Eq, PartialEq)]
2707#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2708#[derive(serde::Serialize)]
2709pub struct DateOfBirthSpecs {
2710    /// The day of birth, between 1 and 31.
2711    pub day: i64,
2712    /// The month of birth, between 1 and 12.
2713    pub month: i64,
2714    /// The four-digit year of birth.
2715    pub year: i64,
2716}
2717#[cfg(feature = "redact-generated-debug")]
2718impl std::fmt::Debug for DateOfBirthSpecs {
2719    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2720        f.debug_struct("DateOfBirthSpecs").finish_non_exhaustive()
2721    }
2722}
2723impl DateOfBirthSpecs {
2724    pub fn new(day: impl Into<i64>, month: impl Into<i64>, year: impl Into<i64>) -> Self {
2725        Self { day: day.into(), month: month.into(), year: year.into() }
2726    }
2727}
2728#[derive(Clone, Eq, PartialEq)]
2729#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2730#[derive(serde::Serialize)]
2731pub struct PersonVerificationDocumentSpecs {
2732    /// The back of an ID returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `identity_document`.
2733    /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size.
2734    #[serde(skip_serializing_if = "Option::is_none")]
2735    pub back: Option<String>,
2736    /// The front of an ID returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `identity_document`.
2737    /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size.
2738    #[serde(skip_serializing_if = "Option::is_none")]
2739    pub front: Option<String>,
2740}
2741#[cfg(feature = "redact-generated-debug")]
2742impl std::fmt::Debug for PersonVerificationDocumentSpecs {
2743    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2744        f.debug_struct("PersonVerificationDocumentSpecs").finish_non_exhaustive()
2745    }
2746}
2747impl PersonVerificationDocumentSpecs {
2748    pub fn new() -> Self {
2749        Self { back: None, front: None }
2750    }
2751}
2752impl Default for PersonVerificationDocumentSpecs {
2753    fn default() -> Self {
2754        Self::new()
2755    }
2756}
2757#[derive(Clone, Eq, PartialEq)]
2758#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2759#[derive(serde::Serialize)]
2760pub struct DocumentsParam {
2761    /// One or more document ids returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `account_requirement`.
2762    #[serde(skip_serializing_if = "Option::is_none")]
2763    pub files: Option<Vec<String>>,
2764}
2765#[cfg(feature = "redact-generated-debug")]
2766impl std::fmt::Debug for DocumentsParam {
2767    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2768        f.debug_struct("DocumentsParam").finish_non_exhaustive()
2769    }
2770}
2771impl DocumentsParam {
2772    pub fn new() -> Self {
2773        Self { files: None }
2774    }
2775}
2776impl Default for DocumentsParam {
2777    fn default() -> Self {
2778        Self::new()
2779    }
2780}
2781#[derive(Clone, Eq, PartialEq)]
2782#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2783#[derive(serde::Serialize)]
2784pub struct PersonVerificationSpecs {
2785    /// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company.
2786    #[serde(skip_serializing_if = "Option::is_none")]
2787    pub additional_document: Option<PersonVerificationDocumentSpecs>,
2788    /// An identifying document, either a passport or local ID card.
2789    #[serde(skip_serializing_if = "Option::is_none")]
2790    pub document: Option<PersonVerificationDocumentSpecs>,
2791}
2792#[cfg(feature = "redact-generated-debug")]
2793impl std::fmt::Debug for PersonVerificationSpecs {
2794    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2795        f.debug_struct("PersonVerificationSpecs").finish_non_exhaustive()
2796    }
2797}
2798impl PersonVerificationSpecs {
2799    pub fn new() -> Self {
2800        Self { additional_document: None, document: None }
2801    }
2802}
2803impl Default for PersonVerificationSpecs {
2804    fn default() -> Self {
2805        Self::new()
2806    }
2807}