From d8512d50de6cb0c71aba22251f5c3027c3ed7856 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Mon, 3 Jul 2023 12:57:48 -0700 Subject: [PATCH] just pass the whole string through based on this test (which i think async-stripe forked): https://docs.rs/stripe-rust/0.12.3/src/stripe/resources/event.rs.html#355 and then based on the struct that they deserialize into: https://docs.rs/async-stripe/latest/src/stripe/resources/generated/event.rs.html#16 --- web3_proxy/src/frontend/users/payment_stripe.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/web3_proxy/src/frontend/users/payment_stripe.rs b/web3_proxy/src/frontend/users/payment_stripe.rs index 00dcd92d..27989071 100644 --- a/web3_proxy/src/frontend/users/payment_stripe.rs +++ b/web3_proxy/src/frontend/users/payment_stripe.rs @@ -51,12 +51,6 @@ pub async fn user_stripe_deposits_get( Ok(Json(response).into_response()) } -/// the JSON input to the `user_balance_stripe_post` handler. -#[derive(Debug, Deserialize)] -pub struct StripePost { - data: Box, -} - /// `POST /user/balance/stripe` -- Process a stripe transaction; /// this endpoint is called from the webhook with the user_id parameter in the request #[debug_handler] @@ -64,7 +58,7 @@ pub async fn user_balance_stripe_post( Extension(app): Extension>, // InsecureClientIp(ip): InsecureClientIp, headers: HeaderMap, - Json(payload): Json, + payload: String, ) -> Web3ProxyResponse { // TODO: (high) rate limits by IP address. login limiter is probably too low // TODO: maybe instead, a bad stripe-header should ban the IP? or a good one should allow it? @@ -88,9 +82,6 @@ pub async fn user_balance_stripe_post( )); }; - let payload = - serde_json::to_string(&payload.data).web3_context("could not parse payload data")?; - let signature = signature .to_str() .web3_context("Could not parse stripe signature as byte-string")?;