Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
collab: Fix deserialization of create meter event response (#31982)
Marshall Bowersd108e5f53c46
diff --git a/crates/collab/src/stripe_client/real_stripe_client.rs b/crates/collab/src/stripe_client/real_stripe_client.rsindex a7fc77e7a04..db9c6d9eca2 100644--- a/crates/collab/src/stripe_client/real_stripe_client.rs+++ b/crates/collab/src/stripe_client/real_stripe_client.rs@@ -3,7 +3,7 @@ use std::sync::Arc;use anyhow::{Context as _, Result, anyhow};use async_trait::async_trait;-use serde::Serialize;+use serde::{Deserialize, Serialize};use stripe::{CancellationDetails, CancellationDetailsReason, CheckoutSession, CheckoutSessionMode,CheckoutSessionPaymentMethodCollection, CreateCheckoutSession, CreateCheckoutSessionLineItems,@@ -213,9 +213,18 @@ impl StripeClient for RealStripeClient {}async fn create_meter_event(&self, params: StripeCreateMeterEventParams<'_>) -> Result<()> {+ #[derive(Deserialize)]+ struct StripeMeterEvent {+ pub identifier: String,+ }+let identifier = params.identifier;- match self.client.post_form("/billing/meter_events", params).await {- Ok(event) => Ok(event),+ match self+ .client+ .post_form::<StripeMeterEvent, _>("/billing/meter_events", params)+ .await+ {+ Ok(_event) => Ok(()),Err(stripe::StripeError::Stripe(error)) => {if error.http_status == 400&& error@@ -228,7 +237,7 @@ impl StripeClient for RealStripeClient {Err(anyhow!(stripe::StripeError::Stripe(error)))}}- Err(error) => Err(anyhow!(error)),+ Err(error) => Err(anyhow!("failed to create meter event: {error:?}")),}}