Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor(connector): [Noon] auth header (#7977)

Swangi Kumari28b62e2693ee
diff --git a/crates/hyperswitch_connectors/src/connectors/noon.rs b/crates/hyperswitch_connectors/src/connectors/noon.rs
index 933d08d7a0..5b753bcdef 100644
--- a/crates/hyperswitch_connectors/src/connectors/noon.rs
+++ b/crates/hyperswitch_connectors/src/connectors/noon.rs
@@ -95,7 +95,7 @@ where
fn build_headers(
&self,
req: &RouterData<Flow, Request, Response>,
- connectors: &Connectors,
+ _connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let mut header = vec![(
headers::CONTENT_TYPE.to_string(),
@@ -103,7 +103,7 @@ where
.to_string()
.into(),
)];
- let mut api_key = get_auth_header(&req.connector_auth_type, connectors, req.test_mode)?;
+ let mut api_key = get_auth_header(&req.connector_auth_type)?;
header.append(&mut api_key);
Ok(header)
}
@@ -111,8 +111,6 @@ where
fn get_auth_header(
auth_type: &ConnectorAuthType,
- connectors: &Connectors,
- test_mode: Option<bool>,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = noon::NoonAuthType::try_from(auth_type)?;
@@ -126,17 +124,10 @@ fn get_auth_header(
business_identifier, application_identifier, api_key
))
});
- let key_mode = test_mode.map_or(connectors.noon.key_mode.clone(), |is_test_mode| {
- if is_test_mode {
- "Test".to_string()
- } else {
- "Live".to_string()
- }
- });
Ok(vec![(
headers::AUTHORIZATION.to_string(),
- format!("Key_{} {}", key_mode, encoded_api_key.peek()).into_masked(),
+ format!("Key {}", encoded_api_key.peek()).into_masked(),
)])
}