From 7044edc63c02534289563dcf8973fca256c3bda4 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Sat, 1 Jul 2023 09:10:53 -0700 Subject: [PATCH] check multiple posible stripe headers --- web3_proxy/src/frontend/users/payment_stripe.rs | 16 ++++++++++++---- web3_proxy/tests/test_proxy.rs | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/web3_proxy/src/frontend/users/payment_stripe.rs b/web3_proxy/src/frontend/users/payment_stripe.rs index f442df63..00507245 100644 --- a/web3_proxy/src/frontend/users/payment_stripe.rs +++ b/web3_proxy/src/frontend/users/payment_stripe.rs @@ -101,11 +101,19 @@ pub async fn user_balance_stripe_post( // ))?; // TODO Get this from the header - let signature = headers - .get("STRIPE_SIGNATURE") - .ok_or(Web3ProxyError::BadRequest( + let signature = if let Some(x) = headers.get("stripe-signature") { + x + } else if let Some(x) = headers.get("STRIPE_SIGNATURE") { + x + } else if let Some(x) = headers.get("HTTP_STRIPE_SIGNATURE") { + x + } else { + return Err(Web3ProxyError::BadRequest( "You have not provided a 'STRIPE_SIGNATURE' for the Stripe payload".into(), - ))? + )); + }; + + let signature = signature .to_str() .web3_context("Could not parse stripe signature as byte-string")?; diff --git a/web3_proxy/tests/test_proxy.rs b/web3_proxy/tests/test_proxy.rs index dd6c5e90..e58134ef 100644 --- a/web3_proxy/tests/test_proxy.rs +++ b/web3_proxy/tests/test_proxy.rs @@ -10,7 +10,7 @@ use tokio::{ }; use web3_proxy::rpcs::blockchain::ArcBlock; -#[cfg_attr(not(feature = "tests-needing-docker"), ignore)] +// #[cfg_attr(not(feature = "tests-needing-docker"), ignore)] #[ignore = "under construction"] #[test_log::test(tokio::test)] async fn it_migrates_the_db() {