mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
feat(core): Add ability to verify connector credentials before integrating the connector (#2986)
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::{
|
||||
crypto::{Encryptable, OptionalEncryptableName},
|
||||
pii,
|
||||
@ -614,6 +616,36 @@ pub struct MerchantConnectorCreate {
|
||||
pub status: Option<api_enums::ConnectorStatus>,
|
||||
}
|
||||
|
||||
// Different patterns of authentication.
|
||||
#[derive(Default, Debug, Clone, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(tag = "auth_type")]
|
||||
pub enum ConnectorAuthType {
|
||||
TemporaryAuth,
|
||||
HeaderKey {
|
||||
api_key: Secret<String>,
|
||||
},
|
||||
BodyKey {
|
||||
api_key: Secret<String>,
|
||||
key1: Secret<String>,
|
||||
},
|
||||
SignatureKey {
|
||||
api_key: Secret<String>,
|
||||
key1: Secret<String>,
|
||||
api_secret: Secret<String>,
|
||||
},
|
||||
MultiAuthKey {
|
||||
api_key: Secret<String>,
|
||||
key1: Secret<String>,
|
||||
api_secret: Secret<String>,
|
||||
key2: Secret<String>,
|
||||
},
|
||||
CurrencyAuthKey {
|
||||
auth_key_map: HashMap<common_enums::Currency, pii::SecretSerdeValue>,
|
||||
},
|
||||
#[default]
|
||||
NoKey,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct MerchantConnectorWebhookDetails {
|
||||
|
||||
@ -27,4 +27,5 @@ pub mod routing;
|
||||
pub mod surcharge_decision_configs;
|
||||
pub mod user;
|
||||
pub mod verifications;
|
||||
pub mod verify_connector;
|
||||
pub mod webhooks;
|
||||
|
||||
11
crates/api_models/src/verify_connector.rs
Normal file
11
crates/api_models/src/verify_connector.rs
Normal file
@ -0,0 +1,11 @@
|
||||
use common_utils::events::{ApiEventMetric, ApiEventsType};
|
||||
|
||||
use crate::{admin, enums};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct VerifyConnectorRequest {
|
||||
pub connector_name: enums::Connector,
|
||||
pub connector_account_details: admin::ConnectorAuthType,
|
||||
}
|
||||
|
||||
common_utils::impl_misc_api_event_type!(VerifyConnectorRequest);
|
||||
Reference in New Issue
Block a user