diff --git a/Cargo.lock b/Cargo.lock index 3e361711af..307758cdf9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1465,7 +1465,9 @@ dependencies = [ "async-trait", "chrono", "component_traits", - "enums", + "enums_api", + "enums_convert", + "enums_db", "errors", "http_server_common", "log", diff --git a/crates/service/plugins/billing/Cargo.toml b/crates/service/plugins/billing/Cargo.toml index 31902fe5d6..5f5d9ef8f2 100644 --- a/crates/service/plugins/billing/Cargo.toml +++ b/crates/service/plugins/billing/Cargo.toml @@ -21,7 +21,9 @@ workspace-build-acceleration.workspace = true # Internal component_traits.workspace = true -enums.workspace = true +enums_db.workspace = true +enums_api.workspace = true +enums_convert.workspace = true errors.workspace = true http_server_common = { path = "../../../lib/deprecated/http_server_common" } mysql_queries = { path = "../../../schema/database/mysql_queries" } diff --git a/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_created_handler.rs b/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_created_handler.rs index 26bdfdef45..704e26e192 100644 --- a/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_created_handler.rs +++ b/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_created_handler.rs @@ -1,7 +1,7 @@ use log::error; use sqlx::MySqlPool; use stripe::Subscription; -use enums::common::payments_namespace::PaymentsNamespace; +use enums_db::common::payments_namespace::PaymentsNamespace; use mysql_queries::queries::users::user::update::update_user_record_with_new_stripe_customer_id::update_user_record_with_new_stripe_customer_id; use mysql_queries::queries::users::user_subscriptions::get_user_subscription_by_stripe_subscription_id::get_user_subscription_by_stripe_subscription_id; use mysql_queries::queries::users::user_subscriptions::upsert_user_subscription_by_stripe_id::UpsertUserSubscription; diff --git a/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_deleted_handler.rs b/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_deleted_handler.rs index 35b88271d3..898d1f6082 100644 --- a/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_deleted_handler.rs +++ b/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_deleted_handler.rs @@ -1,7 +1,7 @@ use log::error; use sqlx::MySqlPool; use stripe::Subscription; -use enums::common::payments_namespace::PaymentsNamespace; +use enums_db::common::payments_namespace::PaymentsNamespace; use mysql_queries::queries::users::user_subscriptions::get_user_subscription_by_stripe_subscription_id::get_user_subscription_by_stripe_subscription_id; use mysql_queries::queries::users::user_subscriptions::upsert_user_subscription_by_stripe_id::UpsertUserSubscription; use reusable_types::stripe::stripe_subscription_status::StripeSubscriptionStatus; diff --git a/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_updated_handler.rs b/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_updated_handler.rs index ea84512f39..5775f4ecc8 100644 --- a/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_updated_handler.rs +++ b/crates/service/plugins/billing/src/stripe/http_endpoints/webhook/webhook_event_handlers/customer_subscription/customer_subscription_updated_handler.rs @@ -1,7 +1,7 @@ use log::{error, info}; use sqlx::MySqlPool; use stripe::Subscription; -use enums::common::payments_namespace::PaymentsNamespace; +use enums_db::common::payments_namespace::PaymentsNamespace; use mysql_queries::queries::users::user::update::update_user_record_with_new_stripe_customer_id::update_user_record_with_new_stripe_customer_id; use mysql_queries::queries::users::user_subscriptions::get_user_subscription_by_stripe_subscription_id::get_user_subscription_by_stripe_subscription_id; use mysql_queries::queries::users::user_subscriptions::upsert_user_subscription_by_stripe_id::UpsertUserSubscription; diff --git a/crates/service/plugins/billing/src/stripe/traits/internal_subscription_product_lookup.rs b/crates/service/plugins/billing/src/stripe/traits/internal_subscription_product_lookup.rs index 904ba75bec..0fa07bcd58 100644 --- a/crates/service/plugins/billing/src/stripe/traits/internal_subscription_product_lookup.rs +++ b/crates/service/plugins/billing/src/stripe/traits/internal_subscription_product_lookup.rs @@ -1,4 +1,4 @@ -use enums::common::payments_namespace::PaymentsNamespace; +use enums_db::common::payments_namespace::PaymentsNamespace; use std::error::Error; use std::fmt::{Display, Formatter}; diff --git a/crates/service/plugins/billing/src/users/http_endpoints/list_active_user_subscriptions_handler.rs b/crates/service/plugins/billing/src/users/http_endpoints/list_active_user_subscriptions_handler.rs index 9df9056393..43f39d20ff 100644 --- a/crates/service/plugins/billing/src/users/http_endpoints/list_active_user_subscriptions_handler.rs +++ b/crates/service/plugins/billing/src/users/http_endpoints/list_active_user_subscriptions_handler.rs @@ -1,7 +1,8 @@ use actix_http::StatusCode; use actix_web::{web, HttpRequest, HttpResponse, ResponseError}; use component_traits::traits::internal_user_lookup::InternalUserLookup; -use enums::common::payments_namespace::PaymentsNamespace; +use enums_api::common::payments_namespace::PaymentsNamespace; +use enums_convert::common::payments_namespace::{payments_namespace_to_api, payments_namespace_to_db}; use http_server_common::response::serialize_as_json_error::serialize_as_json_error; use log::error; use utoipa::ToSchema; @@ -86,7 +87,7 @@ pub async fn list_active_user_subscriptions_handler( active_subscriptions: user_metadata.existing_subscription_keys .into_iter() .map(|sub| SubscriptionProductKey { - namespace: sub.internal_subscription_namespace, + namespace: payments_namespace_to_api(&sub.internal_subscription_namespace), product_slug: sub.internal_subscription_product_slug, }) .collect(),