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

refactor(connector): [Checkout] handle default cases for dispute status mapping (#3966)

Swangi Kumari2cda3dd794e5
diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs
index e0e6c5155b..d77b7113f7 100644
--- a/crates/router/src/connector/checkout/transformers.rs
+++ b/crates/router/src/connector/checkout/transformers.rs
@@ -1182,21 +1182,14 @@ pub struct CheckoutDisputeWebhookData {
#[derive(Debug, Deserialize)]
pub struct CheckoutDisputeWebhookBody {
#[serde(rename = "type")]
- pub transaction_type: CheckoutTransactionType,
+ pub transaction_type: CheckoutDisputeTransactionType,
pub data: CheckoutDisputeWebhookData,
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub created_on: Option<PrimitiveDateTime>,
}
#[derive(Debug, Deserialize, strum::Display, Clone)]
#[serde(rename_all = "snake_case")]
-pub enum CheckoutTransactionType {
- AuthenticationStarted,
- AuthenticationApproved,
- PaymentApproved,
- PaymentCaptured,
- PaymentDeclined,
- PaymentRefunded,
- PaymentRefundDeclined,
+pub enum CheckoutDisputeTransactionType {
DisputeReceived,
DisputeExpired,
DisputeAccepted,
@@ -1238,12 +1231,20 @@ impl From<CheckoutWebhookEventType> for api::IncomingWebhookEvent {
}
}
-impl From<CheckoutTransactionType> for api_models::enums::DisputeStage {
- fn from(code: CheckoutTransactionType) -> Self {
+impl From<CheckoutDisputeTransactionType> for api_models::enums::DisputeStage {
+ fn from(code: CheckoutDisputeTransactionType) -> Self {
match code {
- CheckoutTransactionType::DisputeArbitrationLost
- | CheckoutTransactionType::DisputeArbitrationWon => Self::PreArbitration,
- _ => Self::Dispute,
+ CheckoutDisputeTransactionType::DisputeArbitrationLost
+ | CheckoutDisputeTransactionType::DisputeArbitrationWon => Self::PreArbitration,
+ CheckoutDisputeTransactionType::DisputeReceived
+ | CheckoutDisputeTransactionType::DisputeExpired
+ | CheckoutDisputeTransactionType::DisputeAccepted
+ | CheckoutDisputeTransactionType::DisputeCanceled
+ | CheckoutDisputeTransactionType::DisputeEvidenceSubmitted
+ | CheckoutDisputeTransactionType::DisputeEvidenceAcknowledgedByScheme
+ | CheckoutDisputeTransactionType::DisputeEvidenceRequired
+ | CheckoutDisputeTransactionType::DisputeWon
+ | CheckoutDisputeTransactionType::DisputeLost => Self::Dispute,
}
}
}