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(connector): forward JPMorgan merchant metadata to UCS + route JPMorgan via UCS (#13178)

Tushar Shuklaa594ab8dc1cb
diff --git a/config/config.example.toml b/config/config.example.toml
index dd6b9cc190..6c76b7a3af 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -1348,7 +1348,7 @@ url = "http://localhost:8080" # Open Router URL
base_url = "http://localhost:8000" # Unified Connector Service Base URL
connection_timeout = 10 # Connection Timeout Duration in Seconds
request_timeout = 35 # Per-RPC Request Timeout in Seconds
-ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, dlocal, barclaycard, tsys_transit" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, dlocal, barclaycard, tsys_transit, jpmorgan" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode, trustly" # Comma-separated list of connectors to disable UCS PSync call
[grpc_client.recovery_decider_client] # Revenue recovery client base url
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index 1645a9b86a..5c9d237757 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -413,7 +413,7 @@ payment_method = "payment_method_types" # <payment_method> = comma-separated clo
base_url = "http://localhost:8000" # Unified Connector Service Base URL
connection_timeout = 10 # Connection Timeout Duration in Seconds
request_timeout = 35 # Per-RPC Request Timeout in Seconds
-ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, payconex, dlocal, barclaycard" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, payconex, dlocal, barclaycard, jpmorgan" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode, trustly" # Comma-separated list of connectors to disable UCS PSync call
[revenue_recovery]
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 90462ced34..cefbc0bfd7 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -1026,7 +1026,7 @@ connector_list = "juspaythreedsserver, ctp_mastercard, ctp_visa"
connector_list = "worldpayvantiv"
[grpc_client.unified_connector_service]
-ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, payconex, dlocal, barclaycard, tsys_transit" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, payconex, dlocal, barclaycard, tsys_transit, jpmorgan" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode, trustly" # Comma-separated list of connectors to disable UCS PSync call
# Merchant Advice Code Configuration
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index f12e15d669..bdcc5c8da0 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -1034,7 +1034,7 @@ click_to_pay = {connector_list = "adyen, cybersource, trustpay"}
connector_list = "juspaythreedsserver, ctp_mastercard, ctp_visa"
[grpc_client.unified_connector_service]
-ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, payconex, dlocal, barclaycard" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, payconex, dlocal, barclaycard, jpmorgan" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode, trustly" # Comma-separated list of connectors to disable UCS PSync call
# Merchant Advice Code Configuration
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index d87da02b0b..f93e381e72 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -1045,7 +1045,7 @@ connector_list = "juspaythreedsserver, ctp_mastercard, ctp_visa"
connector_list = "worldpayvantiv"
[grpc_client.unified_connector_service]
-ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, payconex, dlocal, barclaycard" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, payconex, dlocal, barclaycard, jpmorgan" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode, trustly" # Comma-separated list of connectors to disable UCS PSync call
# Merchant Advice Code Configuration
diff --git a/config/development.toml b/config/development.toml
index 319e039cce..73f8e21339 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -1493,7 +1493,7 @@ enabled = "true"
base_url = "http://localhost:8000"
connection_timeout = 10
request_timeout = 35
-ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, payconex, dlocal, barclaycard, tsys_transit" # Comma-separated list of connectors that use UCS only
+ucs_only_connectors = "imerchantsolutions, paytm, phonepe, hyperpg, revolv3, fiservcommercehub, absa_sanlam, interpayments, payconex, dlocal, barclaycard, tsys_transit, jpmorgan" # Comma-separated list of connectors that use UCS only
ucs_psync_disabled_connectors = "cashtocode, trustly" # Comma-separated list of connectors to disable UCS PSync call
[revenue_recovery]
diff --git a/crates/router/src/core/unified_connector_service/connector_config.rs b/crates/router/src/core/unified_connector_service/connector_config.rs
index efdd36ba88..8f690cb7e6 100644
--- a/crates/router/src/core/unified_connector_service/connector_config.rs
+++ b/crates/router/src/core/unified_connector_service/connector_config.rs
@@ -6,6 +6,7 @@
use std::{collections::HashMap, str::FromStr};
use common_enums::{connector_enums::Connector, enums::Currency};
+use common_utils::ext_traits::ValueExt;
use error_stack::ResultExt;
use hyperswitch_domain_models::router_data::ConnectorAuthType;
use hyperswitch_masking::{PeekInterface, Secret};
@@ -62,6 +63,12 @@ pub struct AdyenMetadata {
endpoint_prefix: Option<Secret<String>>,
}
+#[derive(Debug, serde::Deserialize)]
+pub struct JpmorganMetadata {
+ company_name: Secret<String>,
+ product_name: Secret<String>,
+}
+
#[derive(Debug, serde::Deserialize)]
pub struct TruelayerMetadata {
merchant_account_id: Option<Secret<String>>,
@@ -507,6 +514,10 @@ pub enum ConnectorSpecificConfig {
Jpmorgan {
client_id: Secret<String>,
client_secret: Secret<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ company_name: Option<Secret<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ product_name: Option<Secret<String>>,
},
/// Peachpayments connector configuration
Peachpayments {
@@ -886,10 +897,22 @@ impl ForeignTryFrom<(Connector, &ConnectorAuthType, Option<&serde_json::Value>)>
_ => Err(err("Hipay requires BodyKey auth type")),
},
Connector::Jpmorgan => match auth {
- ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self::Jpmorgan {
- client_id: api_key.clone(),
- client_secret: key1.clone(),
- }),
+ ConnectorAuthType::BodyKey { api_key, key1 } => {
+ let jpm_meta = metadata
+ .map(|m| {
+ m.clone()
+ .parse_value::<JpmorganMetadata>("JpmorganMetadata")
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Invalid Jpmorgan metadata format")
+ })
+ .transpose()?;
+ Ok(Self::Jpmorgan {
+ client_id: api_key.clone(),
+ client_secret: key1.clone(),
+ company_name: jpm_meta.as_ref().map(|m| m.company_name.clone()),
+ product_name: jpm_meta.as_ref().map(|m| m.product_name.clone()),
+ })
+ }
_ => Err(err("Jpmorgan requires BodyKey auth type")),
},
Connector::Loonio => match auth {