stripe_misc/tax_calculation/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Debug, serde::Serialize)]
6struct RetrieveTaxCalculationBuilder {
7    #[serde(skip_serializing_if = "Option::is_none")]
8    expand: Option<Vec<String>>,
9}
10impl RetrieveTaxCalculationBuilder {
11    fn new() -> Self {
12        Self { expand: None }
13    }
14}
15/// Retrieves a Tax `Calculation` object, if the calculation hasn’t expired.
16#[derive(Clone, Debug, serde::Serialize)]
17pub struct RetrieveTaxCalculation {
18    inner: RetrieveTaxCalculationBuilder,
19    calculation: stripe_misc::TaxCalculationId,
20}
21impl RetrieveTaxCalculation {
22    /// Construct a new `RetrieveTaxCalculation`.
23    pub fn new(calculation: impl Into<stripe_misc::TaxCalculationId>) -> Self {
24        Self { calculation: calculation.into(), inner: RetrieveTaxCalculationBuilder::new() }
25    }
26    /// Specifies which fields in the response should be expanded.
27    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
28        self.inner.expand = Some(expand.into());
29        self
30    }
31}
32impl RetrieveTaxCalculation {
33    /// Send the request and return the deserialized response.
34    pub async fn send<C: StripeClient>(
35        &self,
36        client: &C,
37    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
38        self.customize().send(client).await
39    }
40
41    /// Send the request and return the deserialized response, blocking until completion.
42    pub fn send_blocking<C: StripeBlockingClient>(
43        &self,
44        client: &C,
45    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
46        self.customize().send_blocking(client)
47    }
48}
49
50impl StripeRequest for RetrieveTaxCalculation {
51    type Output = stripe_misc::TaxCalculation;
52
53    fn build(&self) -> RequestBuilder {
54        let calculation = &self.calculation;
55        RequestBuilder::new(StripeMethod::Get, format!("/tax/calculations/{calculation}"))
56            .query(&self.inner)
57    }
58}
59#[derive(Clone, Debug, serde::Serialize)]
60struct ListLineItemsTaxCalculationBuilder {
61    #[serde(skip_serializing_if = "Option::is_none")]
62    ending_before: Option<String>,
63    #[serde(skip_serializing_if = "Option::is_none")]
64    expand: Option<Vec<String>>,
65    #[serde(skip_serializing_if = "Option::is_none")]
66    limit: Option<i64>,
67    #[serde(skip_serializing_if = "Option::is_none")]
68    starting_after: Option<String>,
69}
70impl ListLineItemsTaxCalculationBuilder {
71    fn new() -> Self {
72        Self { ending_before: None, expand: None, limit: None, starting_after: None }
73    }
74}
75/// Retrieves the line items of a tax calculation as a collection, if the calculation hasn’t expired.
76#[derive(Clone, Debug, serde::Serialize)]
77pub struct ListLineItemsTaxCalculation {
78    inner: ListLineItemsTaxCalculationBuilder,
79    calculation: stripe_misc::TaxCalculationId,
80}
81impl ListLineItemsTaxCalculation {
82    /// Construct a new `ListLineItemsTaxCalculation`.
83    pub fn new(calculation: impl Into<stripe_misc::TaxCalculationId>) -> Self {
84        Self { calculation: calculation.into(), inner: ListLineItemsTaxCalculationBuilder::new() }
85    }
86    /// A cursor for use in pagination.
87    /// `ending_before` is an object ID that defines your place in the list.
88    /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
89    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
90        self.inner.ending_before = Some(ending_before.into());
91        self
92    }
93    /// Specifies which fields in the response should be expanded.
94    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
95        self.inner.expand = Some(expand.into());
96        self
97    }
98    /// A limit on the number of objects to be returned.
99    /// Limit can range between 1 and 100, and the default is 10.
100    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
101        self.inner.limit = Some(limit.into());
102        self
103    }
104    /// A cursor for use in pagination.
105    /// `starting_after` is an object ID that defines your place in the list.
106    /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
107    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
108        self.inner.starting_after = Some(starting_after.into());
109        self
110    }
111}
112impl ListLineItemsTaxCalculation {
113    /// Send the request and return the deserialized response.
114    pub async fn send<C: StripeClient>(
115        &self,
116        client: &C,
117    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
118        self.customize().send(client).await
119    }
120
121    /// Send the request and return the deserialized response, blocking until completion.
122    pub fn send_blocking<C: StripeBlockingClient>(
123        &self,
124        client: &C,
125    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
126        self.customize().send_blocking(client)
127    }
128
129    pub fn paginate(
130        &self,
131    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_misc::TaxCalculationLineItem>>
132    {
133        let calculation = &self.calculation;
134
135        stripe_client_core::ListPaginator::new_list(
136            format!("/tax/calculations/{calculation}/line_items"),
137            &self.inner,
138        )
139    }
140}
141
142impl StripeRequest for ListLineItemsTaxCalculation {
143    type Output = stripe_types::List<stripe_misc::TaxCalculationLineItem>;
144
145    fn build(&self) -> RequestBuilder {
146        let calculation = &self.calculation;
147        RequestBuilder::new(
148            StripeMethod::Get,
149            format!("/tax/calculations/{calculation}/line_items"),
150        )
151        .query(&self.inner)
152    }
153}
154#[derive(Clone, Debug, serde::Serialize)]
155struct CreateTaxCalculationBuilder {
156    currency: stripe_types::Currency,
157    #[serde(skip_serializing_if = "Option::is_none")]
158    customer: Option<String>,
159    #[serde(skip_serializing_if = "Option::is_none")]
160    customer_details: Option<CreateTaxCalculationCustomerDetails>,
161    #[serde(skip_serializing_if = "Option::is_none")]
162    expand: Option<Vec<String>>,
163    line_items: Vec<CreateTaxCalculationLineItems>,
164    #[serde(skip_serializing_if = "Option::is_none")]
165    ship_from_details: Option<CreateTaxCalculationShipFromDetails>,
166    #[serde(skip_serializing_if = "Option::is_none")]
167    shipping_cost: Option<CreateTaxCalculationShippingCost>,
168    #[serde(skip_serializing_if = "Option::is_none")]
169    tax_date: Option<stripe_types::Timestamp>,
170}
171impl CreateTaxCalculationBuilder {
172    fn new(
173        currency: impl Into<stripe_types::Currency>,
174        line_items: impl Into<Vec<CreateTaxCalculationLineItems>>,
175    ) -> Self {
176        Self {
177            currency: currency.into(),
178            customer: None,
179            customer_details: None,
180            expand: None,
181            line_items: line_items.into(),
182            ship_from_details: None,
183            shipping_cost: None,
184            tax_date: None,
185        }
186    }
187}
188/// Details about the customer, including address and tax IDs.
189#[derive(Clone, Debug, serde::Serialize)]
190pub struct CreateTaxCalculationCustomerDetails {
191    /// The customer's postal address (for example, home or business location).
192    #[serde(skip_serializing_if = "Option::is_none")]
193    pub address: Option<CreateTaxCalculationCustomerDetailsAddress>,
194    /// The type of customer address provided.
195    #[serde(skip_serializing_if = "Option::is_none")]
196    pub address_source: Option<CreateTaxCalculationCustomerDetailsAddressSource>,
197    /// The customer's IP address (IPv4 or IPv6).
198    #[serde(skip_serializing_if = "Option::is_none")]
199    pub ip_address: Option<String>,
200    /// The customer's tax IDs.
201    /// Stripe Tax might consider a transaction with applicable tax IDs to be B2B, which might affect the tax calculation result.
202    /// Stripe Tax doesn't validate tax IDs for correctness.
203    #[serde(skip_serializing_if = "Option::is_none")]
204    pub tax_ids: Option<Vec<CreateTaxCalculationCustomerDetailsTaxIds>>,
205    /// Overrides the tax calculation result to allow you to not collect tax from your customer.
206    /// Use this if you've manually checked your customer's tax exemptions.
207    /// Prefer providing the customer's `tax_ids` where possible, which automatically determines whether `reverse_charge` applies.
208    #[serde(skip_serializing_if = "Option::is_none")]
209    pub taxability_override: Option<CreateTaxCalculationCustomerDetailsTaxabilityOverride>,
210}
211impl CreateTaxCalculationCustomerDetails {
212    pub fn new() -> Self {
213        Self {
214            address: None,
215            address_source: None,
216            ip_address: None,
217            tax_ids: None,
218            taxability_override: None,
219        }
220    }
221}
222impl Default for CreateTaxCalculationCustomerDetails {
223    fn default() -> Self {
224        Self::new()
225    }
226}
227/// The customer's postal address (for example, home or business location).
228#[derive(Clone, Debug, serde::Serialize)]
229pub struct CreateTaxCalculationCustomerDetailsAddress {
230    /// City, district, suburb, town, or village.
231    #[serde(skip_serializing_if = "Option::is_none")]
232    pub city: Option<String>,
233    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
234    pub country: String,
235    /// Address line 1, such as the street, PO Box, or company name.
236    #[serde(skip_serializing_if = "Option::is_none")]
237    pub line1: Option<String>,
238    /// Address line 2, such as the apartment, suite, unit, or building.
239    #[serde(skip_serializing_if = "Option::is_none")]
240    pub line2: Option<String>,
241    /// ZIP or postal code.
242    #[serde(skip_serializing_if = "Option::is_none")]
243    pub postal_code: Option<String>,
244    /// State, county, province, or region.
245    /// We recommend sending [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) subdivision code value when possible.
246    #[serde(skip_serializing_if = "Option::is_none")]
247    pub state: Option<String>,
248}
249impl CreateTaxCalculationCustomerDetailsAddress {
250    pub fn new(country: impl Into<String>) -> Self {
251        Self {
252            city: None,
253            country: country.into(),
254            line1: None,
255            line2: None,
256            postal_code: None,
257            state: None,
258        }
259    }
260}
261/// The type of customer address provided.
262#[derive(Clone, Eq, PartialEq)]
263#[non_exhaustive]
264pub enum CreateTaxCalculationCustomerDetailsAddressSource {
265    Billing,
266    Shipping,
267    /// An unrecognized value from Stripe. Should not be used as a request parameter.
268    Unknown(String),
269}
270impl CreateTaxCalculationCustomerDetailsAddressSource {
271    pub fn as_str(&self) -> &str {
272        use CreateTaxCalculationCustomerDetailsAddressSource::*;
273        match self {
274            Billing => "billing",
275            Shipping => "shipping",
276            Unknown(v) => v,
277        }
278    }
279}
280
281impl std::str::FromStr for CreateTaxCalculationCustomerDetailsAddressSource {
282    type Err = std::convert::Infallible;
283    fn from_str(s: &str) -> Result<Self, Self::Err> {
284        use CreateTaxCalculationCustomerDetailsAddressSource::*;
285        match s {
286            "billing" => Ok(Billing),
287            "shipping" => Ok(Shipping),
288            v => {
289                tracing::warn!(
290                    "Unknown value '{}' for enum '{}'",
291                    v,
292                    "CreateTaxCalculationCustomerDetailsAddressSource"
293                );
294                Ok(Unknown(v.to_owned()))
295            }
296        }
297    }
298}
299impl std::fmt::Display for CreateTaxCalculationCustomerDetailsAddressSource {
300    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
301        f.write_str(self.as_str())
302    }
303}
304
305impl std::fmt::Debug for CreateTaxCalculationCustomerDetailsAddressSource {
306    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
307        f.write_str(self.as_str())
308    }
309}
310impl serde::Serialize for CreateTaxCalculationCustomerDetailsAddressSource {
311    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
312    where
313        S: serde::Serializer,
314    {
315        serializer.serialize_str(self.as_str())
316    }
317}
318#[cfg(feature = "deserialize")]
319impl<'de> serde::Deserialize<'de> for CreateTaxCalculationCustomerDetailsAddressSource {
320    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
321        use std::str::FromStr;
322        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
323        Ok(Self::from_str(&s).expect("infallible"))
324    }
325}
326/// The customer's tax IDs.
327/// Stripe Tax might consider a transaction with applicable tax IDs to be B2B, which might affect the tax calculation result.
328/// Stripe Tax doesn't validate tax IDs for correctness.
329#[derive(Clone, Debug, serde::Serialize)]
330pub struct CreateTaxCalculationCustomerDetailsTaxIds {
331    /// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `aw_tin`, `az_tin`, `ba_tin`, `bb_tin`, `bd_bin`, `bf_ifu`, `bg_uic`, `bh_vat`, `bj_ifu`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cm_niu`, `cn_tin`, `co_nit`, `cr_tin`, `cv_nif`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `et_tin`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kg_tin`, `kh_tin`, `kr_brn`, `kz_bin`, `la_tin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`.
332    #[serde(rename = "type")]
333    pub type_: CreateTaxCalculationCustomerDetailsTaxIdsType,
334    /// Value of the tax ID.
335    pub value: String,
336}
337impl CreateTaxCalculationCustomerDetailsTaxIds {
338    pub fn new(
339        type_: impl Into<CreateTaxCalculationCustomerDetailsTaxIdsType>,
340        value: impl Into<String>,
341    ) -> Self {
342        Self { type_: type_.into(), value: value.into() }
343    }
344}
345/// Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `aw_tin`, `az_tin`, `ba_tin`, `bb_tin`, `bd_bin`, `bf_ifu`, `bg_uic`, `bh_vat`, `bj_ifu`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cm_niu`, `cn_tin`, `co_nit`, `cr_tin`, `cv_nif`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `et_tin`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kg_tin`, `kh_tin`, `kr_brn`, `kz_bin`, `la_tin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`.
346#[derive(Clone, Eq, PartialEq)]
347#[non_exhaustive]
348pub enum CreateTaxCalculationCustomerDetailsTaxIdsType {
349    AdNrt,
350    AeTrn,
351    AlTin,
352    AmTin,
353    AoTin,
354    ArCuit,
355    AuAbn,
356    AuArn,
357    AwTin,
358    AzTin,
359    BaTin,
360    BbTin,
361    BdBin,
362    BfIfu,
363    BgUic,
364    BhVat,
365    BjIfu,
366    BoTin,
367    BrCnpj,
368    BrCpf,
369    BsTin,
370    ByTin,
371    CaBn,
372    CaGstHst,
373    CaPstBc,
374    CaPstMb,
375    CaPstSk,
376    CaQst,
377    CdNif,
378    ChUid,
379    ChVat,
380    ClTin,
381    CmNiu,
382    CnTin,
383    CoNit,
384    CrTin,
385    CvNif,
386    DeStn,
387    DoRcn,
388    EcRuc,
389    EgTin,
390    EsCif,
391    EtTin,
392    EuOssVat,
393    EuVat,
394    GbVat,
395    GeVat,
396    GnNif,
397    HkBr,
398    HrOib,
399    HuTin,
400    IdNpwp,
401    IlVat,
402    InGst,
403    IsVat,
404    JpCn,
405    JpRn,
406    JpTrn,
407    KePin,
408    KgTin,
409    KhTin,
410    KrBrn,
411    KzBin,
412    LaTin,
413    LiUid,
414    LiVat,
415    MaVat,
416    MdVat,
417    MePib,
418    MkVat,
419    MrNif,
420    MxRfc,
421    MyFrp,
422    MyItn,
423    MySst,
424    NgTin,
425    NoVat,
426    NoVoec,
427    NpPan,
428    NzGst,
429    OmVat,
430    PeRuc,
431    PhTin,
432    RoTin,
433    RsPib,
434    RuInn,
435    RuKpp,
436    SaVat,
437    SgGst,
438    SgUen,
439    SiTin,
440    SnNinea,
441    SrFin,
442    SvNit,
443    ThVat,
444    TjTin,
445    TrTin,
446    TwVat,
447    TzVat,
448    UaVat,
449    UgTin,
450    UsEin,
451    UyRuc,
452    UzTin,
453    UzVat,
454    VeRif,
455    VnTin,
456    ZaVat,
457    ZmTin,
458    ZwTin,
459    /// An unrecognized value from Stripe. Should not be used as a request parameter.
460    Unknown(String),
461}
462impl CreateTaxCalculationCustomerDetailsTaxIdsType {
463    pub fn as_str(&self) -> &str {
464        use CreateTaxCalculationCustomerDetailsTaxIdsType::*;
465        match self {
466            AdNrt => "ad_nrt",
467            AeTrn => "ae_trn",
468            AlTin => "al_tin",
469            AmTin => "am_tin",
470            AoTin => "ao_tin",
471            ArCuit => "ar_cuit",
472            AuAbn => "au_abn",
473            AuArn => "au_arn",
474            AwTin => "aw_tin",
475            AzTin => "az_tin",
476            BaTin => "ba_tin",
477            BbTin => "bb_tin",
478            BdBin => "bd_bin",
479            BfIfu => "bf_ifu",
480            BgUic => "bg_uic",
481            BhVat => "bh_vat",
482            BjIfu => "bj_ifu",
483            BoTin => "bo_tin",
484            BrCnpj => "br_cnpj",
485            BrCpf => "br_cpf",
486            BsTin => "bs_tin",
487            ByTin => "by_tin",
488            CaBn => "ca_bn",
489            CaGstHst => "ca_gst_hst",
490            CaPstBc => "ca_pst_bc",
491            CaPstMb => "ca_pst_mb",
492            CaPstSk => "ca_pst_sk",
493            CaQst => "ca_qst",
494            CdNif => "cd_nif",
495            ChUid => "ch_uid",
496            ChVat => "ch_vat",
497            ClTin => "cl_tin",
498            CmNiu => "cm_niu",
499            CnTin => "cn_tin",
500            CoNit => "co_nit",
501            CrTin => "cr_tin",
502            CvNif => "cv_nif",
503            DeStn => "de_stn",
504            DoRcn => "do_rcn",
505            EcRuc => "ec_ruc",
506            EgTin => "eg_tin",
507            EsCif => "es_cif",
508            EtTin => "et_tin",
509            EuOssVat => "eu_oss_vat",
510            EuVat => "eu_vat",
511            GbVat => "gb_vat",
512            GeVat => "ge_vat",
513            GnNif => "gn_nif",
514            HkBr => "hk_br",
515            HrOib => "hr_oib",
516            HuTin => "hu_tin",
517            IdNpwp => "id_npwp",
518            IlVat => "il_vat",
519            InGst => "in_gst",
520            IsVat => "is_vat",
521            JpCn => "jp_cn",
522            JpRn => "jp_rn",
523            JpTrn => "jp_trn",
524            KePin => "ke_pin",
525            KgTin => "kg_tin",
526            KhTin => "kh_tin",
527            KrBrn => "kr_brn",
528            KzBin => "kz_bin",
529            LaTin => "la_tin",
530            LiUid => "li_uid",
531            LiVat => "li_vat",
532            MaVat => "ma_vat",
533            MdVat => "md_vat",
534            MePib => "me_pib",
535            MkVat => "mk_vat",
536            MrNif => "mr_nif",
537            MxRfc => "mx_rfc",
538            MyFrp => "my_frp",
539            MyItn => "my_itn",
540            MySst => "my_sst",
541            NgTin => "ng_tin",
542            NoVat => "no_vat",
543            NoVoec => "no_voec",
544            NpPan => "np_pan",
545            NzGst => "nz_gst",
546            OmVat => "om_vat",
547            PeRuc => "pe_ruc",
548            PhTin => "ph_tin",
549            RoTin => "ro_tin",
550            RsPib => "rs_pib",
551            RuInn => "ru_inn",
552            RuKpp => "ru_kpp",
553            SaVat => "sa_vat",
554            SgGst => "sg_gst",
555            SgUen => "sg_uen",
556            SiTin => "si_tin",
557            SnNinea => "sn_ninea",
558            SrFin => "sr_fin",
559            SvNit => "sv_nit",
560            ThVat => "th_vat",
561            TjTin => "tj_tin",
562            TrTin => "tr_tin",
563            TwVat => "tw_vat",
564            TzVat => "tz_vat",
565            UaVat => "ua_vat",
566            UgTin => "ug_tin",
567            UsEin => "us_ein",
568            UyRuc => "uy_ruc",
569            UzTin => "uz_tin",
570            UzVat => "uz_vat",
571            VeRif => "ve_rif",
572            VnTin => "vn_tin",
573            ZaVat => "za_vat",
574            ZmTin => "zm_tin",
575            ZwTin => "zw_tin",
576            Unknown(v) => v,
577        }
578    }
579}
580
581impl std::str::FromStr for CreateTaxCalculationCustomerDetailsTaxIdsType {
582    type Err = std::convert::Infallible;
583    fn from_str(s: &str) -> Result<Self, Self::Err> {
584        use CreateTaxCalculationCustomerDetailsTaxIdsType::*;
585        match s {
586            "ad_nrt" => Ok(AdNrt),
587            "ae_trn" => Ok(AeTrn),
588            "al_tin" => Ok(AlTin),
589            "am_tin" => Ok(AmTin),
590            "ao_tin" => Ok(AoTin),
591            "ar_cuit" => Ok(ArCuit),
592            "au_abn" => Ok(AuAbn),
593            "au_arn" => Ok(AuArn),
594            "aw_tin" => Ok(AwTin),
595            "az_tin" => Ok(AzTin),
596            "ba_tin" => Ok(BaTin),
597            "bb_tin" => Ok(BbTin),
598            "bd_bin" => Ok(BdBin),
599            "bf_ifu" => Ok(BfIfu),
600            "bg_uic" => Ok(BgUic),
601            "bh_vat" => Ok(BhVat),
602            "bj_ifu" => Ok(BjIfu),
603            "bo_tin" => Ok(BoTin),
604            "br_cnpj" => Ok(BrCnpj),
605            "br_cpf" => Ok(BrCpf),
606            "bs_tin" => Ok(BsTin),
607            "by_tin" => Ok(ByTin),
608            "ca_bn" => Ok(CaBn),
609            "ca_gst_hst" => Ok(CaGstHst),
610            "ca_pst_bc" => Ok(CaPstBc),
611            "ca_pst_mb" => Ok(CaPstMb),
612            "ca_pst_sk" => Ok(CaPstSk),
613            "ca_qst" => Ok(CaQst),
614            "cd_nif" => Ok(CdNif),
615            "ch_uid" => Ok(ChUid),
616            "ch_vat" => Ok(ChVat),
617            "cl_tin" => Ok(ClTin),
618            "cm_niu" => Ok(CmNiu),
619            "cn_tin" => Ok(CnTin),
620            "co_nit" => Ok(CoNit),
621            "cr_tin" => Ok(CrTin),
622            "cv_nif" => Ok(CvNif),
623            "de_stn" => Ok(DeStn),
624            "do_rcn" => Ok(DoRcn),
625            "ec_ruc" => Ok(EcRuc),
626            "eg_tin" => Ok(EgTin),
627            "es_cif" => Ok(EsCif),
628            "et_tin" => Ok(EtTin),
629            "eu_oss_vat" => Ok(EuOssVat),
630            "eu_vat" => Ok(EuVat),
631            "gb_vat" => Ok(GbVat),
632            "ge_vat" => Ok(GeVat),
633            "gn_nif" => Ok(GnNif),
634            "hk_br" => Ok(HkBr),
635            "hr_oib" => Ok(HrOib),
636            "hu_tin" => Ok(HuTin),
637            "id_npwp" => Ok(IdNpwp),
638            "il_vat" => Ok(IlVat),
639            "in_gst" => Ok(InGst),
640            "is_vat" => Ok(IsVat),
641            "jp_cn" => Ok(JpCn),
642            "jp_rn" => Ok(JpRn),
643            "jp_trn" => Ok(JpTrn),
644            "ke_pin" => Ok(KePin),
645            "kg_tin" => Ok(KgTin),
646            "kh_tin" => Ok(KhTin),
647            "kr_brn" => Ok(KrBrn),
648            "kz_bin" => Ok(KzBin),
649            "la_tin" => Ok(LaTin),
650            "li_uid" => Ok(LiUid),
651            "li_vat" => Ok(LiVat),
652            "ma_vat" => Ok(MaVat),
653            "md_vat" => Ok(MdVat),
654            "me_pib" => Ok(MePib),
655            "mk_vat" => Ok(MkVat),
656            "mr_nif" => Ok(MrNif),
657            "mx_rfc" => Ok(MxRfc),
658            "my_frp" => Ok(MyFrp),
659            "my_itn" => Ok(MyItn),
660            "my_sst" => Ok(MySst),
661            "ng_tin" => Ok(NgTin),
662            "no_vat" => Ok(NoVat),
663            "no_voec" => Ok(NoVoec),
664            "np_pan" => Ok(NpPan),
665            "nz_gst" => Ok(NzGst),
666            "om_vat" => Ok(OmVat),
667            "pe_ruc" => Ok(PeRuc),
668            "ph_tin" => Ok(PhTin),
669            "ro_tin" => Ok(RoTin),
670            "rs_pib" => Ok(RsPib),
671            "ru_inn" => Ok(RuInn),
672            "ru_kpp" => Ok(RuKpp),
673            "sa_vat" => Ok(SaVat),
674            "sg_gst" => Ok(SgGst),
675            "sg_uen" => Ok(SgUen),
676            "si_tin" => Ok(SiTin),
677            "sn_ninea" => Ok(SnNinea),
678            "sr_fin" => Ok(SrFin),
679            "sv_nit" => Ok(SvNit),
680            "th_vat" => Ok(ThVat),
681            "tj_tin" => Ok(TjTin),
682            "tr_tin" => Ok(TrTin),
683            "tw_vat" => Ok(TwVat),
684            "tz_vat" => Ok(TzVat),
685            "ua_vat" => Ok(UaVat),
686            "ug_tin" => Ok(UgTin),
687            "us_ein" => Ok(UsEin),
688            "uy_ruc" => Ok(UyRuc),
689            "uz_tin" => Ok(UzTin),
690            "uz_vat" => Ok(UzVat),
691            "ve_rif" => Ok(VeRif),
692            "vn_tin" => Ok(VnTin),
693            "za_vat" => Ok(ZaVat),
694            "zm_tin" => Ok(ZmTin),
695            "zw_tin" => Ok(ZwTin),
696            v => {
697                tracing::warn!(
698                    "Unknown value '{}' for enum '{}'",
699                    v,
700                    "CreateTaxCalculationCustomerDetailsTaxIdsType"
701                );
702                Ok(Unknown(v.to_owned()))
703            }
704        }
705    }
706}
707impl std::fmt::Display for CreateTaxCalculationCustomerDetailsTaxIdsType {
708    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
709        f.write_str(self.as_str())
710    }
711}
712
713impl std::fmt::Debug for CreateTaxCalculationCustomerDetailsTaxIdsType {
714    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
715        f.write_str(self.as_str())
716    }
717}
718impl serde::Serialize for CreateTaxCalculationCustomerDetailsTaxIdsType {
719    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
720    where
721        S: serde::Serializer,
722    {
723        serializer.serialize_str(self.as_str())
724    }
725}
726#[cfg(feature = "deserialize")]
727impl<'de> serde::Deserialize<'de> for CreateTaxCalculationCustomerDetailsTaxIdsType {
728    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
729        use std::str::FromStr;
730        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
731        Ok(Self::from_str(&s).expect("infallible"))
732    }
733}
734/// Overrides the tax calculation result to allow you to not collect tax from your customer.
735/// Use this if you've manually checked your customer's tax exemptions.
736/// Prefer providing the customer's `tax_ids` where possible, which automatically determines whether `reverse_charge` applies.
737#[derive(Clone, Eq, PartialEq)]
738#[non_exhaustive]
739pub enum CreateTaxCalculationCustomerDetailsTaxabilityOverride {
740    CustomerExempt,
741    None,
742    ReverseCharge,
743    /// An unrecognized value from Stripe. Should not be used as a request parameter.
744    Unknown(String),
745}
746impl CreateTaxCalculationCustomerDetailsTaxabilityOverride {
747    pub fn as_str(&self) -> &str {
748        use CreateTaxCalculationCustomerDetailsTaxabilityOverride::*;
749        match self {
750            CustomerExempt => "customer_exempt",
751            None => "none",
752            ReverseCharge => "reverse_charge",
753            Unknown(v) => v,
754        }
755    }
756}
757
758impl std::str::FromStr for CreateTaxCalculationCustomerDetailsTaxabilityOverride {
759    type Err = std::convert::Infallible;
760    fn from_str(s: &str) -> Result<Self, Self::Err> {
761        use CreateTaxCalculationCustomerDetailsTaxabilityOverride::*;
762        match s {
763            "customer_exempt" => Ok(CustomerExempt),
764            "none" => Ok(None),
765            "reverse_charge" => Ok(ReverseCharge),
766            v => {
767                tracing::warn!(
768                    "Unknown value '{}' for enum '{}'",
769                    v,
770                    "CreateTaxCalculationCustomerDetailsTaxabilityOverride"
771                );
772                Ok(Unknown(v.to_owned()))
773            }
774        }
775    }
776}
777impl std::fmt::Display for CreateTaxCalculationCustomerDetailsTaxabilityOverride {
778    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
779        f.write_str(self.as_str())
780    }
781}
782
783impl std::fmt::Debug for CreateTaxCalculationCustomerDetailsTaxabilityOverride {
784    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
785        f.write_str(self.as_str())
786    }
787}
788impl serde::Serialize for CreateTaxCalculationCustomerDetailsTaxabilityOverride {
789    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
790    where
791        S: serde::Serializer,
792    {
793        serializer.serialize_str(self.as_str())
794    }
795}
796#[cfg(feature = "deserialize")]
797impl<'de> serde::Deserialize<'de> for CreateTaxCalculationCustomerDetailsTaxabilityOverride {
798    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
799        use std::str::FromStr;
800        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
801        Ok(Self::from_str(&s).expect("infallible"))
802    }
803}
804/// A list of items the customer is purchasing.
805#[derive(Clone, Debug, serde::Serialize)]
806pub struct CreateTaxCalculationLineItems {
807    /// A positive integer representing the line item's total price in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
808    /// If `tax_behavior=inclusive`, then this amount includes taxes.
809    /// Otherwise, taxes are calculated on top of this amount.
810    pub amount: i64,
811    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
812    /// This can be useful for storing additional information about the object in a structured format.
813    #[serde(skip_serializing_if = "Option::is_none")]
814    pub metadata: Option<std::collections::HashMap<String, String>>,
815    /// If provided, the product's `tax_code` will be used as the line item's `tax_code`.
816    #[serde(skip_serializing_if = "Option::is_none")]
817    pub product: Option<String>,
818    /// The number of units of the item being purchased.
819    /// Used to calculate the per-unit price from the total `amount` for the line.
820    /// For example, if `amount=100` and `quantity=4`, the calculated unit price is 25.
821    #[serde(skip_serializing_if = "Option::is_none")]
822    pub quantity: Option<u64>,
823    /// A custom identifier for this line item, which must be unique across the line items in the calculation.
824    /// The reference helps identify each line item in exported [tax reports](https://stripe.com/docs/tax/reports).
825    #[serde(skip_serializing_if = "Option::is_none")]
826    pub reference: Option<String>,
827    /// Specifies whether the `amount` includes taxes. Defaults to `exclusive`.
828    #[serde(skip_serializing_if = "Option::is_none")]
829    pub tax_behavior: Option<CreateTaxCalculationLineItemsTaxBehavior>,
830    /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID to use for this line item.
831    /// If not provided, we will use the tax code from the provided `product` param.
832    /// If neither `tax_code` nor `product` is provided, we will use the default tax code from your Tax Settings.
833    #[serde(skip_serializing_if = "Option::is_none")]
834    pub tax_code: Option<String>,
835}
836impl CreateTaxCalculationLineItems {
837    pub fn new(amount: impl Into<i64>) -> Self {
838        Self {
839            amount: amount.into(),
840            metadata: None,
841            product: None,
842            quantity: None,
843            reference: None,
844            tax_behavior: None,
845            tax_code: None,
846        }
847    }
848}
849/// Specifies whether the `amount` includes taxes. Defaults to `exclusive`.
850#[derive(Clone, Eq, PartialEq)]
851#[non_exhaustive]
852pub enum CreateTaxCalculationLineItemsTaxBehavior {
853    Exclusive,
854    Inclusive,
855    /// An unrecognized value from Stripe. Should not be used as a request parameter.
856    Unknown(String),
857}
858impl CreateTaxCalculationLineItemsTaxBehavior {
859    pub fn as_str(&self) -> &str {
860        use CreateTaxCalculationLineItemsTaxBehavior::*;
861        match self {
862            Exclusive => "exclusive",
863            Inclusive => "inclusive",
864            Unknown(v) => v,
865        }
866    }
867}
868
869impl std::str::FromStr for CreateTaxCalculationLineItemsTaxBehavior {
870    type Err = std::convert::Infallible;
871    fn from_str(s: &str) -> Result<Self, Self::Err> {
872        use CreateTaxCalculationLineItemsTaxBehavior::*;
873        match s {
874            "exclusive" => Ok(Exclusive),
875            "inclusive" => Ok(Inclusive),
876            v => {
877                tracing::warn!(
878                    "Unknown value '{}' for enum '{}'",
879                    v,
880                    "CreateTaxCalculationLineItemsTaxBehavior"
881                );
882                Ok(Unknown(v.to_owned()))
883            }
884        }
885    }
886}
887impl std::fmt::Display for CreateTaxCalculationLineItemsTaxBehavior {
888    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
889        f.write_str(self.as_str())
890    }
891}
892
893impl std::fmt::Debug for CreateTaxCalculationLineItemsTaxBehavior {
894    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
895        f.write_str(self.as_str())
896    }
897}
898impl serde::Serialize for CreateTaxCalculationLineItemsTaxBehavior {
899    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
900    where
901        S: serde::Serializer,
902    {
903        serializer.serialize_str(self.as_str())
904    }
905}
906#[cfg(feature = "deserialize")]
907impl<'de> serde::Deserialize<'de> for CreateTaxCalculationLineItemsTaxBehavior {
908    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
909        use std::str::FromStr;
910        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
911        Ok(Self::from_str(&s).expect("infallible"))
912    }
913}
914/// Details about the address from which the goods are being shipped.
915#[derive(Clone, Debug, serde::Serialize)]
916pub struct CreateTaxCalculationShipFromDetails {
917    /// The address from which the goods are being shipped from.
918    pub address: CreateTaxCalculationShipFromDetailsAddress,
919}
920impl CreateTaxCalculationShipFromDetails {
921    pub fn new(address: impl Into<CreateTaxCalculationShipFromDetailsAddress>) -> Self {
922        Self { address: address.into() }
923    }
924}
925/// The address from which the goods are being shipped from.
926#[derive(Clone, Debug, serde::Serialize)]
927pub struct CreateTaxCalculationShipFromDetailsAddress {
928    /// City, district, suburb, town, or village.
929    #[serde(skip_serializing_if = "Option::is_none")]
930    pub city: Option<String>,
931    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
932    pub country: String,
933    /// Address line 1, such as the street, PO Box, or company name.
934    #[serde(skip_serializing_if = "Option::is_none")]
935    pub line1: Option<String>,
936    /// Address line 2, such as the apartment, suite, unit, or building.
937    #[serde(skip_serializing_if = "Option::is_none")]
938    pub line2: Option<String>,
939    /// ZIP or postal code.
940    #[serde(skip_serializing_if = "Option::is_none")]
941    pub postal_code: Option<String>,
942    /// State/province as an [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) subdivision code, without country prefix, such as "NY" or "TX".
943    #[serde(skip_serializing_if = "Option::is_none")]
944    pub state: Option<String>,
945}
946impl CreateTaxCalculationShipFromDetailsAddress {
947    pub fn new(country: impl Into<String>) -> Self {
948        Self {
949            city: None,
950            country: country.into(),
951            line1: None,
952            line2: None,
953            postal_code: None,
954            state: None,
955        }
956    }
957}
958/// Shipping cost details to be used for the calculation.
959#[derive(Clone, Debug, serde::Serialize)]
960pub struct CreateTaxCalculationShippingCost {
961    /// A positive integer in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) representing the shipping charge.
962    /// If `tax_behavior=inclusive`, then this amount includes taxes.
963    /// Otherwise, taxes are calculated on top of this amount.
964    #[serde(skip_serializing_if = "Option::is_none")]
965    pub amount: Option<i64>,
966    /// If provided, the [shipping rate](https://stripe.com/docs/api/shipping_rates/object)'s `amount`, `tax_code` and `tax_behavior` are used.
967    /// If you provide a shipping rate, then you cannot pass the `amount`, `tax_code`, or `tax_behavior` parameters.
968    #[serde(skip_serializing_if = "Option::is_none")]
969    pub shipping_rate: Option<String>,
970    /// Specifies whether the `amount` includes taxes.
971    /// If `tax_behavior=inclusive`, then the amount includes taxes.
972    /// Defaults to `exclusive`.
973    #[serde(skip_serializing_if = "Option::is_none")]
974    pub tax_behavior: Option<CreateTaxCalculationShippingCostTaxBehavior>,
975    /// The [tax code](https://stripe.com/docs/tax/tax-categories) used to calculate tax on shipping.
976    /// If not provided, the default shipping tax code from your [Tax Settings](https://dashboard.stripe.com/settings/tax) is used.
977    #[serde(skip_serializing_if = "Option::is_none")]
978    pub tax_code: Option<String>,
979}
980impl CreateTaxCalculationShippingCost {
981    pub fn new() -> Self {
982        Self { amount: None, shipping_rate: None, tax_behavior: None, tax_code: None }
983    }
984}
985impl Default for CreateTaxCalculationShippingCost {
986    fn default() -> Self {
987        Self::new()
988    }
989}
990/// Specifies whether the `amount` includes taxes.
991/// If `tax_behavior=inclusive`, then the amount includes taxes.
992/// Defaults to `exclusive`.
993#[derive(Clone, Eq, PartialEq)]
994#[non_exhaustive]
995pub enum CreateTaxCalculationShippingCostTaxBehavior {
996    Exclusive,
997    Inclusive,
998    /// An unrecognized value from Stripe. Should not be used as a request parameter.
999    Unknown(String),
1000}
1001impl CreateTaxCalculationShippingCostTaxBehavior {
1002    pub fn as_str(&self) -> &str {
1003        use CreateTaxCalculationShippingCostTaxBehavior::*;
1004        match self {
1005            Exclusive => "exclusive",
1006            Inclusive => "inclusive",
1007            Unknown(v) => v,
1008        }
1009    }
1010}
1011
1012impl std::str::FromStr for CreateTaxCalculationShippingCostTaxBehavior {
1013    type Err = std::convert::Infallible;
1014    fn from_str(s: &str) -> Result<Self, Self::Err> {
1015        use CreateTaxCalculationShippingCostTaxBehavior::*;
1016        match s {
1017            "exclusive" => Ok(Exclusive),
1018            "inclusive" => Ok(Inclusive),
1019            v => {
1020                tracing::warn!(
1021                    "Unknown value '{}' for enum '{}'",
1022                    v,
1023                    "CreateTaxCalculationShippingCostTaxBehavior"
1024                );
1025                Ok(Unknown(v.to_owned()))
1026            }
1027        }
1028    }
1029}
1030impl std::fmt::Display for CreateTaxCalculationShippingCostTaxBehavior {
1031    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1032        f.write_str(self.as_str())
1033    }
1034}
1035
1036impl std::fmt::Debug for CreateTaxCalculationShippingCostTaxBehavior {
1037    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1038        f.write_str(self.as_str())
1039    }
1040}
1041impl serde::Serialize for CreateTaxCalculationShippingCostTaxBehavior {
1042    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1043    where
1044        S: serde::Serializer,
1045    {
1046        serializer.serialize_str(self.as_str())
1047    }
1048}
1049#[cfg(feature = "deserialize")]
1050impl<'de> serde::Deserialize<'de> for CreateTaxCalculationShippingCostTaxBehavior {
1051    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1052        use std::str::FromStr;
1053        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1054        Ok(Self::from_str(&s).expect("infallible"))
1055    }
1056}
1057/// Calculates tax based on the input and returns a Tax `Calculation` object.
1058#[derive(Clone, Debug, serde::Serialize)]
1059pub struct CreateTaxCalculation {
1060    inner: CreateTaxCalculationBuilder,
1061}
1062impl CreateTaxCalculation {
1063    /// Construct a new `CreateTaxCalculation`.
1064    pub fn new(
1065        currency: impl Into<stripe_types::Currency>,
1066        line_items: impl Into<Vec<CreateTaxCalculationLineItems>>,
1067    ) -> Self {
1068        Self { inner: CreateTaxCalculationBuilder::new(currency.into(), line_items.into()) }
1069    }
1070    /// The ID of an existing customer to use for this calculation.
1071    /// If provided, the customer's address and tax IDs are copied to `customer_details`.
1072    pub fn customer(mut self, customer: impl Into<String>) -> Self {
1073        self.inner.customer = Some(customer.into());
1074        self
1075    }
1076    /// Details about the customer, including address and tax IDs.
1077    pub fn customer_details(
1078        mut self,
1079        customer_details: impl Into<CreateTaxCalculationCustomerDetails>,
1080    ) -> Self {
1081        self.inner.customer_details = Some(customer_details.into());
1082        self
1083    }
1084    /// Specifies which fields in the response should be expanded.
1085    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
1086        self.inner.expand = Some(expand.into());
1087        self
1088    }
1089    /// Details about the address from which the goods are being shipped.
1090    pub fn ship_from_details(
1091        mut self,
1092        ship_from_details: impl Into<CreateTaxCalculationShipFromDetails>,
1093    ) -> Self {
1094        self.inner.ship_from_details = Some(ship_from_details.into());
1095        self
1096    }
1097    /// Shipping cost details to be used for the calculation.
1098    pub fn shipping_cost(
1099        mut self,
1100        shipping_cost: impl Into<CreateTaxCalculationShippingCost>,
1101    ) -> Self {
1102        self.inner.shipping_cost = Some(shipping_cost.into());
1103        self
1104    }
1105    /// Timestamp of date at which the tax rules and rates in effect applies for the calculation.
1106    /// Measured in seconds since the Unix epoch.
1107    /// Can be up to 48 hours in the past, and up to 48 hours in the future.
1108    pub fn tax_date(mut self, tax_date: impl Into<stripe_types::Timestamp>) -> Self {
1109        self.inner.tax_date = Some(tax_date.into());
1110        self
1111    }
1112}
1113impl CreateTaxCalculation {
1114    /// Send the request and return the deserialized response.
1115    pub async fn send<C: StripeClient>(
1116        &self,
1117        client: &C,
1118    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1119        self.customize().send(client).await
1120    }
1121
1122    /// Send the request and return the deserialized response, blocking until completion.
1123    pub fn send_blocking<C: StripeBlockingClient>(
1124        &self,
1125        client: &C,
1126    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
1127        self.customize().send_blocking(client)
1128    }
1129}
1130
1131impl StripeRequest for CreateTaxCalculation {
1132    type Output = stripe_misc::TaxCalculation;
1133
1134    fn build(&self) -> RequestBuilder {
1135        RequestBuilder::new(StripeMethod::Post, "/tax/calculations").form(&self.inner)
1136    }
1137}