mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
fix(events): add logger for incoming webhook payload (#3171)
This commit is contained in:
@ -25,8 +25,8 @@ pub async fn receive_incoming_webhook<W: types::OutgoingWebhookType>(
|
||||
flow.clone(),
|
||||
state,
|
||||
&req,
|
||||
(),
|
||||
|state, auth, _| {
|
||||
WebhookBytes(body),
|
||||
|state, auth, payload| {
|
||||
webhooks::webhooks_wrapper::<W, Oss>(
|
||||
&flow,
|
||||
state.to_owned(),
|
||||
@ -34,7 +34,7 @@ pub async fn receive_incoming_webhook<W: types::OutgoingWebhookType>(
|
||||
auth.merchant_account,
|
||||
auth.key_store,
|
||||
&connector_id_or_name,
|
||||
body.clone(),
|
||||
payload.0,
|
||||
)
|
||||
},
|
||||
&auth::MerchantIdAuth(merchant_id),
|
||||
@ -42,3 +42,19 @@ pub async fn receive_incoming_webhook<W: types::OutgoingWebhookType>(
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct WebhookBytes(web::Bytes);
|
||||
|
||||
impl serde::Serialize for WebhookBytes {
|
||||
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
let payload: serde_json::Value = serde_json::from_slice(&self.0).unwrap_or_default();
|
||||
payload.serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
impl common_utils::events::ApiEventMetric for WebhookBytes {
|
||||
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
|
||||
Some(common_utils::events::ApiEventsType::Miscellaneous)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user