mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
feat(payment_methods_v2): Added Ephemeral auth for v2 (#6813)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -102,6 +102,9 @@ pub enum ApiEventsType {
|
||||
poll_id: String,
|
||||
},
|
||||
Analytics,
|
||||
EphemeralKey {
|
||||
key_id: id_type::EphemeralKeyId,
|
||||
},
|
||||
}
|
||||
|
||||
impl ApiEventMetric for serde_json::Value {}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
mod api_key;
|
||||
mod customer;
|
||||
mod ephemeral_key;
|
||||
#[cfg(feature = "v2")]
|
||||
mod global_id;
|
||||
mod merchant;
|
||||
@ -38,6 +39,7 @@ pub use self::global_id::{
|
||||
pub use self::{
|
||||
api_key::ApiKeyId,
|
||||
customer::CustomerId,
|
||||
ephemeral_key::EphemeralKeyId,
|
||||
merchant::MerchantId,
|
||||
merchant_connector_account::MerchantConnectorAccountId,
|
||||
organization::OrganizationId,
|
||||
|
||||
31
crates/common_utils/src/id_type/ephemeral_key.rs
Normal file
31
crates/common_utils/src/id_type/ephemeral_key.rs
Normal file
@ -0,0 +1,31 @@
|
||||
crate::id_type!(
|
||||
EphemeralKeyId,
|
||||
"A type for key_id that can be used for Ephemeral key IDs"
|
||||
);
|
||||
crate::impl_id_type_methods!(EphemeralKeyId, "key_id");
|
||||
|
||||
// This is to display the `EphemeralKeyId` as EphemeralKeyId(abcd)
|
||||
crate::impl_debug_id_type!(EphemeralKeyId);
|
||||
crate::impl_try_from_cow_str_id_type!(EphemeralKeyId, "key_id");
|
||||
|
||||
crate::impl_generate_id_id_type!(EphemeralKeyId, "eki");
|
||||
crate::impl_serializable_secret_id_type!(EphemeralKeyId);
|
||||
crate::impl_queryable_id_type!(EphemeralKeyId);
|
||||
crate::impl_to_sql_from_sql_id_type!(EphemeralKeyId);
|
||||
|
||||
impl crate::events::ApiEventMetric for EphemeralKeyId {
|
||||
fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {
|
||||
Some(crate::events::ApiEventsType::EphemeralKey {
|
||||
key_id: self.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
crate::impl_default_id_type!(EphemeralKeyId, "key");
|
||||
|
||||
impl EphemeralKeyId {
|
||||
/// Generate a key for redis
|
||||
pub fn generate_redis_key(&self) -> String {
|
||||
format!("epkey_{}", self.get_string_repr())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user