From 2a61916d1e053d752e3ecd15a0b6d0e4dee4e764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Talbot?= <108630700+fetchfern@users.noreply.github.com> Date: Sat, 11 Oct 2025 19:24:21 +0100 Subject: [PATCH] Mark charges from stripe customers with no address as unresolvable (#4521) --- apps/labrinth/src/queue/billing.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/labrinth/src/queue/billing.rs b/apps/labrinth/src/queue/billing.rs index b9bbe4e2..457b5399 100644 --- a/apps/labrinth/src/queue/billing.rs +++ b/apps/labrinth/src/queue/billing.rs @@ -384,11 +384,19 @@ async fn update_anrok_transactions( stripe::Customer::retrieve(stripe_client, &customer_id, &[]) .await?; - let address = customer.address.ok_or_else(|| { - ApiError::InvalidInput( - format!("Could not find any address for Stripe customer of user '{}'", to_base62(c.user_id.0 as u64)) - ) - })?; + let Some(address) = customer.address else { + // We won't really be able to do anything about this. + + warn!( + "Could not find any address for Stripe customer of user '{}', marking as unresolved", + to_base62(c.user_id.0 as u64) + ); + + c.tax_platform_id = Some("unresolved".to_owned()); + c.upsert(txn).await?; + + return Ok(()); + }; (address, tax_platform_id, customer_id) };