chore: billing api recurring interval
This commit is contained in:
parent
8186b3836b
commit
e9bdceec14
|
|
@ -1,5 +1,7 @@
|
|||
use crate::Client;
|
||||
use client_api_entity::billing_dto::{SubscriptionCancelRequest, WorkspaceUsageAndLimit};
|
||||
use client_api_entity::billing_dto::{
|
||||
SetSubscriptionRecurringInterval, SubscriptionCancelRequest, WorkspaceUsageAndLimit,
|
||||
};
|
||||
use reqwest::Method;
|
||||
use shared_entity::{
|
||||
dto::billing_dto::{RecurringInterval, SubscriptionPlan, WorkspaceSubscriptionStatus},
|
||||
|
|
@ -177,4 +179,23 @@ impl Client {
|
|||
.await?
|
||||
.into_data()
|
||||
}
|
||||
|
||||
/// Set subscription recurring interval
|
||||
pub async fn set_subscription_recurring_interval(
|
||||
&self,
|
||||
set_sub_recur: &SetSubscriptionRecurringInterval,
|
||||
) -> Result<(), AppResponseError> {
|
||||
let url = format!(
|
||||
"{}/billing/api/v1/subscription-recurring-interval",
|
||||
self.base_billing_url(),
|
||||
);
|
||||
let resp = self
|
||||
.http_client_with_auth(Method::POST, &url)
|
||||
.await?
|
||||
.json(set_sub_recur)
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
AppResponse::<()>::from_response(resp).await?.into_data()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,3 +126,10 @@ pub struct SubscriptionCancelRequest {
|
|||
pub plan: SubscriptionPlan,
|
||||
pub sync: bool, // if true, this request will block until stripe has sent the cancelation webhook
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct SetSubscriptionRecurringInterval {
|
||||
pub workspace_id: String,
|
||||
pub plan: SubscriptionPlan,
|
||||
pub recurring_interval: RecurringInterval,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue