mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
feat(webhooks): allow manually retrying delivery of outgoing webhooks (#4176)
This commit is contained in:
@ -94,6 +94,14 @@ pub struct EventRetrieveResponse {
|
||||
pub delivery_attempt: Option<WebhookDeliveryAttempt>,
|
||||
}
|
||||
|
||||
impl common_utils::events::ApiEventMetric for EventRetrieveResponse {
|
||||
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
|
||||
Some(common_utils::events::ApiEventsType::Events {
|
||||
merchant_id_or_profile_id: self.event_information.merchant_id.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// The request information (headers and body) sent in the webhook.
|
||||
#[derive(Debug, Serialize, Deserialize, ToSchema)]
|
||||
pub struct OutgoingWebhookRequestContent {
|
||||
@ -114,20 +122,24 @@ pub struct OutgoingWebhookRequestContent {
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
pub struct OutgoingWebhookResponseContent {
|
||||
/// The response body received for the webhook sent.
|
||||
#[schema(value_type = String)]
|
||||
#[schema(value_type = Option<String>)]
|
||||
#[serde(alias = "payload")]
|
||||
pub body: Secret<String>,
|
||||
pub body: Option<Secret<String>>,
|
||||
|
||||
/// The response headers received for the webhook sent.
|
||||
#[schema(
|
||||
value_type = Vec<(String, String)>,
|
||||
value_type = Option<Vec<(String, String)>>,
|
||||
example = json!([["content-type", "application/json"], ["content-length", "1024"]]))
|
||||
]
|
||||
pub headers: Vec<(String, Secret<String>)>,
|
||||
pub headers: Option<Vec<(String, Secret<String>)>>,
|
||||
|
||||
/// The HTTP status code for the webhook sent.
|
||||
#[schema(example = 200)]
|
||||
pub status_code: u16,
|
||||
pub status_code: Option<u16>,
|
||||
|
||||
/// Error message in case any error occurred when trying to deliver the webhook.
|
||||
#[schema(example = 200)]
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
@ -157,3 +169,17 @@ impl common_utils::events::ApiEventMetric for WebhookDeliveryAttemptListRequestI
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
pub struct WebhookDeliveryRetryRequestInternal {
|
||||
pub merchant_id_or_profile_id: String,
|
||||
pub event_id: String,
|
||||
}
|
||||
|
||||
impl common_utils::events::ApiEventMetric for WebhookDeliveryRetryRequestInternal {
|
||||
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
|
||||
Some(common_utils::events::ApiEventsType::Events {
|
||||
merchant_id_or_profile_id: self.merchant_id_or_profile_id.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user