chore: update subscription entity (#1162)
This commit is contained in:
parent
c5cdb06b77
commit
56f4c0698c
|
|
@ -1,7 +1,7 @@
|
|||
use crate::Client;
|
||||
use client_api_entity::billing_dto::{
|
||||
SetSubscriptionRecurringInterval, SubscriptionCancelRequest, SubscriptionLinkRequest,
|
||||
SubscriptionPlanDetail, SubscriptionTrialRequest, WorkspaceUsageAndLimit,
|
||||
SubscriptionPlanDetail, WorkspaceUsageAndLimit,
|
||||
};
|
||||
use reqwest::Method;
|
||||
use shared_entity::{
|
||||
|
|
@ -222,24 +222,4 @@ impl Client {
|
|||
.await?
|
||||
.into_data()
|
||||
}
|
||||
|
||||
/// request a free trial for plan
|
||||
pub async fn post_subscription_free_trial(
|
||||
&self,
|
||||
workspace_id: &str,
|
||||
plan: SubscriptionPlan,
|
||||
) -> Result<(), AppResponseError> {
|
||||
let url = format!(
|
||||
"{}/billing/api/v1/subscription-trial/{}",
|
||||
self.base_billing_url(),
|
||||
workspace_id
|
||||
);
|
||||
let resp = self
|
||||
.cloud_client
|
||||
.post(&url)
|
||||
.query(&SubscriptionTrialRequest { plan })
|
||||
.send()
|
||||
.await?;
|
||||
AppResponse::<()>::from_response(resp).await?.into_error()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,4 +163,7 @@ pub struct SubscriptionLinkRequest {
|
|||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct SubscriptionTrialRequest {
|
||||
pub plan: SubscriptionPlan,
|
||||
#[serde(default)]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub period_days: Option<u32>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ use std::collections::{HashMap, HashSet};
|
|||
use std::env::temp_dir;
|
||||
use std::fmt::Display;
|
||||
use std::fs::Permissions;
|
||||
use std::io::ErrorKind;
|
||||
use std::ops::DerefMut;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
|
@ -596,7 +597,11 @@ async fn process_task(
|
|||
"[Import]: {} deleted unzip file: {:?}",
|
||||
task.workspace_id, unzip_dir_path
|
||||
),
|
||||
Err(err) => error!("Failed to delete unzip file: {:?}", err),
|
||||
Err(err) => {
|
||||
if err.kind() != ErrorKind::NotFound {
|
||||
error!("Failed to delete unzip file: {:?}", err);
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue