Remove Stripe (#1217)

This commit is contained in:
Kai Jellinghaus
2023-02-22 19:15:10 +01:00
committed by GitHub
parent dbc59e9521
commit 81ffd49bef
2 changed files with 24 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ name = "windmill_api"
path = "src/lib.rs"
[features]
enterprise = ["windmill-queue/enterprise"]
enterprise = ["windmill-queue/enterprise", "async-stripe"]
[dependencies]
windmill-queue.workspace = true
@@ -65,7 +65,7 @@ hmac.workspace = true
cookie.workspace = true
sha2.workspace = true
urlencoding.workspace = true
async-stripe.workspace = true
async-stripe = { workspace = true, optional = true }
lazy_static.workspace = true
prometheus.workspace = true
async_zip.workspace = true

View File

@@ -6,8 +6,11 @@
* LICENSE-AGPL for a copy of the license.
*/
#[cfg(enterprise)]
use std::str::FromStr;
#[cfg(enterprise)]
use crate::BASE_URL;
use crate::{
apps::AppWithLastVersion,
db::{UserDB, DB},
@@ -15,16 +18,19 @@ use crate::{
resources::{Resource, ResourceType},
users::{Authed, WorkspaceInvite, NEW_USER_WEBHOOK},
utils::require_super_admin,
BASE_URL, HTTP_CLIENT,
HTTP_CLIENT,
};
#[cfg(enterprise)]
use axum::response::Redirect;
use axum::{
body::StreamBody,
extract::{Extension, Path, Query},
headers,
response::{IntoResponse, Redirect},
response::IntoResponse,
routing::{delete, get, post},
Json, Router,
};
#[cfg(enterprise)]
use stripe::CustomerId;
use windmill_audit::{audit_log, ActionKind};
use windmill_common::{
@@ -43,7 +49,7 @@ use tokio::fs::File;
use tokio_util::io::ReaderStream;
pub fn workspaced_service() -> Router {
Router::new()
let router = Router::new()
.route("/list_pending_invites", get(list_pending_invites))
.route("/update", post(edit_workspace))
.route("/archive", post(archive_workspace))
@@ -55,9 +61,16 @@ pub fn workspaced_service() -> Router {
.route("/edit_webhook", post(edit_webhook))
.route("/edit_auto_invite", post(edit_auto_invite))
.route("/tarball", get(tarball_workspace))
.route("/premium_info", get(premium_info))
.route("/checkout", get(stripe_checkout))
.route("/billing_portal", get(stripe_portal))
.route("/premium_info", get(premium_info));
#[cfg(enterprise)]
let router = {
router
.route("/checkout", get(stripe_checkout))
.route("/billing_portal", get(stripe_portal));
};
router
}
pub fn global_service() -> Router {
Router::new()
@@ -217,11 +230,13 @@ async fn premium_info(
Ok(Json(row))
}
#[cfg(enterprise)]
#[derive(Deserialize)]
struct PlanQuery {
plan: String,
}
#[cfg(enterprise)]
async fn stripe_checkout(
authed: Authed,
Path(w_id): Path<String>,
@@ -287,6 +302,7 @@ async fn stripe_checkout(
}
}
#[cfg(enterprise)]
async fn stripe_portal(
authed: Authed,
Path(w_id): Path<String>,