use serde_json::json;
use crate::model::*;
use crate::FluentRequest;
use serde::{Serialize, Deserialize};
use httpclient::InMemoryResponseExt;
use crate::StripeClient;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetPaymentIntentsIntentRequest {
pub client_secret: Option<String>,
pub expand: Option<Vec<String>>,
pub intent: String,
}
impl GetPaymentIntentsIntentRequest {}
impl FluentRequest<'_, GetPaymentIntentsIntentRequest> {
pub fn client_secret(mut self, client_secret: &str) -> Self {
self.params.client_secret = Some(client_secret.to_owned());
self
}
pub fn expand(mut self, expand: impl IntoIterator<Item = impl AsRef<str>>) -> Self {
self
.params
.expand = Some(expand.into_iter().map(|s| s.as_ref().to_owned()).collect());
self
}
}
impl<'a> ::std::future::IntoFuture
for FluentRequest<'a, GetPaymentIntentsIntentRequest> {
type Output = httpclient::InMemoryResult<PaymentIntent>;
type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(async {
let url = &format!(
"/v1/payment_intents/{intent}", intent = self.params.intent
);
let mut r = self.client.client.get(url);
r = r.set_query(self.params);
r = self.client.authenticate(r);
let res = r.await?;
res.json().map_err(Into::into)
})
}
}