mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
feat(router): added incoming dispute webhooks flow (#769)
Co-authored-by: Sangamesh <sangamesh.kulkarni@juspay.in> Co-authored-by: sai harsha <sai.harsha@sai.harsha-MacBookPro> Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
@ -2,7 +2,7 @@ use common_utils::custom_serde;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::PrimitiveDateTime;
|
||||
|
||||
use crate::{enums as api_enums, payments, refunds};
|
||||
use crate::{disputes, enums as api_enums, payments, refunds};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
@ -11,12 +11,22 @@ pub enum IncomingWebhookEvent {
|
||||
PaymentIntentSuccess,
|
||||
RefundFailure,
|
||||
RefundSuccess,
|
||||
DisputeOpened,
|
||||
DisputeExpired,
|
||||
DisputeAccepted,
|
||||
DisputeCancelled,
|
||||
DisputeChallenged,
|
||||
// dispute has been successfully challenged by the merchant
|
||||
DisputeWon,
|
||||
// dispute has been unsuccessfully challenged
|
||||
DisputeLost,
|
||||
EndpointVerification,
|
||||
}
|
||||
|
||||
pub enum WebhookFlow {
|
||||
Payment,
|
||||
Refund,
|
||||
Dispute,
|
||||
Subscription,
|
||||
ReturnResponse,
|
||||
}
|
||||
@ -28,6 +38,13 @@ impl From<IncomingWebhookEvent> for WebhookFlow {
|
||||
IncomingWebhookEvent::PaymentIntentSuccess => Self::Payment,
|
||||
IncomingWebhookEvent::RefundSuccess => Self::Refund,
|
||||
IncomingWebhookEvent::RefundFailure => Self::Refund,
|
||||
IncomingWebhookEvent::DisputeOpened => Self::Dispute,
|
||||
IncomingWebhookEvent::DisputeAccepted => Self::Dispute,
|
||||
IncomingWebhookEvent::DisputeExpired => Self::Dispute,
|
||||
IncomingWebhookEvent::DisputeCancelled => Self::Dispute,
|
||||
IncomingWebhookEvent::DisputeChallenged => Self::Dispute,
|
||||
IncomingWebhookEvent::DisputeWon => Self::Dispute,
|
||||
IncomingWebhookEvent::DisputeLost => Self::Dispute,
|
||||
IncomingWebhookEvent::EndpointVerification => Self::ReturnResponse,
|
||||
}
|
||||
}
|
||||
@ -73,6 +90,7 @@ pub struct OutgoingWebhook {
|
||||
pub enum OutgoingWebhookContent {
|
||||
PaymentDetails(payments::PaymentsResponse),
|
||||
RefundDetails(refunds::RefundResponse),
|
||||
DisputeDetails(Box<disputes::DisputeResponse>),
|
||||
}
|
||||
|
||||
pub trait OutgoingWebhookType: Serialize + From<OutgoingWebhook> + Sync + Send {}
|
||||
|
||||
Reference in New Issue
Block a user