mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 11:24:45 +08:00
fix: Resolved issue of webhooks response from ucs (#9021)
This commit is contained in:
@ -68,6 +68,67 @@ pub enum IncomingWebhookEvent {
|
||||
RecoveryInvoiceCancel,
|
||||
}
|
||||
|
||||
impl IncomingWebhookEvent {
|
||||
/// Convert UCS event type integer to IncomingWebhookEvent
|
||||
/// Maps from proto WebhookEventType enum values to IncomingWebhookEvent variants
|
||||
pub fn from_ucs_event_type(event_type: i32) -> Self {
|
||||
match event_type {
|
||||
0 => Self::EventNotSupported,
|
||||
// Payment intent events
|
||||
1 => Self::PaymentIntentFailure,
|
||||
2 => Self::PaymentIntentSuccess,
|
||||
3 => Self::PaymentIntentProcessing,
|
||||
4 => Self::PaymentIntentPartiallyFunded,
|
||||
5 => Self::PaymentIntentCancelled,
|
||||
6 => Self::PaymentIntentCancelFailure,
|
||||
7 => Self::PaymentIntentAuthorizationSuccess,
|
||||
8 => Self::PaymentIntentAuthorizationFailure,
|
||||
9 => Self::PaymentIntentCaptureSuccess,
|
||||
10 => Self::PaymentIntentCaptureFailure,
|
||||
11 => Self::PaymentIntentExpired,
|
||||
12 => Self::PaymentActionRequired,
|
||||
// Source events
|
||||
13 => Self::SourceChargeable,
|
||||
14 => Self::SourceTransactionCreated,
|
||||
// Refund events
|
||||
15 => Self::RefundFailure,
|
||||
16 => Self::RefundSuccess,
|
||||
// Dispute events
|
||||
17 => Self::DisputeOpened,
|
||||
18 => Self::DisputeExpired,
|
||||
19 => Self::DisputeAccepted,
|
||||
20 => Self::DisputeCancelled,
|
||||
21 => Self::DisputeChallenged,
|
||||
22 => Self::DisputeWon,
|
||||
23 => Self::DisputeLost,
|
||||
// Mandate events
|
||||
24 => Self::MandateActive,
|
||||
25 => Self::MandateRevoked,
|
||||
// Miscellaneous events
|
||||
26 => Self::EndpointVerification,
|
||||
27 => Self::ExternalAuthenticationARes,
|
||||
28 => Self::FrmApproved,
|
||||
29 => Self::FrmRejected,
|
||||
// Payout events
|
||||
#[cfg(feature = "payouts")]
|
||||
30 => Self::PayoutSuccess,
|
||||
#[cfg(feature = "payouts")]
|
||||
31 => Self::PayoutFailure,
|
||||
#[cfg(feature = "payouts")]
|
||||
32 => Self::PayoutProcessing,
|
||||
#[cfg(feature = "payouts")]
|
||||
33 => Self::PayoutCancelled,
|
||||
#[cfg(feature = "payouts")]
|
||||
34 => Self::PayoutCreated,
|
||||
#[cfg(feature = "payouts")]
|
||||
35 => Self::PayoutExpired,
|
||||
#[cfg(feature = "payouts")]
|
||||
36 => Self::PayoutReversed,
|
||||
_ => Self::EventNotSupported,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum WebhookFlow {
|
||||
Payment,
|
||||
#[cfg(feature = "payouts")]
|
||||
|
||||
Reference in New Issue
Block a user