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

feat(core/connector): Add partner merchant identifier field in payment intent (#10319)

Vani Gupta7d78998f5f9c
diff --git a/.github/workflows/archive/connector-ui-sanity-tests.yml b/.github/workflows/archive/connector-ui-sanity-tests.yml
index 7befdc6bcf..cc299caaac 100644
--- a/.github/workflows/archive/connector-ui-sanity-tests.yml
+++ b/.github/workflows/archive/connector-ui-sanity-tests.yml
@@ -31,7 +31,7 @@ env:
RUSTUP_MAX_RETRIES: 10
# Don't emit giant backtraces in the CI logs.
RUST_BACKTRACE: short
- RUST_MIN_STACK: 10485760
+ RUST_MIN_STACK: 11534336
jobs:
test_connectors:
diff --git a/.github/workflows/cypress-tests-runner.yml b/.github/workflows/cypress-tests-runner.yml
index d3c276a4e1..b06a24c3d2 100644
--- a/.github/workflows/cypress-tests-runner.yml
+++ b/.github/workflows/cypress-tests-runner.yml
@@ -19,7 +19,7 @@ env:
RUSTUP_MAX_RETRIES: 10
RUN_TESTS: ${{ ((github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name)) || (github.event_name == 'merge_group')}}
DEBUG: cypress:cli
- RUST_MIN_STACK: 10485760
+ RUST_MIN_STACK: 11534336
jobs:
formatter:
diff --git a/.github/workflows/postman-collection-runner.yml b/.github/workflows/postman-collection-runner.yml
index 7d78b668f0..a6dd11e489 100644
--- a/.github/workflows/postman-collection-runner.yml
+++ b/.github/workflows/postman-collection-runner.yml
@@ -16,7 +16,7 @@ env:
CONNECTORS: stripe
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
- RUST_MIN_STACK: 10485760
+ RUST_MIN_STACK: 11534336
jobs:
runner:
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 6064428c17..6c76450fe4 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -21348,6 +21348,22 @@
},
"additionalProperties": false
},
+ "MerchantApplicationDetails": {
+ "type": "object",
+ "description": "Information identifying merchant details",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Name of the the merchant application",
+ "nullable": true
+ },
+ "version": {
+ "type": "string",
+ "description": "Version of the merchant application",
+ "nullable": true
+ }
+ }
+ },
"MerchantCategoryCode": {
"type": "string",
"enum": [
@@ -23545,6 +23561,50 @@
}
}
},
+ "PartnerApplicationDetails": {
+ "type": "object",
+ "description": "Information identifying partner / external platform details",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Name of the partner/external platform",
+ "nullable": true
+ },
+ "version": {
+ "type": "string",
+ "description": "Version of the partner/external platform",
+ "example": "1.0.0",
+ "nullable": true
+ },
+ "integrator": {
+ "type": "string",
+ "description": "Integrator",
+ "nullable": true
+ }
+ }
+ },
+ "PartnerMerchantIdentifierDetails": {
+ "type": "object",
+ "description": "Information identifying partner and merchant application initiating the request",
+ "properties": {
+ "partner_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PartnerApplicationDetails"
+ }
+ ],
+ "nullable": true
+ },
+ "merchant_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MerchantApplicationDetails"
+ }
+ ],
+ "nullable": true
+ }
+ }
+ },
"Passthrough": {
"type": "object",
"required": [
@@ -26744,6 +26804,14 @@
}
],
"nullable": true
+ },
+ "partner_merchant_identifier_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PartnerMerchantIdentifierDetails"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -27264,6 +27332,14 @@
}
],
"nullable": true
+ },
+ "partner_merchant_identifier_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PartnerMerchantIdentifierDetails"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -27937,6 +28013,14 @@
}
],
"nullable": true
+ },
+ "partner_merchant_identifier_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PartnerMerchantIdentifierDetails"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -28805,6 +28889,14 @@
}
],
"nullable": true
+ },
+ "partner_merchant_identifier_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PartnerMerchantIdentifierDetails"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -29504,6 +29596,14 @@
}
],
"nullable": true
+ },
+ "partner_merchant_identifier_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PartnerMerchantIdentifierDetails"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -30157,6 +30257,14 @@
}
],
"nullable": true
+ },
+ "partner_merchant_identifier_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PartnerMerchantIdentifierDetails"
+ }
+ ],
+ "nullable": true
}
}
},
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 48ba263b74..eccce6f596 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1389,6 +1389,11 @@ pub struct PaymentsRequest {
/// The tokenization preference for the payment method. This is used to control whether a PSP token is created or not.
#[schema(value_type = Option<Tokenization>, example = "tokenize_at_psp")]
pub tokenization: Option<enums::Tokenization>,
+
+ /// Information identifying partner and merchant details
+ #[schema(value_type = Option<PartnerMerchantIdentifierDetails>)]
+ pub partner_merchant_identifier_details:
+ Option<common_types::payments::PartnerMerchantIdentifierDetails>,
}
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema, SmithyModel)]
@@ -7138,6 +7143,11 @@ pub struct PaymentsResponse {
/// The tokenization preference for the payment method. This is used to control whether a PSP token is created or not.
#[schema(value_type = Option<Tokenization>,example="skip_psp")]
pub tokenization: Option<enums::Tokenization>,
+
+ /// Information identifying partner and merchant details
+ #[schema(value_type = Option<PartnerMerchantIdentifierDetails>)]
+ pub partner_merchant_identifier_details:
+ Option<common_types::payments::PartnerMerchantIdentifierDetails>,
}
#[cfg(feature = "v2")]
diff --git a/crates/common_types/src/payments.rs b/crates/common_types/src/payments.rs
index 926b91db40..01fcf8bf5c 100644
--- a/crates/common_types/src/payments.rs
+++ b/crates/common_types/src/payments.rs
@@ -903,3 +903,52 @@ pub struct BillingDescriptor {
}
impl_to_sql_from_sql_json!(BillingDescriptor);
+
+/// Information identifying partner / external platform details
+#[derive(
+ Serialize, Deserialize, Debug, Clone, PartialEq, Eq, AsExpression, FromSqlRow, ToSchema,
+)]
+#[diesel(sql_type = Jsonb)]
+pub struct PartnerApplicationDetails {
+ /// Name of the partner/external platform
+ #[schema(value_type = Option<String>)]
+ pub name: Option<String>,
+ /// Version of the partner/external platform
+ #[schema(value_type = Option<String>, example = "1.0.0")]
+ pub version: Option<String>,
+ /// Integrator
+ #[schema(value_type = Option<String>)]
+ pub integrator: Option<String>,
+}
+impl_to_sql_from_sql_json!(PartnerApplicationDetails);
+
+/// Information identifying merchant details
+#[derive(
+ Serialize, Deserialize, Debug, Clone, PartialEq, Eq, AsExpression, FromSqlRow, ToSchema,
+)]
+#[diesel(sql_type = Jsonb)]
+pub struct MerchantApplicationDetails {
+ /// Name of the the merchant application
+ #[schema(value_type = Option<String>)]
+ pub name: Option<String>,
+ /// Version of the merchant application
+ #[schema(value_type = Option<String>)]
+ pub version: Option<String>,
+}
+impl_to_sql_from_sql_json!(MerchantApplicationDetails);
+
+/// Information identifying partner and merchant application initiating the request
+#[derive(
+ Serialize, Deserialize, Debug, Clone, PartialEq, Eq, AsExpression, FromSqlRow, ToSchema,
+)]
+#[diesel(sql_type = Jsonb)]
+pub struct PartnerMerchantIdentifierDetails {
+ /// Information identifying partner/external platform details
+ #[schema(value_type = Option<PartnerApplicationDetails>)]
+ pub partner_details: Option<PartnerApplicationDetails>,
+ /// Information identifying merchant details
+ #[schema(value_type = Option<MerchantApplicationDetails>)]
+ pub merchant_details: Option<MerchantApplicationDetails>,
+}
+
+impl_to_sql_from_sql_json!(PartnerMerchantIdentifierDetails);
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index 8eaab84449..c44700c703 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -83,6 +83,8 @@ pub struct PaymentIntent {
pub mit_category: Option<storage_enums::MitCategory>,
pub billing_descriptor: Option<common_types::payments::BillingDescriptor>,
pub tokenization: Option<common_enums::Tokenization>,
+ pub partner_merchant_identifier_details:
+ Option<common_types::payments::PartnerMerchantIdentifierDetails>,
pub merchant_reference_id: Option<common_utils::id_type::PaymentReferenceId>,
pub billing_address: Option<Encryption>,
pub shipping_address: Option<Encryption>,
@@ -190,6 +192,8 @@ pub struct PaymentIntent {
pub mit_category: Option<storage_enums::MitCategory>,
pub billing_descriptor: Option<common_types::payments::BillingDescriptor>,
pub tokenization: Option<common_enums::Tokenization>,
+ pub partner_merchant_identifier_details:
+ Option<common_types::payments::PartnerMerchantIdentifierDetails>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression, PartialEq)]
@@ -485,6 +489,8 @@ pub struct PaymentIntentNew {
pub mit_category: Option<storage_enums::MitCategory>,
pub billing_descriptor: Option<common_types::payments::BillingDescriptor>,
pub tokenization: Option<common_enums::Tokenization>,
+ pub partner_merchant_identifier_details:
+ Option<common_types::payments::PartnerMerchantIdentifierDetails>,
}
#[cfg(feature = "v2")]
@@ -834,6 +840,7 @@ impl PaymentIntentUpdateInternal {
mit_category: None,
billing_descriptor: source.billing_descriptor,
tokenization: None,
+ partner_merchant_identifier_details: source.partner_merchant_identifier_details,
}
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 7fb1e05726..72029168ea 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -1205,6 +1205,7 @@ diesel::table! {
billing_descriptor -> Nullable<Jsonb>,
#[max_length = 64]
tokenization -> Nullable<Varchar>,
+ partner_merchant_identifier_details -> Nullable<Jsonb>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 0459fbc619..535efc0f40 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -1139,6 +1139,7 @@ diesel::table! {
billing_descriptor -> Nullable<Jsonb>,
#[max_length = 64]
tokenization -> Nullable<Varchar>,
+ partner_merchant_identifier_details -> Nullable<Jsonb>,
#[max_length = 64]
merchant_reference_id -> Nullable<Varchar>,
billing_address -> Nullable<Bytea>,
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
index 22dcb0304c..e6763edce7 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs
@@ -290,6 +290,31 @@ pub struct RiskData {
affiliate_order: Option<bool>,
}
+#[serde_with::skip_serializing_none]
+#[derive(Clone, Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApplicationInfo {
+ external_platform: Option<ExternalPlatform>,
+ merchant_application: Option<MerchantApplication>,
+}
+
+#[serde_with::skip_serializing_none]
+#[derive(Clone, Default, Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ExternalPlatform {
+ name: Option<String>,
+ version: Option<String>,
+ integrator: Option<String>,
+}
+
+#[serde_with::skip_serializing_none]
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct MerchantApplication {
+ name: Option<String>,
+ version: Option<String>,
+}
+
#[serde_with::skip_serializing_none]
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
@@ -328,6 +353,7 @@ pub struct AdyenPaymentRequest<'a> {
session_validity: Option<PrimitiveDateTime>,
metadata: Option<serde_json::Value>,
platform_chargeback_logic: Option<AdyenPlatformChargeBackLogicMetadata>,
+ application_info: Option<ApplicationInfo>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -1806,6 +1832,32 @@ impl TryFrom<&ConnectorAuthType> for AdyenAuthType {
}
}
+fn get_application_info(
+ item: &AdyenRouterData<&PaymentsAuthorizeRouterData>,
+) -> Option<ApplicationInfo> {
+ item.router_data
+ .request
+ .partner_merchant_identifier_details
+ .as_ref()
+ .map(|partner_merchant_identifier_details| ApplicationInfo {
+ merchant_application: partner_merchant_identifier_details
+ .merchant_details
+ .as_ref()
+ .map(|merchant_details| MerchantApplication {
+ name: merchant_details.name.clone(),
+ version: merchant_details.version.clone(),
+ }),
+ external_platform: partner_merchant_identifier_details
+ .partner_details
+ .as_ref()
+ .map(|platform_details| ExternalPlatform {
+ name: platform_details.name.clone(),
+ version: platform_details.version.clone(),
+ integrator: platform_details.integrator.clone(),
+ }),
+ })
+}
+
impl TryFrom<&AdyenRouterData<&PaymentsAuthorizeRouterData>> for AdyenPaymentRequest<'_> {
type Error = Error;
fn try_from(item: &AdyenRouterData<&PaymentsAuthorizeRouterData>) -> Result<Self, Self::Error> {
@@ -3082,6 +3134,7 @@ impl
let delivery_address =
get_address_info(item.router_data.get_optional_shipping()).and_then(Result::ok);
let telephone_number = item.router_data.get_optional_billing_phone_number();
+ let application_info = get_application_info(item);
Ok(AdyenPaymentRequest {
amount,
@@ -3120,6 +3173,7 @@ impl
.clone()
.map(filter_adyen_metadata),
platform_chargeback_logic,
+ application_info,
})
}
}
@@ -3169,6 +3223,7 @@ impl TryFrom<(&AdyenRouterData<&PaymentsAuthorizeRouterData>, &Card)> for AdyenP
let delivery_address =
get_address_info(item.router_data.get_optional_shipping()).and_then(Result::ok);
let telephone_number = item.router_data.get_optional_billing_phone_number();
+ let application_info = get_application_info(item);
let mpi_data =
if let Some(auth_data) = value.0.router_data.request.authentication_data.as_ref() {
@@ -3255,6 +3310,7 @@ impl TryFrom<(&AdyenRouterData<&PaymentsAuthorizeRouterData>, &Card)> for AdyenP
.clone()
.map(filter_adyen_metadata),
platform_chargeback_logic,
+ application_info,
})
}
}
@@ -3309,6 +3365,7 @@ impl
addr.state_or_province = Some(item.router_data.get_billing_state_code()?);
}
}
+ let application_info = get_application_info(item);
let request = AdyenPaymentRequest {
amount,
@@ -3347,6 +3404,7 @@ impl
.clone()
.map(filter_adyen_metadata),
platform_chargeback_logic,
+ application_info,
};
Ok(request)
}
@@ -3389,6 +3447,7 @@ impl TryFrom<(&AdyenRouterData<&PaymentsAuthorizeRouterData>, &VoucherData)>
let delivery_address =
get_address_info(item.router_data.get_optional_shipping()).and_then(Result::ok);
let telephone_number = item.router_data.get_optional_billing_phone_number();
+ let application_info = get_application_info(item);
let request = AdyenPaymentRequest {
amount,
@@ -3428,6 +3487,7 @@ impl TryFrom<(&AdyenRouterData<&PaymentsAuthorizeRouterData>, &VoucherData)>
.map(filter_adyen_metadata),
platform_chargeback_logic,
+ application_info,
};
Ok(request)
}
@@ -3512,6 +3572,7 @@ impl
| BankTransferData::InstantBankTransferPoland {}
| BankTransferData::IndonesianBankTransfer { .. } => (None, None),
};
+ let application_info = get_application_info(item);
let request = AdyenPaymentRequest {
amount,
@@ -3551,6 +3612,7 @@ impl
.map(filter_adyen_metadata),
platform_chargeback_logic,
+ application_info,
};
Ok(request)
}
@@ -3594,6 +3656,7 @@ impl
let delivery_address =
get_address_info(item.router_data.get_optional_shipping()).and_then(Result::ok);
let telephone_number = item.router_data.get_optional_billing_phone_number();
+ let application_info = get_application_info(item);
let request = AdyenPaymentRequest {
amount,
@@ -3632,6 +3695,7 @@ impl
.clone()
.map(filter_adyen_metadata),
platform_chargeback_logic,
+ application_info,
};
Ok(request)
}
@@ -3680,6 +3744,7 @@ impl
let delivery_address =
get_address_info(item.router_data.get_optional_shipping()).and_then(Result::ok);
let telephone_number = item.router_data.get_optional_billing_phone_number();
+ let application_info = get_application_info(item);
Ok(AdyenPaymentRequest {
amount,
@@ -3718,6 +3783,7 @@ impl
.clone()
.map(filter_adyen_metadata),
platform_chargeback_logic,
+ application_info,
})
}
}
@@ -3826,6 +3892,7 @@ impl TryFrom<(&AdyenRouterData<&PaymentsAuthorizeRouterData>, &WalletData)>
let delivery_address =
get_address_info(item.router_data.get_optional_shipping()).and_then(Result::ok);
let telephone_number = item.router_data.get_optional_billing_phone_number();
+ let application_info = get_application_info(item);
Ok(AdyenPaymentRequest {
amount,
@@ -3864,6 +3931,7 @@ impl TryFrom<(&AdyenRouterData<&PaymentsAuthorizeRouterData>, &WalletData)>
.clone()
.map(filter_adyen_metadata),
platform_chargeback_logic,
+ application_info,
})
}
}
@@ -3920,6 +3988,7 @@ impl
};
let device_fingerprint = adyen_metadata.device_fingerprint.clone();
let platform_chargeback_logic = adyen_metadata.platform_chargeback_logic.clone();
+ let application_info = get_application_info(item);
Ok(AdyenPaymentRequest {
amount,
@@ -3958,6 +4027,7 @@ impl
.clone()
.map(filter_adyen_metadata),
platform_chargeback_logic,
+ application_info,
})
}
}
@@ -4008,6 +4078,7 @@ impl
get_address_info(item.router_data.get_optional_billing()).and_then(Result::ok);
let delivery_address =
get_address_info(item.router_data.get_optional_shipping()).and_then(Result::ok);
+ let application_info = get_application_info(item);
Ok(AdyenPaymentRequest {
amount,
merchant_account: auth_type.merchant_account,
@@ -4045,6 +4116,7 @@ impl
.clone()
.map(filter_adyen_metadata),
platform_chargeback_logic,
+ application_info,
})
}
}
@@ -6564,6 +6636,7 @@ impl
let delivery_address =
get_address_info(item.router_data.get_optional_shipping()).and_then(Result::ok);
let telephone_number = item.router_data.get_optional_billing_phone_number();
+ let application_info = get_application_info(item);
Ok(AdyenPaymentRequest {
amount,
@@ -6602,6 +6675,7 @@ impl
.clone()
.map(filter_adyen_metadata),
platform_chargeback_logic,
+ application_info,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
index 5657941c32..33afdd5eb8 100644
--- a/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
@@ -29,6 +29,7 @@ use hyperswitch_domain_models::{
use hyperswitch_interfaces::{consts, errors, webhooks};
use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
+use serde_json::json;
use serde_with::skip_serializing_none;
use time::PrimitiveDateTime;
use url::Url;
@@ -383,6 +384,7 @@ pub struct PaymentsRequest {
pub return_url: ReturnUrl,
pub capture: bool,
pub reference: String,
+ #[serde(skip_serializing_if = "is_metadata_empty")]
pub metadata: Option<Secret<serde_json::Value>>,
pub payment_type: CheckoutPaymentType,
pub merchant_initiated: Option<bool>,
@@ -473,6 +475,52 @@ fn split_account_holder_name(
}
}
+fn build_metadata(
+ item: &CheckoutRouterData<&PaymentsAuthorizeRouterData>,
+) -> Option<Secret<serde_json::Value>> {
+ // get metadata or create empty json object
+ let mut metadata_json = item
+ .router_data
+ .request
+ .metadata
+ .clone()
+ .unwrap_or_else(|| json!({}));
+
+ // get udf5 value (name or integrator)
+ let udf5 = item
+ .router_data
+ .request
+ .partner_merchant_identifier_details
+ .as_ref()
+ .and_then(|p| p.partner_details.as_ref())
+ .and_then(|e| e.name.clone().or(e.integrator.clone()));
+
+ // insert udf5 if present
+ if let Some(v) = udf5 {
+ if let Some(obj) = metadata_json.as_object_mut() {
+ obj.insert("udf5".to_string(), json!(v));
+ } else {
+ metadata_json = json!({ "udf5": v });
+ }
+ }
+
+ Some(Secret::new(metadata_json))
+}
+
+fn is_metadata_empty(val: &Option<Secret<serde_json::Value>>) -> bool {
+ match val {
+ None => true,
+ Some(secret) => {
+ let inner = secret.clone().expose();
+ match inner {
+ serde_json::Value::Null => true,
+ serde_json::Value::Object(map) => map.is_empty(),
+ _ => false,
+ }
+ }
+ }
+}
+
impl TryFrom<&CheckoutRouterData<&PaymentsAuthorizeRouterData>> for PaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
@@ -752,7 +800,7 @@ impl TryFrom<&CheckoutRouterData<&PaymentsAuthorizeRouterData>> for PaymentsRequ
let connector_auth = &item.router_data.connector_auth_type;
let auth_type: CheckoutAuthType = connector_auth.try_into()?;
let processing_channel_id = auth_type.processing_channel_id;
- let metadata = item.router_data.request.metadata.clone().map(Into::into);
+ let metadata = build_metadata(item);
let (customer, processing, shipping, items) = if let Some(l2l3_data) =
&item.router_data.l2_l3_data
{
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index a495495e9b..6fdad8d8ce 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -7088,6 +7088,10 @@ pub(crate) fn convert_setup_mandate_router_data_to_authorize_router_data(
mit_category: None,
billing_descriptor: data.request.billing_descriptor.clone(),
tokenization: None,
+ partner_merchant_identifier_details: data
+ .request
+ .partner_merchant_identifier_details
+ .clone(),
}
}
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 98f1bd024b..c80c811df5 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -133,6 +133,8 @@ pub struct PaymentIntent {
pub mit_category: Option<common_enums::MitCategory>,
pub billing_descriptor: Option<BillingDescriptor>,
pub tokenization: Option<common_enums::Tokenization>,
+ pub partner_merchant_identifier_details:
+ Option<common_types::payments::PartnerMerchantIdentifierDetails>,
}
impl PaymentIntent {
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index 4d3a39a71a..ce62ce481f 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -1975,6 +1975,7 @@ impl behaviour::Conversion for PaymentIntent {
mit_category: None,
billing_descriptor: None,
tokenization: None,
+ partner_merchant_identifier_details: None,
})
}
async fn convert_back(
@@ -2319,6 +2320,7 @@ impl behaviour::Conversion for PaymentIntent {
mit_category: self.mit_category,
billing_descriptor: self.billing_descriptor,
tokenization: self.tokenization,
+ partner_merchant_identifier_details: self.partner_merchant_identifier_details,
})
}
@@ -2431,6 +2433,8 @@ impl behaviour::Conversion for PaymentIntent {
mit_category: storage_model.mit_category,
billing_descriptor: storage_model.billing_descriptor,
tokenization: storage_model.tokenization,
+ partner_merchant_identifier_details: storage_model
+ .partner_merchant_identifier_details,
})
}
.await
@@ -2515,6 +2519,7 @@ impl behaviour::Conversion for PaymentIntent {
mit_category: self.mit_category,
billing_descriptor: self.billing_descriptor,
tokenization: self.tokenization,
+ partner_merchant_identifier_details: self.partner_merchant_identifier_details,
})
}
}
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index d7b2419868..429837e68c 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -95,6 +95,8 @@ pub struct PaymentsAuthorizeData {
pub mit_category: Option<common_enums::MitCategory>,
pub billing_descriptor: Option<common_types::payments::BillingDescriptor>,
pub tokenization: Option<common_enums::Tokenization>,
+ pub partner_merchant_identifier_details:
+ Option<common_types::payments::PartnerMerchantIdentifierDetails>,
}
#[derive(Debug, Clone, Serialize)]
@@ -1468,6 +1470,8 @@ pub struct SetupMandateRequestData {
pub billing_descriptor: Option<common_types::payments::BillingDescriptor>,
pub split_payments: Option<common_types::payments::SplitPaymentsRequest>,
pub tokenization: Option<common_enums::Tokenization>,
+ pub partner_merchant_identifier_details:
+ Option<common_types::payments::PartnerMerchantIdentifierDetails>,
}
#[derive(Debug, Clone)]
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index f30d269aff..9a1f1dc932 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -293,6 +293,9 @@ Never share your secret api keys. Keep them guarded and secure.
common_types::three_ds_decision_rule_engine::ThreeDSDecision,
common_types::payments::MerchantCountryCode,
common_types::payments::BillingDescriptor,
+ common_types::payments::PartnerMerchantIdentifierDetails,
+ common_types::payments::PartnerApplicationDetails,
+ common_types::payments::MerchantApplicationDetails,
api_models::enums::PaymentChannel,
api_models::three_ds_decision_rule::ThreeDsDecisionRuleExecuteRequest,
api_models::three_ds_decision_rule::ThreeDsDecisionRuleExecuteResponse,
diff --git a/crates/router/build.rs b/crates/router/build.rs
index 7c8043c48a..0d7fac8343 100644
--- a/crates/router/build.rs
+++ b/crates/router/build.rs
@@ -1,8 +1,8 @@
fn main() {
- // Set thread stack size to 10 MiB for debug builds
+ // Set thread stack size to 11 MiB for debug builds
// Reference: https://doc.rust-lang.org/std/thread/#stack-size
#[cfg(debug_assertions)]
- println!("cargo:rustc-env=RUST_MIN_STACK=10485760"); // 10 * 1024 * 1024 = 10 MiB
+ println!("cargo:rustc-env=RUST_MIN_STACK=11534336"); // 11 * 1024 * 1024 = 11 MiB
#[cfg(feature = "vergen")]
router_env::vergen::generate_cargo_instructions();
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index a744f3bac0..d098630d34 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4131,6 +4131,7 @@ mod tests {
enable_partial_authorization: None,
enable_overcapture: None,
billing_descriptor: None,
+ partner_merchant_identifier_details: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_ok());
@@ -4219,6 +4220,7 @@ mod tests {
enable_overcapture: None,
billing_descriptor: None,
tokenization: None,
+ partner_merchant_identifier_details: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent,).is_err())
@@ -4305,6 +4307,7 @@ mod tests {
enable_partial_authorization: None,
enable_overcapture: None,
billing_descriptor: None,
+ partner_merchant_identifier_details: None,
};
let req_cs = Some("1".to_string());
assert!(authenticate_client_secret(req_cs.as_ref(), &payment_intent).is_err())
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 38f76fd0db..1b852285df 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1660,6 +1660,9 @@ impl PaymentCreate {
mit_category: request.mit_category,
billing_descriptor: request.billing_descriptor.clone(),
tokenization: request.tokenization,
+ partner_merchant_identifier_details: request
+ .partner_merchant_identifier_details
+ .clone(),
})
}
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 779f29c8c2..6542da6b82 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -460,6 +460,7 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
enable_overcapture: None,
is_stored_credential: None,
billing_descriptor: None,
+ partner_merchant_identifier_details: None,
};
let connector_mandate_request_reference_id = payment_data
.payment_attempt
@@ -1539,6 +1540,7 @@ pub async fn construct_payment_router_data_for_setup_mandate<'a>(
is_stored_credential: None,
billing_descriptor: None,
split_payments: None,
+ partner_merchant_identifier_details: None,
};
let connector_mandate_request_reference_id = payment_data
.payment_attempt
@@ -3940,6 +3942,7 @@ where
is_stored_credential: payment_attempt.is_stored_credential,
request_extended_authorization: payment_attempt.request_extended_authorization,
billing_descriptor: payment_intent.billing_descriptor,
+ partner_merchant_identifier_details: payment_intent.partner_merchant_identifier_details,
};
services::ApplicationResponse::JsonWithHeaders((payments_response, headers))
@@ -4259,6 +4262,7 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay
is_stored_credential:pa.is_stored_credential,
request_extended_authorization: pa.request_extended_authorization,
billing_descriptor: pi.billing_descriptor,
+ partner_merchant_identifier_details: pi.partner_merchant_identifier_details,
}
}
}
@@ -4595,6 +4599,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
enable_overcapture: None,
is_stored_credential: None,
billing_descriptor: None,
+ partner_merchant_identifier_details: None,
})
}
}
@@ -4838,6 +4843,9 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
enable_overcapture: payment_data.payment_intent.enable_overcapture,
is_stored_credential: payment_data.payment_attempt.is_stored_credential,
billing_descriptor,
+ partner_merchant_identifier_details: payment_data
+ .payment_intent
+ .partner_merchant_identifier_details,
})
}
}
@@ -5859,6 +5867,9 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SetupMandateRequ
billing_descriptor,
split_payments: payment_data.payment_intent.split_payments.clone(),
tokenization: payment_data.payment_intent.tokenization,
+ partner_merchant_identifier_details: payment_data
+ .payment_intent
+ .partner_merchant_identifier_details,
})
}
}
diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs
index 254644cb55..e41e29f1ae 100644
--- a/crates/router/src/db/events.rs
+++ b/crates/router/src/db/events.rs
@@ -1405,6 +1405,7 @@ mod tests {
is_stored_credential: None,
request_extended_authorization: None,
billing_descriptor: None,
+ partner_merchant_identifier_details: None,
};
let content =
api_webhooks::OutgoingWebhookContent::PaymentDetails(Box::new(expected_response));
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 726961cd88..952f66a62f 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -1320,6 +1320,10 @@ impl ForeignFrom<&SetupMandateRouterData> for PaymentsAuthorizeData {
mit_category: None,
billing_descriptor: data.request.billing_descriptor.clone(),
tokenization: None,
+ partner_merchant_identifier_details: data
+ .request
+ .partner_merchant_identifier_details
+ .clone(),
}
}
}
diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs
index 7e2ad8189c..ff2efccaec 100644
--- a/crates/router/src/types/api/verify_connector.rs
+++ b/crates/router/src/types/api/verify_connector.rs
@@ -71,6 +71,7 @@ impl VerifyConnectorData {
mit_category: None,
billing_descriptor: None,
tokenization: None,
+ partner_merchant_identifier_details: None,
}
}
diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs
index e3f89ea30d..0acf9e9869 100644
--- a/crates/router/src/utils/user/sample_data.rs
+++ b/crates/router/src/utils/user/sample_data.rs
@@ -296,6 +296,7 @@ pub async fn generate_sample_data(
mit_category: None,
billing_descriptor: None,
tokenization: None,
+ partner_merchant_identifier_details: None,
};
let (connector_transaction_id, processor_transaction_data) =
ConnectorTransactionId::form_id_and_data(attempt_id.clone());
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 0619da8727..0205242c4b 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -1013,6 +1013,7 @@ impl Default for PaymentAuthorizeType {
mit_category: None,
billing_descriptor: None,
tokenization: None,
+ partner_merchant_identifier_details: None,
};
Self(data)
}
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index 5495ba32b5..d0378802be 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -473,6 +473,7 @@ async fn payments_create_core() {
is_stored_credential: None,
request_extended_authorization: None,
billing_descriptor: None,
+ partner_merchant_identifier_details: None,
};
let expected_response =
services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));
@@ -764,6 +765,7 @@ async fn payments_create_core_adyen_no_redirect() {
is_stored_credential: None,
request_extended_authorization: None,
billing_descriptor: None,
+ partner_merchant_identifier_details: None,
},
vec![],
));
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index 147868ad28..a571b9dbe8 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -233,6 +233,7 @@ async fn payments_create_core() {
is_stored_credential: None,
request_extended_authorization: None,
billing_descriptor: None,
+ partner_merchant_identifier_details: None,
};
let expected_response =
@@ -533,6 +534,7 @@ async fn payments_create_core_adyen_no_redirect() {
is_stored_credential: None,
request_extended_authorization: None,
billing_descriptor: None,
+ partner_merchant_identifier_details: None,
},
vec![],
));
diff --git a/migrations/2025-11-13-124122_add_partner_merchant_identifier_details_in_payment_intent/down.sql b/migrations/2025-11-13-124122_add_partner_merchant_identifier_details_in_payment_intent/down.sql
new file mode 100644
index 0000000000..75f3e4d804
--- /dev/null
+++ b/migrations/2025-11-13-124122_add_partner_merchant_identifier_details_in_payment_intent/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_intent DROP COLUMN IF EXISTS partner_merchant_identifier_details;
\ No newline at end of file
diff --git a/migrations/2025-11-13-124122_add_partner_merchant_identifier_details_in_payment_intent/up.sql b/migrations/2025-11-13-124122_add_partner_merchant_identifier_details_in_payment_intent/up.sql
new file mode 100644
index 0000000000..70a8850871
--- /dev/null
+++ b/migrations/2025-11-13-124122_add_partner_merchant_identifier_details_in_payment_intent/up.sql
@@ -0,0 +1,2 @@
+-- Your SQL goes here
+ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS partner_merchant_identifier_details jsonb;
\ No newline at end of file