fix(strike): delete current strike webhooks

This commit is contained in:
thesimplekid
2024-07-22 18:47:12 +01:00
parent 97fd83c8f4
commit 36f80efc54
2 changed files with 10 additions and 1 deletions

View File

@@ -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" }

View File

@@ -221,6 +221,14 @@ impl Strike {
webhook_endpoint: &str,
sender: tokio::sync::mpsc::Sender<String>,
) -> anyhow::Result<Router> {
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