mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
refactor(connector): [Stripe] add stripe-api-version in API-headers (#4109)
This commit is contained in:
@ -7,6 +7,7 @@ use diesel_models::enums;
|
|||||||
use error_stack::{IntoReport, ResultExt};
|
use error_stack::{IntoReport, ResultExt};
|
||||||
use masking::PeekInterface;
|
use masking::PeekInterface;
|
||||||
use router_env::{instrument, tracing};
|
use router_env::{instrument, tracing};
|
||||||
|
use stripe::auth_headers;
|
||||||
|
|
||||||
use self::transformers as stripe;
|
use self::transformers as stripe;
|
||||||
use super::utils::{self as connector_utils, RefundsRequestData};
|
use super::utils::{self as connector_utils, RefundsRequestData};
|
||||||
@ -55,10 +56,16 @@ impl ConnectorCommon for Stripe {
|
|||||||
let auth: stripe::StripeAuthType = auth_type
|
let auth: stripe::StripeAuthType = auth_type
|
||||||
.try_into()
|
.try_into()
|
||||||
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
|
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
|
||||||
Ok(vec![(
|
Ok(vec![
|
||||||
|
(
|
||||||
headers::AUTHORIZATION.to_string(),
|
headers::AUTHORIZATION.to_string(),
|
||||||
format!("Bearer {}", auth.api_key.peek()).into_masked(),
|
format!("Bearer {}", auth.api_key.peek()).into_masked(),
|
||||||
)])
|
),
|
||||||
|
(
|
||||||
|
auth_headers::STRIPE_API_VERSION.to_string(),
|
||||||
|
auth_headers::STRIPE_VERSION.to_string().into_masked(),
|
||||||
|
),
|
||||||
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,11 @@ use crate::{
|
|||||||
utils::OptionExt,
|
utils::OptionExt,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub mod auth_headers {
|
||||||
|
pub const STRIPE_API_VERSION: &str = "stripe-version";
|
||||||
|
pub const STRIPE_VERSION: &str = "2023-10-16";
|
||||||
|
}
|
||||||
|
|
||||||
pub struct StripeAuthType {
|
pub struct StripeAuthType {
|
||||||
pub(super) api_key: Secret<String>,
|
pub(super) api_key: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user