From 158f5171fc1a9c4c079449e6340b6b0d4fdb2f05 Mon Sep 17 00:00:00 2001 From: fetch Date: Mon, 4 Aug 2025 21:07:55 -0400 Subject: [PATCH] Add partner subscription type --- apps/labrinth/src/models/v3/billing.rs | 6 ++++++ apps/labrinth/src/routes/internal/billing.rs | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/apps/labrinth/src/models/v3/billing.rs b/apps/labrinth/src/models/v3/billing.rs index 2757a7fc9..f99fab33a 100644 --- a/apps/labrinth/src/models/v3/billing.rs +++ b/apps/labrinth/src/models/v3/billing.rs @@ -24,6 +24,12 @@ pub enum ProductMetadata { swap: u32, storage: u32, }, + Medal { + cpu: u32, + ram: u32, + swap: u32, + storage: u32, + }, } #[derive(Serialize, Deserialize)] diff --git a/apps/labrinth/src/routes/internal/billing.rs b/apps/labrinth/src/routes/internal/billing.rs index a2a88ed53..f5eddd856 100644 --- a/apps/labrinth/src/routes/internal/billing.rs +++ b/apps/labrinth/src/routes/internal/billing.rs @@ -1706,6 +1706,17 @@ pub async fn stripe_webhook( // Provision subscription match metadata.product_item.metadata { + ProductMetadata::Medal { + cpu: _, + ram: _, + swap: _, + storage: _, + } => { + todo!( + "Promote Medal subscription to Pyro subscription" + ) + } + ProductMetadata::Midas => { let badges = metadata.user_item.badges | Badges::MIDAS; @@ -2186,6 +2197,10 @@ pub async fn index_subscriptions(pool: PgPool, redis: RedisPool) { }; let unprovisioned = match product.metadata { + ProductMetadata::Medal { .. } => { + todo!("Unprovision Medal subscription") + } + ProductMetadata::Midas => { let badges = user.badges - Badges::MIDAS;