From e48ee589ad72e0889de1de251bcb9ff34786f1f2 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 5 Sep 2025 05:17:46 -0400 Subject: [PATCH] retry behavior --- .../windows/open_storyteller_billing_window.rs | 4 ++-- .../lookup_purchase_from_payment_intent_success.rs | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/desktop/artcraft/src/services/storyteller/windows/open_storyteller_billing_window.rs b/crates/desktop/artcraft/src/services/storyteller/windows/open_storyteller_billing_window.rs index e5e40e1eb8..65619d5376 100644 --- a/crates/desktop/artcraft/src/services/storyteller/windows/open_storyteller_billing_window.rs +++ b/crates/desktop/artcraft/src/services/storyteller/windows/open_storyteller_billing_window.rs @@ -67,7 +67,7 @@ pub async fn open_storyteller_billing_window( ).await? }, }; - + do_open_window(args.app, args.app_data_root, checkout_url).await?; Ok(()) @@ -133,7 +133,7 @@ async fn do_open_window( info!("Opening checkout window..."); // TODO(bt,2025-09-01): We probably need to open this in a real browser to get autocomplete. - let window = WebviewWindowBuilder::new(app, BILLING_WINDOW_NAME, url) + let _window = WebviewWindowBuilder::new(app, BILLING_WINDOW_NAME, url) .always_on_top(false) .title("ArtCraft Billing") .center() diff --git a/crates/service/plugins/billing_artcraft/src/requests/lookup_purchase_from_payment_intent_success.rs b/crates/service/plugins/billing_artcraft/src/requests/lookup_purchase_from_payment_intent_success.rs index d3010b040d..abf16e52f8 100644 --- a/crates/service/plugins/billing_artcraft/src/requests/lookup_purchase_from_payment_intent_success.rs +++ b/crates/service/plugins/billing_artcraft/src/requests/lookup_purchase_from_payment_intent_success.rs @@ -1,9 +1,10 @@ use crate::endpoints::webhook::webhook_event_handlers::stripe_artcraft_webhook_error::StripeArtcraftWebhookError; use crate::utils::expand_ids::expand_product_id::expand_product_id; use log::{error, warn}; -use stripe::Client; +use stripe::{Client, RequestStrategy, StripeRequest}; use stripe_checkout::checkout_session::{ListCheckoutSession, ListLineItemsCheckoutSession}; -use stripe_shared::PriceType; +use stripe_shared::{CheckoutSession, CheckoutSessionItem, PriceType}; +use stripe_types::List; #[derive(Debug, Clone)] pub struct PurchaseSummary { @@ -24,6 +25,9 @@ pub async fn lookup_purchase_from_payment_intent_success( let result = ListCheckoutSession::new() .payment_intent(payment_intent_id) .limit(1) + .build() + .customize::>() + .request_strategy(RequestStrategy::ExponentialBackoff(3)) .send(stripe_client) .await .map_err(|err| { @@ -50,6 +54,9 @@ pub async fn lookup_purchase_from_payment_intent_success( .ok_or_else(|| anyhow::anyhow!("No items in ListCheckoutSession request."))?; let line_items = ListLineItemsCheckoutSession::new(checkout_session_id) + .build() + .customize::>() + .request_strategy(RequestStrategy::ExponentialBackoff(3)) .send(stripe_client) .await .map_err(|err| {