diff --git a/crates/api_models/src/disputes.rs b/crates/api_models/src/disputes.rs index c5448b0dfc6d..5b0de11f2d05 100644 --- a/crates/api_models/src/disputes.rs +++ b/crates/api_models/src/disputes.rs @@ -6,7 +6,7 @@ use serde::de::Error; use time::PrimitiveDateTime; use utoipa::ToSchema; -use super::enums::{DisputeStage, DisputeStatus, Currency}; +use super::enums::{Currency, DisputeStage, DisputeStatus}; use crate::{admin::MerchantConnectorInfo, files}; #[derive(Clone, Debug, Serialize, ToSchema, Eq, PartialEq)] diff --git a/crates/router/src/compatibility/stripe/webhooks.rs b/crates/router/src/compatibility/stripe/webhooks.rs index 999f2418a860..2212a8953fc7 100644 --- a/crates/router/src/compatibility/stripe/webhooks.rs +++ b/crates/router/src/compatibility/stripe/webhooks.rs @@ -1,7 +1,7 @@ #[cfg(feature = "payouts")] use api_models::payouts as payout_models; use api_models::{ - enums::{DisputeStatus, MandateStatus, Currency}, + enums::{Currency, DisputeStatus, MandateStatus}, webhooks::{self as api}, }; #[cfg(feature = "payouts")] diff --git a/crates/router/src/connector/braintree.rs b/crates/router/src/connector/braintree.rs index 2451a7318854..dba261218801 100644 --- a/crates/router/src/connector/braintree.rs +++ b/crates/router/src/connector/braintree.rs @@ -997,23 +997,21 @@ impl api::IncomingWebhook for Braintree { let response = decode_webhook_payload(notif.bt_payload.replace('\n', "").as_bytes())?; match response.dispute { - Some(dispute_data) => { - Ok(api::disputes::DisputePayload { - amount: connector_utils::to_currency_lower_unit( - dispute_data.amount_disputed.to_string(), - dispute_data.currency_iso_code, - )?, - currency: dispute_data.currency_iso_code, - dispute_stage: transformers::get_dispute_stage(dispute_data.kind.as_str())?, - connector_dispute_id: dispute_data.id, - connector_reason: dispute_data.reason, - connector_reason_code: dispute_data.reason_code, - challenge_required_by: dispute_data.reply_by_date, - connector_status: dispute_data.status, - created_at: dispute_data.created_at, - updated_at: dispute_data.updated_at, - }) - } + Some(dispute_data) => Ok(api::disputes::DisputePayload { + amount: connector_utils::to_currency_lower_unit( + dispute_data.amount_disputed.to_string(), + dispute_data.currency_iso_code, + )?, + currency: dispute_data.currency_iso_code, + dispute_stage: transformers::get_dispute_stage(dispute_data.kind.as_str())?, + connector_dispute_id: dispute_data.id, + connector_reason: dispute_data.reason, + connector_reason_code: dispute_data.reason_code, + challenge_required_by: dispute_data.reply_by_date, + connector_status: dispute_data.status, + created_at: dispute_data.created_at, + updated_at: dispute_data.updated_at, + }), None => Err(errors::ConnectorError::WebhookResourceObjectNotFound)?, } } diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs index 33b526de374f..968e2228802c 100644 --- a/crates/router/src/connector/utils.rs +++ b/crates/router/src/connector/utils.rs @@ -28,7 +28,7 @@ use hyperswitch_domain_models::{ SyncIntegrityObject, }, }; -use masking::{ExposeInterface, Secret, Deserialize}; +use masking::{Deserialize, ExposeInterface, Secret}; use once_cell::sync::Lazy; use regex::Regex; use serde::Serializer; @@ -3149,4 +3149,4 @@ where use serde::de::Error; let output = <&str>::deserialize(v)?; output.to_uppercase().parse::().map_err(D::Error::custom) -} \ No newline at end of file +} diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs index 31dfeec22eab..4b6d57b0d12b 100644 --- a/crates/router/src/utils/user/sample_data.rs +++ b/crates/router/src/utils/user/sample_data.rs @@ -435,9 +435,7 @@ pub async fn generate_sample_data( merchant_connector_id: payment_attempt.merchant_connector_id.clone(), dispute_amount: amount * 100, organization_id: org_id.clone(), - dispute_currency: payment_intent - .currency - .unwrap_or_default(), + dispute_currency: payment_intent.currency.unwrap_or_default(), }) } else { None