Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(connetors): [adyen] fix dispute_status deserialization error (#11790)

Akshaya Shankar620c851e6475
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index 457297bbb5..12ba803e48 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -5562,6 +5562,9 @@ pub enum DisputeStatus {
Lost,
Accepted,
Won,
+ Unresponded,
+ Responded,
+ Expired,
}
#[derive(Debug, Deserialize)]
@@ -5618,6 +5621,7 @@ pub enum WebhookEventCode {
SecondChargeback,
PrearbitrationWon,
PrearbitrationLost,
+ RequestForInformation,
OfferClosed,
RecurringContract,
#[cfg(feature = "payouts")]
@@ -5670,6 +5674,7 @@ pub fn is_chargeback_event(event_code: &WebhookEventCode) -> bool {
| WebhookEventCode::SecondChargeback
| WebhookEventCode::PrearbitrationWon
| WebhookEventCode::PrearbitrationLost
+ | WebhookEventCode::RequestForInformation
)
}
@@ -5735,6 +5740,18 @@ pub(crate) fn get_adyen_webhook_event(
}
Some(_) => api_models::webhooks::IncomingWebhookEvent::DisputeOpened,
},
+ WebhookEventCode::RequestForInformation => match dispute_status {
+ Some(DisputeStatus::Responded) => {
+ api_models::webhooks::IncomingWebhookEvent::DisputeChallenged
+ }
+ Some(DisputeStatus::Expired) => {
+ api_models::webhooks::IncomingWebhookEvent::DisputeExpired
+ }
+ Some(DisputeStatus::Unresponded) => {
+ api_models::webhooks::IncomingWebhookEvent::EventNotSupported
+ }
+ None | Some(_) => api_models::webhooks::IncomingWebhookEvent::DisputeOpened,
+ },
WebhookEventCode::ChargebackReversed => match dispute_status {
Some(DisputeStatus::Pending) => {
api_models::webhooks::IncomingWebhookEvent::DisputeChallenged
@@ -5794,7 +5811,8 @@ pub(crate) fn get_adyen_webhook_event(
impl From<WebhookEventCode> for storage_enums::DisputeStage {
fn from(code: WebhookEventCode) -> Self {
match code {
- WebhookEventCode::NotificationOfChargeback => Self::PreDispute,
+ WebhookEventCode::NotificationOfChargeback
+ | WebhookEventCode::RequestForInformation => Self::PreDispute,
WebhookEventCode::SecondChargeback => Self::PreArbitration,
WebhookEventCode::PrearbitrationWon => Self::PreArbitration,
WebhookEventCode::PrearbitrationLost => Self::PreArbitration,
@@ -5902,6 +5920,7 @@ impl From<AdyenNotificationRequestItemWH> for AdyenWebhookResponse {
| WebhookEventCode::RefundFailed
| WebhookEventCode::RefundReversed
| WebhookEventCode::NotificationOfChargeback
+ | WebhookEventCode::RequestForInformation
| WebhookEventCode::Chargeback
| WebhookEventCode::ChargebackReversed
| WebhookEventCode::SecondChargeback