feat(core): accept merchant_connector_details in Refunds create and retrieve flow (#8441)

Co-authored-by: Aishwariyaa Anand <aishwariyaa.anand@Aishwariyaa-Anand-C3PGW02T6Y.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Aishwariyaa Anand
2025-06-26 19:20:00 +05:30
committed by GitHub
parent d2740f0322
commit b185d85f6b
13 changed files with 439 additions and 92 deletions

View File

@ -272,24 +272,8 @@ pub struct PaymentsCreateIntentRequest {
pub force_3ds_challenge: Option<bool>,
/// Merchant connector details used to make payments.
pub merchant_connector_details: Option<MerchantConnectorDetails>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[cfg(feature = "v2")]
pub struct MerchantConnectorDetails {
/// The connector used for the payment
#[schema(value_type = Connector)]
pub connector_name: api_enums::Connector,
/// The merchant connector credentials used for the payment
#[schema(value_type = Object, example = r#"{
"merchant_connector_creds": {
"auth_type": "HeaderKey",
"api_key":"sk_test_xxxxxexamplexxxxxx12345"
},
}"#)]
pub merchant_connector_creds: pii::SecretSerdeValue,
#[schema(value_type = Option<MerchantConnectorAuthDetails>)]
pub merchant_connector_details: Option<common_types::domain::MerchantConnectorAuthDetails>,
}
#[cfg(feature = "v2")]
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
@ -5361,7 +5345,8 @@ pub struct PaymentsConfirmIntentRequest {
pub payment_token: Option<String>,
/// Merchant connector details used to make payments.
pub merchant_connector_details: Option<MerchantConnectorDetails>,
#[schema(value_type = Option<MerchantConnectorAuthDetails>)]
pub merchant_connector_details: Option<common_types::domain::MerchantConnectorAuthDetails>,
}
#[cfg(feature = "v2")]
@ -5536,7 +5521,8 @@ pub struct PaymentsRequest {
pub is_iframe_redirection_enabled: Option<bool>,
/// Merchant connector details used to make payments.
pub merchant_connector_details: Option<MerchantConnectorDetails>,
#[schema(value_type = Option<MerchantConnectorAuthDetails>)]
pub merchant_connector_details: Option<common_types::domain::MerchantConnectorAuthDetails>,
}
#[cfg(feature = "v2")]
@ -5614,7 +5600,8 @@ pub struct PaymentsRetrieveRequest {
/// If enabled, provides whole connector response
pub all_keys_required: Option<bool>,
/// Merchant connector details used to make payments.
pub merchant_connector_details: Option<MerchantConnectorDetails>,
#[schema(value_type = Option<MerchantConnectorAuthDetails>)]
pub merchant_connector_details: Option<common_types::domain::MerchantConnectorAuthDetails>,
}
#[cfg(feature = "v2")]

View File

@ -102,6 +102,10 @@ pub struct RefundsCreateRequest {
/// Metadata is useful for storing additional, unstructured information on an object.
#[schema(value_type = Option<Object>, example = r#"{ "city": "NY", "unit": "245" }"#)]
pub metadata: Option<pii::SecretSerdeValue>,
/// Merchant connector details used to make payments.
#[schema(value_type = Option<MerchantConnectorAuthDetails>)]
pub merchant_connector_details: Option<common_types::domain::MerchantConnectorAuthDetails>,
}
#[cfg(feature = "v1")]
@ -116,6 +120,16 @@ pub struct RefundsRetrieveBody {
pub force_sync: Option<bool>,
}
#[cfg(feature = "v2")]
#[derive(Default, Debug, Clone, Deserialize)]
pub struct RefundsRetrievePayload {
/// `force_sync` with the connector to get refund details
pub force_sync: Option<bool>,
/// Merchant connector details used to make payments.
pub merchant_connector_details: Option<common_types::domain::MerchantConnectorAuthDetails>,
}
#[cfg(feature = "v1")]
#[derive(Default, Debug, ToSchema, Clone, Deserialize, Serialize)]
pub struct RefundsRetrieveRequest {
@ -149,6 +163,10 @@ pub struct RefundsRetrieveRequest {
/// `force_sync` with the connector to get refund details
/// (defaults to false)
pub force_sync: Option<bool>,
/// Merchant connector details used to make payments.
#[schema(value_type = Option<MerchantConnectorAuthDetails>)]
pub merchant_connector_details: Option<common_types::domain::MerchantConnectorAuthDetails>,
}
#[derive(Default, Debug, ToSchema, Clone, Deserialize, Serialize)]
@ -323,7 +341,7 @@ pub struct RefundResponse {
pub profile_id: common_utils::id_type::ProfileId,
/// The merchant_connector_id of the processor through which this payment went through
#[schema(value_type = String)]
pub merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
/// The reference id of the connector for the refund
pub connector_refund_reference_id: Option<String>,
}