stripe_shared/
legal_entity_company.rs

1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct LegalEntityCompany {
5    pub address: Option<stripe_shared::Address>,
6    /// The Kana variation of the company's primary address (Japan only).
7    pub address_kana: Option<stripe_shared::LegalEntityJapanAddress>,
8    /// The Kanji variation of the company's primary address (Japan only).
9    pub address_kanji: Option<stripe_shared::LegalEntityJapanAddress>,
10    /// Whether the company's directors have been provided.
11    /// This Boolean will be `true` if you've manually indicated that all directors are provided via [the `directors_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-directors_provided).
12    pub directors_provided: Option<bool>,
13    /// This hash is used to attest that the director information provided to Stripe is both current and correct.
14    pub directorship_declaration: Option<stripe_shared::LegalEntityDirectorshipDeclaration>,
15    /// Whether the company's executives have been provided.
16    /// This Boolean will be `true` if you've manually indicated that all executives are provided via [the `executives_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-executives_provided), or if Stripe determined that sufficient executives were provided.
17    pub executives_provided: Option<bool>,
18    /// The export license ID number of the company, also referred as Import Export Code (India only).
19    pub export_license_id: Option<String>,
20    /// The purpose code to use for export transactions (India only).
21    pub export_purpose_code: Option<String>,
22    /// The company's legal name.
23    /// Also available for accounts where [controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `stripe`.
24    pub name: Option<String>,
25    /// The Kana variation of the company's legal name (Japan only).
26    /// Also available for accounts where [controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `stripe`.
27    pub name_kana: Option<String>,
28    /// The Kanji variation of the company's legal name (Japan only).
29    /// Also available for accounts where [controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `stripe`.
30    pub name_kanji: Option<String>,
31    /// Whether the company's owners have been provided.
32    /// This Boolean will be `true` if you've manually indicated that all owners are provided via [the `owners_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-owners_provided), or if Stripe determined that sufficient owners were provided.
33    /// Stripe determines ownership requirements using both the number of owners provided and their total percent ownership (calculated by adding the `percent_ownership` of each owner together).
34    pub owners_provided: Option<bool>,
35    /// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
36    pub ownership_declaration: Option<stripe_shared::LegalEntityUboDeclaration>,
37    /// This value is used to determine if a business is exempt from providing ultimate beneficial owners.
38    /// 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.
39    pub ownership_exemption_reason: Option<LegalEntityCompanyOwnershipExemptionReason>,
40    /// The company's phone number (used for verification).
41    pub phone: Option<String>,
42    pub registration_date: Option<stripe_shared::LegalEntityRegistrationDate>,
43    /// The category identifying the legal structure of the company or legal entity.
44    /// Also available for accounts where [controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `stripe`.
45    /// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details.
46    pub structure: Option<LegalEntityCompanyStructure>,
47    /// Whether the company's business ID number was provided.
48    pub tax_id_provided: Option<bool>,
49    /// The jurisdiction in which the `tax_id` is registered (Germany-based companies only).
50    pub tax_id_registrar: Option<String>,
51    /// Whether the company's business VAT number was provided.
52    pub vat_id_provided: Option<bool>,
53    /// Information on the verification state of the company.
54    pub verification: Option<stripe_shared::LegalEntityCompanyVerification>,
55}
56#[doc(hidden)]
57pub struct LegalEntityCompanyBuilder {
58    address: Option<Option<stripe_shared::Address>>,
59    address_kana: Option<Option<stripe_shared::LegalEntityJapanAddress>>,
60    address_kanji: Option<Option<stripe_shared::LegalEntityJapanAddress>>,
61    directors_provided: Option<Option<bool>>,
62    directorship_declaration: Option<Option<stripe_shared::LegalEntityDirectorshipDeclaration>>,
63    executives_provided: Option<Option<bool>>,
64    export_license_id: Option<Option<String>>,
65    export_purpose_code: Option<Option<String>>,
66    name: Option<Option<String>>,
67    name_kana: Option<Option<String>>,
68    name_kanji: Option<Option<String>>,
69    owners_provided: Option<Option<bool>>,
70    ownership_declaration: Option<Option<stripe_shared::LegalEntityUboDeclaration>>,
71    ownership_exemption_reason: Option<Option<LegalEntityCompanyOwnershipExemptionReason>>,
72    phone: Option<Option<String>>,
73    registration_date: Option<Option<stripe_shared::LegalEntityRegistrationDate>>,
74    structure: Option<Option<LegalEntityCompanyStructure>>,
75    tax_id_provided: Option<Option<bool>>,
76    tax_id_registrar: Option<Option<String>>,
77    vat_id_provided: Option<Option<bool>>,
78    verification: Option<Option<stripe_shared::LegalEntityCompanyVerification>>,
79}
80
81#[allow(
82    unused_variables,
83    irrefutable_let_patterns,
84    clippy::let_unit_value,
85    clippy::match_single_binding,
86    clippy::single_match
87)]
88const _: () = {
89    use miniserde::de::{Map, Visitor};
90    use miniserde::json::Value;
91    use miniserde::{Deserialize, Result, make_place};
92    use stripe_types::miniserde_helpers::FromValueOpt;
93    use stripe_types::{MapBuilder, ObjectDeser};
94
95    make_place!(Place);
96
97    impl Deserialize for LegalEntityCompany {
98        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
99            Place::new(out)
100        }
101    }
102
103    struct Builder<'a> {
104        out: &'a mut Option<LegalEntityCompany>,
105        builder: LegalEntityCompanyBuilder,
106    }
107
108    impl Visitor for Place<LegalEntityCompany> {
109        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
110            Ok(Box::new(Builder {
111                out: &mut self.out,
112                builder: LegalEntityCompanyBuilder::deser_default(),
113            }))
114        }
115    }
116
117    impl MapBuilder for LegalEntityCompanyBuilder {
118        type Out = LegalEntityCompany;
119        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
120            Ok(match k {
121                "address" => Deserialize::begin(&mut self.address),
122                "address_kana" => Deserialize::begin(&mut self.address_kana),
123                "address_kanji" => Deserialize::begin(&mut self.address_kanji),
124                "directors_provided" => Deserialize::begin(&mut self.directors_provided),
125                "directorship_declaration" => {
126                    Deserialize::begin(&mut self.directorship_declaration)
127                }
128                "executives_provided" => Deserialize::begin(&mut self.executives_provided),
129                "export_license_id" => Deserialize::begin(&mut self.export_license_id),
130                "export_purpose_code" => Deserialize::begin(&mut self.export_purpose_code),
131                "name" => Deserialize::begin(&mut self.name),
132                "name_kana" => Deserialize::begin(&mut self.name_kana),
133                "name_kanji" => Deserialize::begin(&mut self.name_kanji),
134                "owners_provided" => Deserialize::begin(&mut self.owners_provided),
135                "ownership_declaration" => Deserialize::begin(&mut self.ownership_declaration),
136                "ownership_exemption_reason" => {
137                    Deserialize::begin(&mut self.ownership_exemption_reason)
138                }
139                "phone" => Deserialize::begin(&mut self.phone),
140                "registration_date" => Deserialize::begin(&mut self.registration_date),
141                "structure" => Deserialize::begin(&mut self.structure),
142                "tax_id_provided" => Deserialize::begin(&mut self.tax_id_provided),
143                "tax_id_registrar" => Deserialize::begin(&mut self.tax_id_registrar),
144                "vat_id_provided" => Deserialize::begin(&mut self.vat_id_provided),
145                "verification" => Deserialize::begin(&mut self.verification),
146
147                _ => <dyn Visitor>::ignore(),
148            })
149        }
150
151        fn deser_default() -> Self {
152            Self {
153                address: Deserialize::default(),
154                address_kana: Deserialize::default(),
155                address_kanji: Deserialize::default(),
156                directors_provided: Deserialize::default(),
157                directorship_declaration: Deserialize::default(),
158                executives_provided: Deserialize::default(),
159                export_license_id: Deserialize::default(),
160                export_purpose_code: Deserialize::default(),
161                name: Deserialize::default(),
162                name_kana: Deserialize::default(),
163                name_kanji: Deserialize::default(),
164                owners_provided: Deserialize::default(),
165                ownership_declaration: Deserialize::default(),
166                ownership_exemption_reason: Deserialize::default(),
167                phone: Deserialize::default(),
168                registration_date: Deserialize::default(),
169                structure: Deserialize::default(),
170                tax_id_provided: Deserialize::default(),
171                tax_id_registrar: Deserialize::default(),
172                vat_id_provided: Deserialize::default(),
173                verification: Deserialize::default(),
174            }
175        }
176
177        fn take_out(&mut self) -> Option<Self::Out> {
178            let (
179                Some(address),
180                Some(address_kana),
181                Some(address_kanji),
182                Some(directors_provided),
183                Some(directorship_declaration),
184                Some(executives_provided),
185                Some(export_license_id),
186                Some(export_purpose_code),
187                Some(name),
188                Some(name_kana),
189                Some(name_kanji),
190                Some(owners_provided),
191                Some(ownership_declaration),
192                Some(ownership_exemption_reason),
193                Some(phone),
194                Some(registration_date),
195                Some(structure),
196                Some(tax_id_provided),
197                Some(tax_id_registrar),
198                Some(vat_id_provided),
199                Some(verification),
200            ) = (
201                self.address.take(),
202                self.address_kana.take(),
203                self.address_kanji.take(),
204                self.directors_provided,
205                self.directorship_declaration.take(),
206                self.executives_provided,
207                self.export_license_id.take(),
208                self.export_purpose_code.take(),
209                self.name.take(),
210                self.name_kana.take(),
211                self.name_kanji.take(),
212                self.owners_provided,
213                self.ownership_declaration.take(),
214                self.ownership_exemption_reason,
215                self.phone.take(),
216                self.registration_date,
217                self.structure.take(),
218                self.tax_id_provided,
219                self.tax_id_registrar.take(),
220                self.vat_id_provided,
221                self.verification.take(),
222            )
223            else {
224                return None;
225            };
226            Some(Self::Out {
227                address,
228                address_kana,
229                address_kanji,
230                directors_provided,
231                directorship_declaration,
232                executives_provided,
233                export_license_id,
234                export_purpose_code,
235                name,
236                name_kana,
237                name_kanji,
238                owners_provided,
239                ownership_declaration,
240                ownership_exemption_reason,
241                phone,
242                registration_date,
243                structure,
244                tax_id_provided,
245                tax_id_registrar,
246                vat_id_provided,
247                verification,
248            })
249        }
250    }
251
252    impl Map for Builder<'_> {
253        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
254            self.builder.key(k)
255        }
256
257        fn finish(&mut self) -> Result<()> {
258            *self.out = self.builder.take_out();
259            Ok(())
260        }
261    }
262
263    impl ObjectDeser for LegalEntityCompany {
264        type Builder = LegalEntityCompanyBuilder;
265    }
266
267    impl FromValueOpt for LegalEntityCompany {
268        fn from_value(v: Value) -> Option<Self> {
269            let Value::Object(obj) = v else {
270                return None;
271            };
272            let mut b = LegalEntityCompanyBuilder::deser_default();
273            for (k, v) in obj {
274                match k.as_str() {
275                    "address" => b.address = FromValueOpt::from_value(v),
276                    "address_kana" => b.address_kana = FromValueOpt::from_value(v),
277                    "address_kanji" => b.address_kanji = FromValueOpt::from_value(v),
278                    "directors_provided" => b.directors_provided = FromValueOpt::from_value(v),
279                    "directorship_declaration" => {
280                        b.directorship_declaration = FromValueOpt::from_value(v)
281                    }
282                    "executives_provided" => b.executives_provided = FromValueOpt::from_value(v),
283                    "export_license_id" => b.export_license_id = FromValueOpt::from_value(v),
284                    "export_purpose_code" => b.export_purpose_code = FromValueOpt::from_value(v),
285                    "name" => b.name = FromValueOpt::from_value(v),
286                    "name_kana" => b.name_kana = FromValueOpt::from_value(v),
287                    "name_kanji" => b.name_kanji = FromValueOpt::from_value(v),
288                    "owners_provided" => b.owners_provided = FromValueOpt::from_value(v),
289                    "ownership_declaration" => {
290                        b.ownership_declaration = FromValueOpt::from_value(v)
291                    }
292                    "ownership_exemption_reason" => {
293                        b.ownership_exemption_reason = FromValueOpt::from_value(v)
294                    }
295                    "phone" => b.phone = FromValueOpt::from_value(v),
296                    "registration_date" => b.registration_date = FromValueOpt::from_value(v),
297                    "structure" => b.structure = FromValueOpt::from_value(v),
298                    "tax_id_provided" => b.tax_id_provided = FromValueOpt::from_value(v),
299                    "tax_id_registrar" => b.tax_id_registrar = FromValueOpt::from_value(v),
300                    "vat_id_provided" => b.vat_id_provided = FromValueOpt::from_value(v),
301                    "verification" => b.verification = FromValueOpt::from_value(v),
302
303                    _ => {}
304                }
305            }
306            b.take_out()
307        }
308    }
309};
310/// This value is used to determine if a business is exempt from providing ultimate beneficial owners.
311/// 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.
312#[derive(Copy, Clone, Eq, PartialEq)]
313pub enum LegalEntityCompanyOwnershipExemptionReason {
314    QualifiedEntityExceedsOwnershipThreshold,
315    QualifiesAsFinancialInstitution,
316}
317impl LegalEntityCompanyOwnershipExemptionReason {
318    pub fn as_str(self) -> &'static str {
319        use LegalEntityCompanyOwnershipExemptionReason::*;
320        match self {
321            QualifiedEntityExceedsOwnershipThreshold => {
322                "qualified_entity_exceeds_ownership_threshold"
323            }
324            QualifiesAsFinancialInstitution => "qualifies_as_financial_institution",
325        }
326    }
327}
328
329impl std::str::FromStr for LegalEntityCompanyOwnershipExemptionReason {
330    type Err = stripe_types::StripeParseError;
331    fn from_str(s: &str) -> Result<Self, Self::Err> {
332        use LegalEntityCompanyOwnershipExemptionReason::*;
333        match s {
334            "qualified_entity_exceeds_ownership_threshold" => {
335                Ok(QualifiedEntityExceedsOwnershipThreshold)
336            }
337            "qualifies_as_financial_institution" => Ok(QualifiesAsFinancialInstitution),
338            _ => Err(stripe_types::StripeParseError),
339        }
340    }
341}
342impl std::fmt::Display for LegalEntityCompanyOwnershipExemptionReason {
343    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
344        f.write_str(self.as_str())
345    }
346}
347
348impl std::fmt::Debug for LegalEntityCompanyOwnershipExemptionReason {
349    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
350        f.write_str(self.as_str())
351    }
352}
353#[cfg(feature = "serialize")]
354impl serde::Serialize for LegalEntityCompanyOwnershipExemptionReason {
355    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
356    where
357        S: serde::Serializer,
358    {
359        serializer.serialize_str(self.as_str())
360    }
361}
362impl miniserde::Deserialize for LegalEntityCompanyOwnershipExemptionReason {
363    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
364        crate::Place::new(out)
365    }
366}
367
368impl miniserde::de::Visitor for crate::Place<LegalEntityCompanyOwnershipExemptionReason> {
369    fn string(&mut self, s: &str) -> miniserde::Result<()> {
370        use std::str::FromStr;
371        self.out = Some(
372            LegalEntityCompanyOwnershipExemptionReason::from_str(s)
373                .map_err(|_| miniserde::Error)?,
374        );
375        Ok(())
376    }
377}
378
379stripe_types::impl_from_val_with_from_str!(LegalEntityCompanyOwnershipExemptionReason);
380#[cfg(feature = "deserialize")]
381impl<'de> serde::Deserialize<'de> for LegalEntityCompanyOwnershipExemptionReason {
382    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
383        use std::str::FromStr;
384        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
385        Self::from_str(&s).map_err(|_| {
386            serde::de::Error::custom("Unknown value for LegalEntityCompanyOwnershipExemptionReason")
387        })
388    }
389}
390/// The category identifying the legal structure of the company or legal entity.
391/// Also available for accounts where [controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `stripe`.
392/// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details.
393#[derive(Clone, Eq, PartialEq)]
394#[non_exhaustive]
395pub enum LegalEntityCompanyStructure {
396    FreeZoneEstablishment,
397    FreeZoneLlc,
398    GovernmentInstrumentality,
399    GovernmentalUnit,
400    IncorporatedNonProfit,
401    IncorporatedPartnership,
402    LimitedLiabilityPartnership,
403    Llc,
404    MultiMemberLlc,
405    PrivateCompany,
406    PrivateCorporation,
407    PrivatePartnership,
408    PublicCompany,
409    PublicCorporation,
410    PublicPartnership,
411    RegisteredCharity,
412    SingleMemberLlc,
413    SoleEstablishment,
414    SoleProprietorship,
415    TaxExemptGovernmentInstrumentality,
416    UnincorporatedAssociation,
417    UnincorporatedNonProfit,
418    UnincorporatedPartnership,
419    /// An unrecognized value from Stripe. Should not be used as a request parameter.
420    Unknown(String),
421}
422impl LegalEntityCompanyStructure {
423    pub fn as_str(&self) -> &str {
424        use LegalEntityCompanyStructure::*;
425        match self {
426            FreeZoneEstablishment => "free_zone_establishment",
427            FreeZoneLlc => "free_zone_llc",
428            GovernmentInstrumentality => "government_instrumentality",
429            GovernmentalUnit => "governmental_unit",
430            IncorporatedNonProfit => "incorporated_non_profit",
431            IncorporatedPartnership => "incorporated_partnership",
432            LimitedLiabilityPartnership => "limited_liability_partnership",
433            Llc => "llc",
434            MultiMemberLlc => "multi_member_llc",
435            PrivateCompany => "private_company",
436            PrivateCorporation => "private_corporation",
437            PrivatePartnership => "private_partnership",
438            PublicCompany => "public_company",
439            PublicCorporation => "public_corporation",
440            PublicPartnership => "public_partnership",
441            RegisteredCharity => "registered_charity",
442            SingleMemberLlc => "single_member_llc",
443            SoleEstablishment => "sole_establishment",
444            SoleProprietorship => "sole_proprietorship",
445            TaxExemptGovernmentInstrumentality => "tax_exempt_government_instrumentality",
446            UnincorporatedAssociation => "unincorporated_association",
447            UnincorporatedNonProfit => "unincorporated_non_profit",
448            UnincorporatedPartnership => "unincorporated_partnership",
449            Unknown(v) => v,
450        }
451    }
452}
453
454impl std::str::FromStr for LegalEntityCompanyStructure {
455    type Err = std::convert::Infallible;
456    fn from_str(s: &str) -> Result<Self, Self::Err> {
457        use LegalEntityCompanyStructure::*;
458        match s {
459            "free_zone_establishment" => Ok(FreeZoneEstablishment),
460            "free_zone_llc" => Ok(FreeZoneLlc),
461            "government_instrumentality" => Ok(GovernmentInstrumentality),
462            "governmental_unit" => Ok(GovernmentalUnit),
463            "incorporated_non_profit" => Ok(IncorporatedNonProfit),
464            "incorporated_partnership" => Ok(IncorporatedPartnership),
465            "limited_liability_partnership" => Ok(LimitedLiabilityPartnership),
466            "llc" => Ok(Llc),
467            "multi_member_llc" => Ok(MultiMemberLlc),
468            "private_company" => Ok(PrivateCompany),
469            "private_corporation" => Ok(PrivateCorporation),
470            "private_partnership" => Ok(PrivatePartnership),
471            "public_company" => Ok(PublicCompany),
472            "public_corporation" => Ok(PublicCorporation),
473            "public_partnership" => Ok(PublicPartnership),
474            "registered_charity" => Ok(RegisteredCharity),
475            "single_member_llc" => Ok(SingleMemberLlc),
476            "sole_establishment" => Ok(SoleEstablishment),
477            "sole_proprietorship" => Ok(SoleProprietorship),
478            "tax_exempt_government_instrumentality" => Ok(TaxExemptGovernmentInstrumentality),
479            "unincorporated_association" => Ok(UnincorporatedAssociation),
480            "unincorporated_non_profit" => Ok(UnincorporatedNonProfit),
481            "unincorporated_partnership" => Ok(UnincorporatedPartnership),
482            v => Ok(Unknown(v.to_owned())),
483        }
484    }
485}
486impl std::fmt::Display for LegalEntityCompanyStructure {
487    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
488        f.write_str(self.as_str())
489    }
490}
491
492impl std::fmt::Debug for LegalEntityCompanyStructure {
493    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
494        f.write_str(self.as_str())
495    }
496}
497#[cfg(feature = "serialize")]
498impl serde::Serialize for LegalEntityCompanyStructure {
499    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
500    where
501        S: serde::Serializer,
502    {
503        serializer.serialize_str(self.as_str())
504    }
505}
506impl miniserde::Deserialize for LegalEntityCompanyStructure {
507    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
508        crate::Place::new(out)
509    }
510}
511
512impl miniserde::de::Visitor for crate::Place<LegalEntityCompanyStructure> {
513    fn string(&mut self, s: &str) -> miniserde::Result<()> {
514        use std::str::FromStr;
515        self.out = Some(LegalEntityCompanyStructure::from_str(s).unwrap());
516        Ok(())
517    }
518}
519
520stripe_types::impl_from_val_with_from_str!(LegalEntityCompanyStructure);
521#[cfg(feature = "deserialize")]
522impl<'de> serde::Deserialize<'de> for LegalEntityCompanyStructure {
523    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
524        use std::str::FromStr;
525        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
526        Ok(Self::from_str(&s).unwrap())
527    }
528}