collab: Fetch more meters and prices when initializing StripeBilling (#19288)

This PR makes it so we fetch more meters and prices when initializing
`StripeBilling`, as we have more than 10 meters defined.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-10-16 11:40:56 -04:00 committed by GitHub
parent 834d50f0db
commit 9c3d80d6e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,7 +45,13 @@ impl StripeBilling {
let (meters, prices) = futures::try_join!(
StripeMeter::list(&self.client),
stripe::Price::list(&self.client, &stripe::ListPrices::default())
stripe::Price::list(
&self.client,
&stripe::ListPrices {
limit: Some(100),
..Default::default()
}
)
)?;
for meter in meters.data {
@ -396,9 +402,12 @@ impl StripeMeter {
pub fn list(client: &stripe::Client) -> stripe::Response<stripe::List<Self>> {
#[derive(Serialize)]
struct Params {}
struct Params {
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<u64>,
}
client.get_query("/billing/meters", Params {})
client.get_query("/billing/meters", Params { limit: Some(100) })
}
}