collab: Subscribe to Zed Free when a subscription is canceled or paused (#30965)
This PR makes it so that when a Stripe subscription is canceled or paused we'll subscribe the user to Zed Free. Release Notes: - N/A
This commit is contained in:
@@ -1185,6 +1185,21 @@ async fn sync_subscription(
|
||||
.await?;
|
||||
}
|
||||
|
||||
if let Some(stripe_billing) = app.stripe_billing.as_ref() {
|
||||
if subscription.status == SubscriptionStatus::Canceled
|
||||
|| subscription.status == SubscriptionStatus::Paused
|
||||
{
|
||||
let stripe_customer_id = billing_customer
|
||||
.stripe_customer_id
|
||||
.parse::<stripe::CustomerId>()
|
||||
.context("failed to parse Stripe customer ID from database")?;
|
||||
|
||||
stripe_billing
|
||||
.subscribe_to_zed_free(stripe_customer_id)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(billing_customer)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user