mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 21:37:41 +08:00
feat(events): add APIs to list webhook events and webhook delivery attempts (#4131)
This commit is contained in:
@ -85,27 +85,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
/// Merge two `serde_json::Value` instances. Will need to be updated to handle merging arrays.
|
||||
pub(crate) fn merge_json_values(a: &mut serde_json::Value, b: &serde_json::Value) {
|
||||
// Reference: https://github.com/serde-rs/json/issues/377#issuecomment-341490464
|
||||
// See also (for better implementations):
|
||||
// - https://github.com/marirs/serde-json-utils
|
||||
// - https://github.com/jmfiaschi/json_value_merge
|
||||
use serde_json::Value;
|
||||
|
||||
match (a, b) {
|
||||
(&mut Value::Object(ref mut a), Value::Object(b)) => {
|
||||
for (k, v) in b {
|
||||
merge_json_values(a.entry(k.clone()).or_insert(Value::Null), v);
|
||||
}
|
||||
}
|
||||
(a, b) => {
|
||||
*a = b.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ValidateCall<T, F> {
|
||||
fn validate_opt(self, func: F) -> CustomResult<(), errors::ValidationError>;
|
||||
}
|
||||
@ -121,12 +100,3 @@ where
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pub fn validate_address(address: &serde_json::Value) -> CustomResult<(), errors::ValidationError> {
|
||||
// if let Err(err) = serde_json::from_value::<AddressDetails>(address.clone()) {
|
||||
// return Err(report!(errors::ValidationError::InvalidValue {
|
||||
// message: format!("Invalid address: {err}")
|
||||
// }));
|
||||
// }
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
@ -43,6 +43,7 @@ impl From<Permission> for user_role_api::Permission {
|
||||
Permission::UsersRead => Self::UsersRead,
|
||||
Permission::UsersWrite => Self::UsersWrite,
|
||||
Permission::MerchantAccountCreate => Self::MerchantAccountCreate,
|
||||
Permission::WebhookEventRead => Self::WebhookEventRead,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user