refactor(stripe): use bearer explictly when calling connectors (#417)

This commit is contained in:
Narayan Bhat
2023-01-19 12:00:45 +05:30
committed by GitHub
parent c7665d7f35
commit 406cd4c71a
2 changed files with 9 additions and 2 deletions

View File

@ -42,7 +42,10 @@ impl ConnectorCommon for Checkout {
let auth: checkout::CheckoutAuthType = auth_type
.try_into()
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])
Ok(vec![(
headers::AUTHORIZATION.to_string(),
format!("Bearer {}", auth.api_key),
)])
}
fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {
@ -363,6 +366,7 @@ impl
&self,
res: Bytes,
) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
logger::debug!(checkout_error_response=?res);
let response: checkout::ErrorResponse = res
.parse_struct("ErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;

View File

@ -47,7 +47,10 @@ impl ConnectorCommon for Stripe {
let auth: stripe::StripeAuthType = auth_type
.try_into()
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])
Ok(vec![(
headers::AUTHORIZATION.to_string(),
format!("Bearer {}", auth.api_key),
)])
}
}