From 6fa1369c49224efa18a32251da567fcf09132ea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gonz=C3=A1lez?= <7822554+AlexTMjugador@users.noreply.github.com> Date: Sat, 31 May 2025 11:00:08 +0200 Subject: [PATCH] fix(labrinth): tentative billing period update fix (#3722) * fix(labrinth/billing): add Spain and Singapore to the list of countries for currency inferences This should fix payments in those countries not going through with their local currencies for products that do not have USD-only pricing. * fix(labrinth/billing): tentative fix for subscription periods not updating --- apps/labrinth/src/routes/internal/billing.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/labrinth/src/routes/internal/billing.rs b/apps/labrinth/src/routes/internal/billing.rs index 2c4920da9..39b0a4767 100644 --- a/apps/labrinth/src/routes/internal/billing.rs +++ b/apps/labrinth/src/routes/internal/billing.rs @@ -1020,6 +1020,7 @@ fn infer_currency_code(country: &str) -> String { "BE" => "EUR", "CY" => "EUR", "EE" => "EUR", + "ES" => "EUR", "FI" => "EUR", "FR" => "EUR", "DE" => "EUR", @@ -1066,6 +1067,7 @@ fn infer_currency_code(country: &str) -> String { "TW" => "TWD", "SA" => "SAR", "QA" => "QAR", + "SG" => "SGD", _ => "USD", } .to_string() @@ -1302,6 +1304,12 @@ pub async fn initiate_payment( amount: Some(price), currency: Some(stripe_currency), customer: Some(customer), + metadata: interval.map(|interval| { + HashMap::from([( + "modrinth_subscription_interval".to_string(), + interval.as_str().to_string(), + )]) + }), ..Default::default() };