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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix: add `profile_id` in dispute (#3486)
Narayan Bhat0d5cd711b245
diff --git a/crates/api_models/src/disputes.rs b/crates/api_models/src/disputes.rsindex b8955bb8ff..ca701ddf9b 100644--- a/crates/api_models/src/disputes.rs+++ b/crates/api_models/src/disputes.rs@@ -43,6 +43,10 @@ pub struct DisputeResponse {/// Time at which dispute is received#[serde(with = "common_utils::custom_serde::iso8601")]pub created_at: PrimitiveDateTime,+ /// The `profile_id` associated with the dispute+ pub profile_id: Option<String>,+ /// The `merchant_connector_id` of the connector / processor through which the dispute was processed+ pub merchant_connector_id: Option<String>,}#[derive(Clone, Debug, Serialize, ToSchema, Eq, PartialEq)]diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rsindex f0348e45eb..cc30146de3 100644--- a/crates/router/src/core/webhooks.rs+++ b/crates/router/src/core/webhooks.rs@@ -340,6 +340,7 @@ pub async fn get_payment_attempt_from_object_reference_id(}}+#[allow(clippy::too_many_arguments)]pub async fn get_or_update_dispute_object(state: AppState,option_dispute: Option<diesel_models::dispute::Dispute>,@@ -347,6 +348,7 @@ pub async fn get_or_update_dispute_object(merchant_id: &str,payment_attempt: &data_models::payments::payment_attempt::PaymentAttempt,event_type: api_models::webhooks::IncomingWebhookEvent,+ business_profile: &diesel_models::business_profile::BusinessProfile,connector_name: &str,) -> CustomResult<diesel_models::dispute::Dispute, errors::ApiErrorResponse> {let db = &*state.store;@@ -375,7 +377,7 @@ pub async fn get_or_update_dispute_object(challenge_required_by: dispute_details.challenge_required_by,connector_created_at: dispute_details.created_at,connector_updated_at: dispute_details.updated_at,- profile_id: None,+ profile_id: Some(business_profile.profile_id.clone()),evidence: None,merchant_connector_id: payment_attempt.merchant_connector_id.clone(),};@@ -534,6 +536,7 @@ pub async fn disputes_incoming_webhook_flow<W: types::OutgoingWebhookType>(&merchant_account.merchant_id,&payment_attempt,event_type,+ &business_profile,connector.id(),).await?;diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rsindex 41aefc9026..3821654686 100644--- a/crates/router/src/types/transformers.rs+++ b/crates/router/src/types/transformers.rs@@ -693,6 +693,8 @@ impl ForeignFrom<storage::Dispute> for api_models::disputes::DisputeResponse {connector_created_at: dispute.connector_created_at,connector_updated_at: dispute.connector_updated_at,created_at: dispute.created_at,+ profile_id: dispute.profile_id,+ merchant_connector_id: dispute.merchant_connector_id,}}}diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.jsonindex 9afd518252..98cfaecf6b 100644--- a/openapi/openapi_spec.json+++ b/openapi/openapi_spec.json@@ -7641,6 +7641,16 @@"type": "string","format": "date-time","description": "Time at which dispute is received"+ },+ "profile_id": {+ "type": "string",+ "description": "The `profile_id` associated with the dispute",+ "nullable": true+ },+ "merchant_connector_id": {+ "type": "string",+ "description": "The `merchant_connector_id` of the connector / processor through which the dispute was processed",+ "nullable": true}}},