fix: add profile_id in dispute (#3486)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2024-02-05 12:19:12 +05:30
committed by GitHub
parent 8ac4c205e8
commit 0d5cd711b2
4 changed files with 20 additions and 1 deletions

View File

@ -43,6 +43,10 @@ pub struct DisputeResponse {
/// Time at which dispute is received /// Time at which dispute is received
#[serde(with = "common_utils::custom_serde::iso8601")] #[serde(with = "common_utils::custom_serde::iso8601")]
pub created_at: PrimitiveDateTime, 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)] #[derive(Clone, Debug, Serialize, ToSchema, Eq, PartialEq)]

View File

@ -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( pub async fn get_or_update_dispute_object(
state: AppState, state: AppState,
option_dispute: Option<diesel_models::dispute::Dispute>, option_dispute: Option<diesel_models::dispute::Dispute>,
@ -347,6 +348,7 @@ pub async fn get_or_update_dispute_object(
merchant_id: &str, merchant_id: &str,
payment_attempt: &data_models::payments::payment_attempt::PaymentAttempt, payment_attempt: &data_models::payments::payment_attempt::PaymentAttempt,
event_type: api_models::webhooks::IncomingWebhookEvent, event_type: api_models::webhooks::IncomingWebhookEvent,
business_profile: &diesel_models::business_profile::BusinessProfile,
connector_name: &str, connector_name: &str,
) -> CustomResult<diesel_models::dispute::Dispute, errors::ApiErrorResponse> { ) -> CustomResult<diesel_models::dispute::Dispute, errors::ApiErrorResponse> {
let db = &*state.store; let db = &*state.store;
@ -375,7 +377,7 @@ pub async fn get_or_update_dispute_object(
challenge_required_by: dispute_details.challenge_required_by, challenge_required_by: dispute_details.challenge_required_by,
connector_created_at: dispute_details.created_at, connector_created_at: dispute_details.created_at,
connector_updated_at: dispute_details.updated_at, connector_updated_at: dispute_details.updated_at,
profile_id: None, profile_id: Some(business_profile.profile_id.clone()),
evidence: None, evidence: None,
merchant_connector_id: payment_attempt.merchant_connector_id.clone(), 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, &merchant_account.merchant_id,
&payment_attempt, &payment_attempt,
event_type, event_type,
&business_profile,
connector.id(), connector.id(),
) )
.await?; .await?;

View File

@ -693,6 +693,8 @@ impl ForeignFrom<storage::Dispute> for api_models::disputes::DisputeResponse {
connector_created_at: dispute.connector_created_at, connector_created_at: dispute.connector_created_at,
connector_updated_at: dispute.connector_updated_at, connector_updated_at: dispute.connector_updated_at,
created_at: dispute.created_at, created_at: dispute.created_at,
profile_id: dispute.profile_id,
merchant_connector_id: dispute.merchant_connector_id,
} }
} }
} }

View File

@ -7641,6 +7641,16 @@
"type": "string", "type": "string",
"format": "date-time", "format": "date-time",
"description": "Time at which dispute is received" "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
} }
} }
}, },