From 36f80efc547f9b4719eceaa60383298971f60f62 Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Mon, 22 Jul 2024 18:47:12 +0100 Subject: [PATCH] fix(strike): delete current strike webhooks --- crates/cdk-strike/Cargo.toml | 3 ++- crates/cdk-strike/src/lib.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/cdk-strike/Cargo.toml b/crates/cdk-strike/Cargo.toml index 2a98f720..20433bc5 100644 --- a/crates/cdk-strike/Cargo.toml +++ b/crates/cdk-strike/Cargo.toml @@ -20,4 +20,5 @@ tokio.workspace = true tracing.workspace = true thiserror.workspace = true uuid.workspace = true -strike-rs = "0.1.0" +# strike-rs = "0.1.0" +strike-rs = { git = "https://github.com/thesimplekid/strike-rs" } diff --git a/crates/cdk-strike/src/lib.rs b/crates/cdk-strike/src/lib.rs index 8b859651..c506f3b9 100644 --- a/crates/cdk-strike/src/lib.rs +++ b/crates/cdk-strike/src/lib.rs @@ -221,6 +221,14 @@ impl Strike { webhook_endpoint: &str, sender: tokio::sync::mpsc::Sender, ) -> anyhow::Result { + let subs = self.strike_api.get_current_subscriptions().await?; + + tracing::debug!("Got {} current subscriptions", subs.len()); + + for sub in subs { + self.strike_api.delete_subscription(sub.id).await?; + } + self.strike_api .create_invoice_webhook_router(webhook_endpoint, sender) .await