mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	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:
		| @ -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)] | ||||
|  | ||||
| @ -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?; | ||||
|  | ||||
| @ -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, | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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 | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Narayan Bhat
					Narayan Bhat