mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
feat(webhooks): store request and response payloads in events table (#4029)
This commit is contained in:
@ -493,9 +493,9 @@ pub type OptionalEncryptableName = Option<Encryptable<Secret<String>>>;
|
||||
pub type OptionalEncryptableEmail = Option<Encryptable<Secret<String, pii::EmailStrategy>>>;
|
||||
/// Type alias for `Option<Encryptable<Secret<String>>>` used for `phone` field
|
||||
pub type OptionalEncryptablePhone = Option<Encryptable<Secret<String>>>;
|
||||
/// Type alias for `Option<Encryptable<Secret<serde_json::Value>>>` used for `phone` field
|
||||
/// Type alias for `Option<Encryptable<Secret<serde_json::Value>>>`
|
||||
pub type OptionalEncryptableValue = Option<Encryptable<Secret<serde_json::Value>>>;
|
||||
/// Type alias for `Option<Secret<serde_json::Value>>` used for `phone` field
|
||||
/// Type alias for `Option<Secret<serde_json::Value>>`
|
||||
pub type OptionalSecretValue = Option<Secret<serde_json::Value>>;
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@ -198,3 +198,9 @@ pub fn generate_id_with_default_len(prefix: &str) -> String {
|
||||
let len = consts::ID_LENGTH;
|
||||
format!("{}_{}", prefix, nanoid::nanoid!(len, &consts::ALPHABETS))
|
||||
}
|
||||
|
||||
/// Generate a time-ordered (time-sortable) unique identifier using the current time
|
||||
#[inline]
|
||||
pub fn generate_time_ordered_id(prefix: &str) -> String {
|
||||
format!("{prefix}_{}", uuid::Uuid::now_v7().as_simple())
|
||||
}
|
||||
|
||||
@ -51,6 +51,7 @@ impl std::fmt::Debug for RequestContent {
|
||||
Self::FormUrlEncoded(_) => "FormUrlEncodedRequestBody",
|
||||
Self::FormData(_) => "FormDataRequestBody",
|
||||
Self::Xml(_) => "XmlRequestBody",
|
||||
Self::RawBytes(_) => "RawBytesRequestBody",
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -60,6 +61,7 @@ pub enum RequestContent {
|
||||
FormUrlEncoded(Box<dyn masking::ErasedMaskSerialize + Send>),
|
||||
FormData(reqwest::multipart::Form),
|
||||
Xml(Box<dyn masking::ErasedMaskSerialize + Send>),
|
||||
RawBytes(Vec<u8>),
|
||||
}
|
||||
|
||||
impl Request {
|
||||
@ -200,6 +202,7 @@ impl RequestBody {
|
||||
}
|
||||
RequestContent::Xml(i) => quick_xml::se::to_string(&i).unwrap_or_default().into(),
|
||||
RequestContent::FormData(_) => String::new().into(),
|
||||
RequestContent::RawBytes(_) => String::new().into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user