enhance(router/webhooks): expose additional incoming request details to webhooks flow (#637)

This commit is contained in:
ItsMeShashank
2023-02-24 17:53:16 +05:30
committed by GitHub
parent aaf372505c
commit 1b3b7f5bc6
21 changed files with 144 additions and 129 deletions

View File

@ -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 {