collab: Fully move StripeBilling
over to using StripeClient
(#31722)
This PR moves over the last method on `StripeBilling` to use the `StripeClient` trait, allowing us to fully mock out Stripe behaviors for `StripeBilling` in tests. Release Notes: - N/A
This commit is contained in:
parent
406d975f39
commit
c7047d5f0a
7 changed files with 273 additions and 50 deletions
|
@ -5,6 +5,7 @@ use crate::api::{CloudflareIpCountryHeader, SystemIdHeader};
|
|||
use crate::db::billing_subscription::SubscriptionKind;
|
||||
use crate::llm::db::LlmDatabase;
|
||||
use crate::llm::{AGENT_EXTENDED_TRIAL_FEATURE_FLAG, LlmTokenClaims};
|
||||
use crate::stripe_client::StripeCustomerId;
|
||||
use crate::{
|
||||
AppState, Error, Result, auth,
|
||||
db::{
|
||||
|
@ -4055,10 +4056,8 @@ async fn get_llm_api_token(
|
|||
if let Some(billing_subscription) = db.get_active_billing_subscription(user.id).await? {
|
||||
billing_subscription
|
||||
} else {
|
||||
let stripe_customer_id = billing_customer
|
||||
.stripe_customer_id
|
||||
.parse::<stripe::CustomerId>()
|
||||
.context("failed to parse Stripe customer ID from database")?;
|
||||
let stripe_customer_id =
|
||||
StripeCustomerId(billing_customer.stripe_customer_id.clone().into());
|
||||
|
||||
let stripe_subscription = stripe_billing
|
||||
.subscribe_to_zed_free(stripe_customer_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue