stripe_misc/tax_association/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Debug, serde::Serialize)]
6struct FindTaxAssociationBuilder {
7    #[serde(skip_serializing_if = "Option::is_none")]
8    expand: Option<Vec<String>>,
9    payment_intent: String,
10}
11impl FindTaxAssociationBuilder {
12    fn new(payment_intent: impl Into<String>) -> Self {
13        Self { expand: None, payment_intent: payment_intent.into() }
14    }
15}
16/// Finds a tax association object by PaymentIntent id.
17#[derive(Clone, Debug, serde::Serialize)]
18pub struct FindTaxAssociation {
19    inner: FindTaxAssociationBuilder,
20}
21impl FindTaxAssociation {
22    /// Construct a new `FindTaxAssociation`.
23    pub fn new(payment_intent: impl Into<String>) -> Self {
24        Self { inner: FindTaxAssociationBuilder::new(payment_intent.into()) }
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 FindTaxAssociation {
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 FindTaxAssociation {
51    type Output = stripe_misc::TaxAssociation;
52
53    fn build(&self) -> RequestBuilder {
54        RequestBuilder::new(StripeMethod::Get, "/tax/associations/find").query(&self.inner)
55    }
56}