mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(core): add hypersense integration api (#7218)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -2,6 +2,7 @@ pub mod apple_pay_certificates_migration;
|
||||
pub mod connector_onboarding;
|
||||
pub mod customer;
|
||||
pub mod dispute;
|
||||
pub mod external_service_auth;
|
||||
pub mod gsm;
|
||||
mod locker_migration;
|
||||
pub mod payment;
|
||||
|
||||
30
crates/api_models/src/events/external_service_auth.rs
Normal file
30
crates/api_models/src/events/external_service_auth.rs
Normal file
@ -0,0 +1,30 @@
|
||||
use common_utils::events::{ApiEventMetric, ApiEventsType};
|
||||
|
||||
use crate::external_service_auth::{
|
||||
ExternalSignoutTokenRequest, ExternalTokenResponse, ExternalVerifyTokenRequest,
|
||||
ExternalVerifyTokenResponse,
|
||||
};
|
||||
|
||||
impl ApiEventMetric for ExternalTokenResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::ExternalServiceAuth)
|
||||
}
|
||||
}
|
||||
|
||||
impl ApiEventMetric for ExternalVerifyTokenRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::ExternalServiceAuth)
|
||||
}
|
||||
}
|
||||
|
||||
impl ApiEventMetric for ExternalVerifyTokenResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::ExternalServiceAuth)
|
||||
}
|
||||
}
|
||||
|
||||
impl ApiEventMetric for ExternalSignoutTokenRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::ExternalServiceAuth)
|
||||
}
|
||||
}
|
||||
35
crates/api_models/src/external_service_auth.rs
Normal file
35
crates/api_models/src/external_service_auth.rs
Normal file
@ -0,0 +1,35 @@
|
||||
use common_utils::{id_type, pii};
|
||||
use masking::Secret;
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
pub struct ExternalTokenResponse {
|
||||
pub token: Secret<String>,
|
||||
}
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ExternalVerifyTokenRequest {
|
||||
pub token: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct ExternalSignoutTokenRequest {
|
||||
pub token: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize, Debug)]
|
||||
#[serde(untagged)]
|
||||
pub enum ExternalVerifyTokenResponse {
|
||||
Hypersense {
|
||||
user_id: String,
|
||||
merchant_id: id_type::MerchantId,
|
||||
name: Secret<String>,
|
||||
email: pii::Email,
|
||||
},
|
||||
}
|
||||
|
||||
impl ExternalVerifyTokenResponse {
|
||||
pub fn get_user_id(&self) -> &str {
|
||||
match self {
|
||||
Self::Hypersense { user_id, .. } => user_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,7 @@ pub mod ephemeral_key;
|
||||
#[cfg(feature = "errors")]
|
||||
pub mod errors;
|
||||
pub mod events;
|
||||
pub mod external_service_auth;
|
||||
pub mod feature_matrix;
|
||||
pub mod files;
|
||||
pub mod gsm;
|
||||
|
||||
Reference in New Issue
Block a user