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:
Mani Chandra
2023-11-30 13:06:35 +05:30
committed by GitHub
parent 44b1f4949e
commit 39f255b4b2
18 changed files with 552 additions and 2 deletions

View File

@ -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 {

View File

@ -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;

View 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);