mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
feat(core): Added Reward PaymentMethod & CurrencyAuthKey for Hyperswitch <> UCS Integration (#8767)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use common_utils::{consts as common_utils_consts, errors::CustomResult, types::Url};
|
||||
use error_stack::ResultExt;
|
||||
use masking::{PeekInterface, Secret};
|
||||
@ -144,6 +146,10 @@ pub struct ConnectorAuthMetadata {
|
||||
/// Optional API secret used for signature or secure authentication.
|
||||
pub api_secret: Option<Secret<String>>,
|
||||
|
||||
/// Optional auth_key_map used for authentication.
|
||||
pub auth_key_map:
|
||||
Option<HashMap<common_enums::enums::Currency, common_utils::pii::SecretSerdeValue>>,
|
||||
|
||||
/// Id of the merchant.
|
||||
pub merchant_id: Secret<String>,
|
||||
}
|
||||
@ -381,6 +387,16 @@ pub fn build_unified_connector_service_grpc_headers(
|
||||
parse("api_secret", api_secret.peek())?,
|
||||
);
|
||||
}
|
||||
if let Some(auth_key_map) = meta.auth_key_map {
|
||||
let auth_key_map_str = serde_json::to_string(&auth_key_map).map_err(|error| {
|
||||
logger::error!(?error);
|
||||
UnifiedConnectorServiceError::ParsingFailed
|
||||
})?;
|
||||
metadata.append(
|
||||
consts::UCS_HEADER_AUTH_KEY_MAP,
|
||||
parse("auth_key_map", &auth_key_map_str)?,
|
||||
);
|
||||
}
|
||||
|
||||
metadata.append(
|
||||
common_utils_consts::X_MERCHANT_ID,
|
||||
|
||||
@ -85,6 +85,9 @@ pub mod consts {
|
||||
|
||||
/// Header key for sending the API secret in signature-based authentication.
|
||||
pub(crate) const UCS_HEADER_API_SECRET: &str = "x-api-secret";
|
||||
|
||||
/// Header key for sending the AUTH KEY MAP in currency-based authentication.
|
||||
pub(crate) const UCS_HEADER_AUTH_KEY_MAP: &str = "x-auth-key-map";
|
||||
}
|
||||
|
||||
/// Metrics for interactions with external systems.
|
||||
|
||||
Reference in New Issue
Block a user