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

fix(refund): add merchant_connector_id in refund (#3303)

Narayan Bhataf43b07e4394
diff --git a/crates/api_models/src/refunds.rs b/crates/api_models/src/refunds.rs
index e89de9c589..1a0668023f 100644
--- a/crates/api_models/src/refunds.rs
+++ b/crates/api_models/src/refunds.rs
@@ -127,7 +127,10 @@ pub struct RefundResponse {
/// The connector used for the refund and the corresponding payment
#[schema(example = "stripe")]
pub connector: String,
+ /// The id of business profile for this refund
pub profile_id: Option<String>,
+ /// The merchant_connector_id of the processor through which this payment went through
+ pub merchant_connector_id: Option<String>,
}
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 6cc118b0f3..e60c341ded 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -650,6 +650,7 @@ pub async fn validate_and_create_refund(
.set_attempt_id(payment_attempt.attempt_id.clone())
.set_refund_reason(req.reason)
.set_profile_id(payment_intent.profile_id.clone())
+ .set_merchant_connector_id(payment_attempt.merchant_connector_id.clone())
.to_owned();
let refund = match db
@@ -776,6 +777,7 @@ impl ForeignFrom<storage::Refund> for api::RefundResponse {
created_at: Some(refund.created_at),
updated_at: Some(refund.updated_at),
connector: refund.connector,
+ merchant_connector_id: refund.merchant_connector_id,
}
}
}
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 7a2b5504e0..3e582cfed5 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -11679,6 +11679,12 @@
},
"profile_id": {
"type": "string",
+ "description": "The id of business profile for this refund",
+ "nullable": true
+ },
+ "merchant_connector_id": {
+ "type": "string",
+ "description": "The merchant_connector_id of the processor through which this payment went through",
"nullable": true
}
}