collab: Use StripeClient when creating Stripe Checkout sessions (#31644)

This PR updates the `StripeBilling::checkout_with_zed_pro` and
`StripeBilling::checkout_with_zed_pro_trial` methods to use the
`StripeClient` trait instead of using `stripe::Client` directly.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-28 20:57:04 -04:00 committed by GitHub
parent 97579662e6
commit eb863f8fd6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 471 additions and 59 deletions

View file

@ -338,13 +338,11 @@ async fn create_billing_subscription(
}
let customer_id = if let Some(existing_customer) = &existing_billing_customer {
CustomerId::from_str(&existing_customer.stripe_customer_id)
.context("failed to parse customer ID")?
StripeCustomerId(existing_customer.stripe_customer_id.clone().into())
} else {
stripe_billing
.find_or_create_customer_by_email(user.email_address.as_deref())
.await?
.try_into()?
};
let success_url = format!(
@ -355,7 +353,7 @@ async fn create_billing_subscription(
let checkout_session_url = match body.product {
ProductCode::ZedPro => {
stripe_billing
.checkout_with_zed_pro(customer_id, &user.github_login, &success_url)
.checkout_with_zed_pro(&customer_id, &user.github_login, &success_url)
.await?
}
ProductCode::ZedProTrial => {
@ -372,7 +370,7 @@ async fn create_billing_subscription(
stripe_billing
.checkout_with_zed_pro_trial(
customer_id,
&customer_id,
&user.github_login,
feature_flags,
&success_url,