mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
enhance(router/webhooks): expose additional incoming request details to webhooks flow (#637)
This commit is contained in:
@ -9,12 +9,14 @@ use crate::{enums as api_enums, payments};
|
||||
pub enum IncomingWebhookEvent {
|
||||
PaymentIntentFailure,
|
||||
PaymentIntentSuccess,
|
||||
EndpointVerification,
|
||||
}
|
||||
|
||||
pub enum WebhookFlow {
|
||||
Payment,
|
||||
Refund,
|
||||
Subscription,
|
||||
ReturnResponse,
|
||||
}
|
||||
|
||||
impl From<IncomingWebhookEvent> for WebhookFlow {
|
||||
@ -22,10 +24,17 @@ impl From<IncomingWebhookEvent> for WebhookFlow {
|
||||
match evt {
|
||||
IncomingWebhookEvent::PaymentIntentFailure => Self::Payment,
|
||||
IncomingWebhookEvent::PaymentIntentSuccess => Self::Payment,
|
||||
IncomingWebhookEvent::EndpointVerification => Self::ReturnResponse,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct IncomingWebhookRequestDetails<'a> {
|
||||
pub method: actix_web::http::Method,
|
||||
pub headers: &'a actix_web::http::header::HeaderMap,
|
||||
pub body: &'a [u8],
|
||||
}
|
||||
|
||||
pub type MerchantWebhookConfig = std::collections::HashSet<IncomingWebhookEvent>;
|
||||
|
||||
pub struct IncomingWebhookDetails {
|
||||
|
||||
Reference in New Issue
Block a user