From cec81bfb8ea87e8a0545e4dac57b74208a179cfc Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 1 Sep 2025 15:31:04 -0400 Subject: [PATCH] about to test new crate to isolate new version of async-stripe --- .../plugins/billing_artcraft/Cargo.toml | 54 +++++++++++++++++++ .../plugins/billing_artcraft/src/lib.rs | 0 crates/service/web/storyteller_web/Cargo.toml | 8 +-- .../stripe_artcraft_webhook_handler.rs | 3 +- 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 crates/service/plugins/billing_artcraft/Cargo.toml create mode 100644 crates/service/plugins/billing_artcraft/src/lib.rs diff --git a/crates/service/plugins/billing_artcraft/Cargo.toml b/crates/service/plugins/billing_artcraft/Cargo.toml new file mode 100644 index 0000000000..36e746b052 --- /dev/null +++ b/crates/service/plugins/billing_artcraft/Cargo.toml @@ -0,0 +1,54 @@ +[package] +publish = false +name = "billing_component" +edition = "2018" +version = "0.0.1" +authors = [ + "Brandon Thomas ", + "Brandon Thomas ", +] + +[lib] +# NB: This might be necessitated because of stripe API versions vs. async-stripe crate versions +name = "billing_artcraft" +path = "src/lib.rs" + +[package.metadata.cargo-udeps.ignore] +normal = ["workspace-build-acceleration"] + +[dependencies] +# Workspace hack (faster compile times) +workspace-build-acceleration.workspace = true + +# Internal +errors.workspace = true +mysql_queries.workspace = true +#http_server_common = { path = "../../../lib/deprecated/http_server_common" } +#mysql_queries = { path = "../../../schema/database/mysql_queries" } +#reusable_types = { path = "../../../schema/public/reusable_types" } +#url_config = { path = "../../../lib/url_config" } +#user_traits_component = { path = "../user_traits_component" } + +# External +actix-http.workspace = true +actix-web.workspace = true +anyhow.workspace = true +chrono.workspace = true +log.workspace = true +once_cell.workspace = true +serde.workspace = true +serde_derive.workspace = true +serde_json.workspace = true + +# Money +async-stripe = { version = "1.0.0-alpha.2", features = ["runtime-tokio-hyper"] } +async-stripe-core = { version = "1.0.0-alpha.2", features = ["customer"] } + +#sqlx = { version = "0.7.4", features = [ "mysql", "runtime-tokio", "tls-rustls", "chrono" ] } +#utoipa = { version = "4", features = ["chrono","actix_extras"] } + +[dev-dependencies] +mockall = "0.12.1" + +# NB: Tokio version matches `async-stripe` transitive dep; features are for testing +tokio = { version = "1.38.0", features = ["rt", "macros"] } diff --git a/crates/service/plugins/billing_artcraft/src/lib.rs b/crates/service/plugins/billing_artcraft/src/lib.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/crates/service/web/storyteller_web/Cargo.toml b/crates/service/web/storyteller_web/Cargo.toml index f9725f923e..8f418ee018 100644 --- a/crates/service/web/storyteller_web/Cargo.toml +++ b/crates/service/web/storyteller_web/Cargo.toml @@ -101,6 +101,11 @@ url.workspace = true # Stripe for ArtCraft async_stripe_artcraft = { package = "async-stripe", version = "0.41.0", default-features = false, features = ["runtime-tokio-hyper", "connect", "billing", "checkout", "webhook-events"] } +#async_stripe_artcraft = { git = "https://github.com/arlyon/async-stripe", branch = "openapi-1720743905", default-features = false, features = ["runtime-tokio-hyper", "connect", "billing", "checkout", "webhook-events"] } +#async_stripe_artcraft = { git = "https://github.com/arlyon/async-stripe", branch = "next", default-features = false, features = ["runtime-tokio-hyper", "connect", "billing", "checkout", "webhook-events"] } + +# Money +async-stripe = { version = "0.26.0", default-features = false, features = ["runtime-tokio-hyper", "connect", "billing", "checkout", "webhook-events"] } # Language tag parsing # TODO: Move to language support crate @@ -145,9 +150,6 @@ actix-web.workspace = true actix-web-actors.workspace = true actix-web-lab.workspace = true -# Money -async-stripe = { version = "0.26.0", default-features = false, features = ["runtime-tokio-hyper", "connect", "billing", "checkout", "webhook-events"] } - # Crypto magic-crypt = "3.1.13" # encrypting sort IDs for the frontend so we don't leak info md-5 = "0.10.6" # gravatar diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/stripe_artcraft/webhook/stripe_artcraft_webhook_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/stripe_artcraft/webhook/stripe_artcraft_webhook_handler.rs index a894781928..1b466797bc 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/stripe_artcraft/webhook/stripe_artcraft_webhook_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/stripe_artcraft/webhook/stripe_artcraft_webhook_handler.rs @@ -13,8 +13,6 @@ use mysql_queries::queries::billing::stripe::insert_stripe_webhook_event_log::In use sqlx::pool::PoolConnection; use sqlx::{MySql, MySqlConnection, MySqlPool}; use std::sync::Arc; -// TODO: Webhook signing key -// Mysql connector #[derive(Serialize)] pub struct StripeArtcraftWebhookSuccessResponse { @@ -62,6 +60,7 @@ pub async fn stripe_artcraft_webhook_handler( .map_err(|e| { let reason = format!("Could not construct Stripe webhook event: {:?}", e); error!("{}", &reason); + println!("{:?}", webhook_payload); CommonWebError::BadInputWithSimpleMessage(reason) })?;