mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 01:38:44 +00:00
move billing route
This commit is contained in:
1 parent
e77b946d57
commit
032d4ccc9c
11 files changed
+37
-13
No files matched your search
@@ -10,7 +10,6 @@ use crate::stripe::http_endpoints::checkout::create::stripe_create_checkout_sess
|
||||
use crate::stripe::http_endpoints::customer_portal::stripe_create_customer_portal_session_json_handler::stripe_create_customer_portal_session_json_handler;
|
||||
use crate::stripe::http_endpoints::customer_portal::stripe_create_customer_portal_session_redirect_handler::stripe_create_customer_portal_session_redirect_handler;
|
||||
use crate::stripe::http_endpoints::webhook::stripe_webhook_handler::stripe_webhook_handler;
|
||||
use crate::users::http_endpoints::list_active_user_subscriptions_handler::list_active_user_subscriptions_handler;
|
||||
|
||||
pub fn add_suggested_stripe_billing_routes<T, B> (app: App<T>) -> App<T>
|
||||
where
|
||||
@@ -23,13 +22,9 @@ pub fn add_suggested_stripe_billing_routes<T, B> (app: App<T>) -> App<T>
|
||||
InitError = (),
|
||||
>,
|
||||
{
|
||||
// NB: The /v1/billing/active_subscriptions route has been moved to
|
||||
// storyteller-web (billing_fakeyou_routes). Only Stripe routes remain here.
|
||||
app.service(web::scope("/v1")
|
||||
.service(web::scope("/billing")
|
||||
.service(web::resource("/active_subscriptions")
|
||||
.route(web::get().to(list_active_user_subscriptions_handler))
|
||||
.route(web::head().to(|| HttpResponse::Ok()))
|
||||
)
|
||||
)
|
||||
.service(web::scope("/stripe")
|
||||
.service(web::resource("/webhook")
|
||||
.route(web::post().to(stripe_webhook_handler))
|
||||
|
||||
@@ -19,4 +19,3 @@
|
||||
pub mod default_routes;
|
||||
pub mod paypal;
|
||||
pub mod stripe;
|
||||
pub mod users;
|
||||
@@ -1 +0,0 @@
|
||||
pub mod list_active_user_subscriptions_handler;
|
||||
@@ -1 +0,0 @@
|
||||
pub mod http_endpoints;
|
||||
+1
-1
@@ -98,4 +98,4 @@ pub async fn list_active_user_subscriptions_handler(
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type("application/json")
|
||||
.body(body))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
pub mod list_active_user_subscriptions_handler;
|
||||
@@ -1,6 +1,7 @@
|
||||
pub mod analytics;
|
||||
pub mod app_state;
|
||||
pub mod beta_keys;
|
||||
pub mod billing_fakeyou;
|
||||
pub mod characters;
|
||||
pub mod comments;
|
||||
pub mod credits;
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ mod tests {
|
||||
reference_image_media_tokens: None,
|
||||
reference_video_media_tokens: None,
|
||||
reference_audio_media_tokens: None,
|
||||
reference_character_tokens: None,
|
||||
resolution,
|
||||
aspect_ratio,
|
||||
quality: None,
|
||||
|
||||
+4
-2
@@ -1,4 +1,5 @@
|
||||
use crate::http_server::routes::application_routes::analytics_routes::add_analytics_routes;
|
||||
use crate::http_server::routes::application_routes::billing_fakeyou_routes::add_billing_fakeyou_routes;
|
||||
use crate::http_server::routes::application_routes::character_routes::add_character_routes;
|
||||
use crate::http_server::routes::application_routes::comments_routes::add_comments_routes;
|
||||
use crate::http_server::routes::application_routes::credits_routes::add_credits_routes;
|
||||
@@ -74,8 +75,9 @@ where
|
||||
app = add_stripe_artcraft_routes(app); // /v1/stripe_artcraft/...
|
||||
app = add_subscription_routes(app); // /v1/subscriptions/...
|
||||
|
||||
// FakeYou Billing component - still necessary for FakeYou monetization
|
||||
app = add_suggested_stripe_billing_routes(app); // /stripe, billing, webhooks, etc.
|
||||
// FakeYou Billing
|
||||
app = add_billing_fakeyou_routes(app); // /v1/billing/active_subscriptions
|
||||
app = add_suggested_stripe_billing_routes(app); // /stripe, webhooks, etc.
|
||||
|
||||
app
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
use crate::http_server::endpoints::billing_fakeyou::list_active_user_subscriptions_handler::list_active_user_subscriptions_handler;
|
||||
use actix_http::body::MessageBody;
|
||||
use actix_service::ServiceFactory;
|
||||
use actix_web::dev::{ServiceRequest, ServiceResponse};
|
||||
use actix_web::{web, App, Error, HttpResponse};
|
||||
|
||||
pub fn add_billing_fakeyou_routes<T, B>(app: App<T>) -> App<T>
|
||||
where
|
||||
B: MessageBody,
|
||||
T: ServiceFactory<
|
||||
ServiceRequest,
|
||||
Config = (),
|
||||
Response = ServiceResponse<B>,
|
||||
Error = Error,
|
||||
InitError = (),
|
||||
>,
|
||||
{
|
||||
app.service(web::scope("/v1")
|
||||
.service(web::scope("/billing")
|
||||
.service(web::resource("/active_subscriptions")
|
||||
.route(web::get().to(list_active_user_subscriptions_handler))
|
||||
.route(web::head().to(|| HttpResponse::Ok()))
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
mod analytics_routes;
|
||||
mod billing_fakeyou_routes;
|
||||
mod character_routes;
|
||||
mod comments_routes;
|
||||
mod credits_routes;
|
||||
|
||||
Reference in new issue
Block a user