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: HS <> UCS dependencies for adyen auth_code and test_mode (#11190)

gopikrishna00021db0acef57d
diff --git a/Cargo.lock b/Cargo.lock
index a80f8df311..8ee06476be 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2129,7 +2129,7 @@ dependencies = [
[[package]]
name = "config_patch_derive"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=0c0418526daa56bcdd588d010229793834db57cd#0c0418526daa56bcdd588d010229793834db57cd"
+source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
dependencies = [
"proc-macro2",
"quote",
@@ -3800,7 +3800,7 @@ dependencies = [
[[package]]
name = "grpc-api-types"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=0c0418526daa56bcdd588d010229793834db57cd#0c0418526daa56bcdd588d010229793834db57cd"
+source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
dependencies = [
"axum 0.8.4",
"error-stack 0.5.0",
@@ -7473,7 +7473,7 @@ dependencies = [
[[package]]
name = "rust-grpc-client"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=0c0418526daa56bcdd588d010229793834db57cd#0c0418526daa56bcdd588d010229793834db57cd"
+source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
dependencies = [
"grpc-api-types",
]
@@ -10263,7 +10263,7 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]]
name = "ucs_cards"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=0c0418526daa56bcdd588d010229793834db57cd#0c0418526daa56bcdd588d010229793834db57cd"
+source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
dependencies = [
"bytes 1.10.1",
"error-stack 0.4.1",
@@ -10279,7 +10279,7 @@ dependencies = [
[[package]]
name = "ucs_common_enums"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=0c0418526daa56bcdd588d010229793834db57cd#0c0418526daa56bcdd588d010229793834db57cd"
+source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
dependencies = [
"serde",
"strum 0.26.3",
@@ -10290,7 +10290,7 @@ dependencies = [
[[package]]
name = "ucs_common_utils"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=0c0418526daa56bcdd588d010229793834db57cd#0c0418526daa56bcdd588d010229793834db57cd"
+source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
dependencies = [
"anyhow",
"base64 0.21.7",
diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.toml
index bfd6b21956..cf99d63d6d 100644
--- a/crates/external_services/Cargo.toml
+++ b/crates/external_services/Cargo.toml
@@ -69,7 +69,7 @@ reqwest = { version = "0.11.27", features = ["rustls-tls"] }
http = "0.2.12"
url = { version = "2.5.4", features = ["serde"] }
quick-xml = { version = "0.31.0", features = ["serialize"] }
-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "0c0418526daa56bcdd588d010229793834db57cd", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc", package = "rust-grpc-client" }
open-feature = { version = "0.2.5", optional = true }
superposition_provider = { version = "0.88.1", optional = true }
diff --git a/crates/hyperswitch_interfaces/Cargo.toml b/crates/hyperswitch_interfaces/Cargo.toml
index 33b67eb097..9f5858711d 100644
--- a/crates/hyperswitch_interfaces/Cargo.toml
+++ b/crates/hyperswitch_interfaces/Cargo.toml
@@ -30,7 +30,7 @@ strum = { version = "0.26", features = ["derive"] }
thiserror = "1.0.69"
time = "0.3.41"
url = { version = "2.5.4", features = ["serde"] }
-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "0c0418526daa56bcdd588d010229793834db57cd", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc", package = "rust-grpc-client" }
unified-connector-service-masking = { git = "https://github.com/juspay/hyperswitch", tag = "2025.11.24.0", package = "masking" }
tokio = { version = "1.45.1", features = ["macros", "rt-multi-thread"] }
diff --git a/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs b/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs
index 4f9e546ac6..beacd2cec4 100644
--- a/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs
+++ b/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs
@@ -322,8 +322,16 @@ impl ForeignTryFrom<payments_grpc::ConnectorResponseData> for ConnectorResponseD
// Extract additional_payment_method_data
let additional_payment_method_data = value
.additional_payment_method_data
- .map(AdditionalPaymentMethodConnectorResponse::foreign_try_from)
- .transpose()?;
+ .and_then(|apmd| {
+ AdditionalPaymentMethodConnectorResponse::foreign_try_from(apmd)
+ .inspect_err(|e| {
+ router_env::logger::warn!(
+ error=?e,
+ "Failed to deserialize additional_payment_method_data from UCS - setting to None"
+ );
+ })
+ .ok()
+ });
let extended_authorization_response_data =
value.extended_authorization_response_data.map(|data| {
@@ -363,43 +371,61 @@ impl ForeignTryFrom<payments_grpc::AdditionalPaymentMethodConnectorResponse>
fn foreign_try_from(
value: payments_grpc::AdditionalPaymentMethodConnectorResponse,
) -> Result<Self, Self::Error> {
- // Handle the oneof payment_method_data field
match value.payment_method_data {
- Some(payments_grpc::additional_payment_method_connector_response::PaymentMethodData::Card(card_data)) => {
- Ok(Self::Card {
- authentication_data: card_data.authentication_data.and_then(|data| {
- serde_json::from_slice(&data)
- .inspect_err(|e| {
- router_env::logger::warn!(
- deserialization_error=?e,
- "Failed to deserialize authentication_data from UCS connector response"
- );
- })
- .ok()
- }),
- payment_checks: card_data.payment_checks.and_then(|data| {
- serde_json::from_slice(&data)
- .inspect_err(|e| {
- router_env::logger::warn!(
- deserialization_error=?e,
- "Failed to deserialize payment_checks from UCS connector response"
- );
- })
- .ok()
- }),
- card_network: card_data.card_network,
- domestic_network: card_data.domestic_network,
- // needs to be updated
- auth_code: None,
- })
- }
- Some(payments_grpc::additional_payment_method_connector_response::PaymentMethodData::Upi(_)) => {
- Err(error_stack::Report::new(
- UnifiedConnectorServiceError::NotImplemented(
- "UPI payment method data transformation is not yet implemented".to_string(),
- ),
- ))
+ Some(
+ payments_grpc::additional_payment_method_connector_response::PaymentMethodData::Card(
+ card_data,
+ ),
+ ) => Ok(Self::Card {
+ authentication_data: card_data.authentication_data.and_then(|data| {
+ serde_json::from_slice(data.as_slice())
+ .inspect_err(|e| {
+ router_env::logger::warn!(
+ deserialization_error=?e,
+ "Failed to deserialize authentication_data from UCS connector response"
+ );
+ })
+ .ok()
+ }),
+ payment_checks: card_data.payment_checks.and_then(|data| {
+ serde_json::from_slice(data.as_slice())
+ .inspect_err(|e| {
+ router_env::logger::warn!(
+ deserialization_error=?e,
+ "Failed to deserialize payment_checks from UCS connector response"
+ );
+ })
+ .ok()
+ }),
+ card_network: card_data.card_network,
+ domestic_network: card_data.domestic_network,
+ auth_code: card_data.auth_code,
+ }),
+ Some(
+ payments_grpc::additional_payment_method_connector_response::PaymentMethodData::Upi(
+ _,
+ ),
+ ) => {
+ // Upi variant to be updated during #11019 PR merge
+ Err(UnifiedConnectorServiceError::NotImplemented(
+ "UPI payment method data deserialization".to_string(),
+ )
+ .into())
}
+ Some(
+ payments_grpc::additional_payment_method_connector_response::PaymentMethodData::GooglePay(
+ google_pay_data,
+ ),
+ ) => Ok(Self::GooglePay {
+ auth_code: google_pay_data.auth_code,
+ }),
+ Some(
+ payments_grpc::additional_payment_method_connector_response::PaymentMethodData::ApplePay(
+ apple_pay_data,
+ ),
+ ) => Ok(Self::ApplePay {
+ auth_code: apple_pay_data.auth_code,
+ }),
None => Err(error_stack::Report::new(
UnifiedConnectorServiceError::ResponseDeserializationFailed,
)
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index d94f37fc14..df49487fad 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -88,8 +88,8 @@ reqwest = { version = "0.11.27", features = ["json", "rustls-tls", "gzip", "mult
ring = "0.17.14"
rust_decimal = { version = "1.37.1", features = ["serde-with-float", "serde-with-str"] }
rust-i18n = { git = "https://github.com/kashif-m/rust-i18n", rev = "f2d8096aaaff7a87a847c35a5394c269f75e077a" }
-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "0c0418526daa56bcdd588d010229793834db57cd", package = "rust-grpc-client" }
-unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "0c0418526daa56bcdd588d010229793834db57cd", package = "ucs_cards" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc", package = "rust-grpc-client" }
+unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc", package = "ucs_cards" }
unified-connector-service-masking = { git = "https://github.com/juspay/hyperswitch", tag = "2025.11.24.0", package = "masking" }
rustc-hash = "1.1.0"
rustls = "0.22"
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index e2dd3fea6d..e0cf790868 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -604,6 +604,14 @@ impl
.as_ref()
.map(ConnectorState::foreign_from);
+ let merchant_account_metadata = router_data
+ .connector_meta_data
+ .as_ref()
+ .map(serde_json::to_string)
+ .transpose()
+ .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
+ .map(|s| s.into());
+
Ok(Self {
request_ref_id: Some(Identifier {
id_type: Some(payments_grpc::identifier::IdType::Id(
@@ -615,8 +623,9 @@ impl
metadata: None,
webhook_url: None,
connector_metadata: None,
- merchant_account_metadata: None,
+ merchant_account_metadata,
state,
+ test_mode: router_data.test_mode,
})
}
}
@@ -645,11 +654,20 @@ impl
) -> Result<Self, Self::Error> {
let request_ref_id = router_data.connector_request_reference_id.clone();
let address = payments_grpc::PaymentAddress::foreign_try_from(router_data.address.clone())?;
+
+ let merchant_account_metadata = router_data
+ .connector_meta_data
+ .as_ref()
+ .map(serde_json::to_string)
+ .transpose()
+ .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
+ .map(|s| s.into());
+
Ok(Self {
request_ref_id: Some(Identifier {
id_type: Some(payments_grpc::identifier::IdType::Id(request_ref_id)),
}),
- merchant_account_metadata: None,
+ merchant_account_metadata,
customer_name: router_data
.request
.name
@@ -672,6 +690,7 @@ impl
address: Some(address),
metadata: None,
connector_metadata: None,
+ test_mode: router_data.test_mode,
})
}
}
@@ -801,6 +820,15 @@ impl
>,
) -> Result<Self, Self::Error> {
let currency = payments_grpc::Currency::foreign_try_from(router_data.request.currency)?;
+
+ let merchant_account_metadata = router_data
+ .connector_meta_data
+ .as_ref()
+ .map(serde_json::to_string)
+ .transpose()
+ .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
+ .map(|s| s.into());
+
Ok(Self {
request_ref_id: Some(Identifier {
id_type: Some(payments_grpc::identifier::IdType::Id(
@@ -820,7 +848,8 @@ impl
state: None,
browser_info: None,
connector_metadata: None,
- merchant_account_metadata: None,
+ merchant_account_metadata,
+ test_mode: router_data.test_mode,
})
}
}
@@ -5678,15 +5707,24 @@ impl
) -> Result<Self, Self::Error> {
let request_ref_id = router_data.connector_request_reference_id.clone();
+ let merchant_account_metadata = router_data
+ .connector_meta_data
+ .as_ref()
+ .map(serde_json::to_string)
+ .transpose()
+ .change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
+ .map(|s| s.into());
+
Ok(Self {
request_ref_id: Some(Identifier {
id_type: Some(payments_grpc::identifier::IdType::Id(request_ref_id)),
}),
- merchant_account_metadata: None,
+ merchant_account_metadata,
// depricated field we have to remove this/ Default to unspecified connector
connector: 0_i32,
metadata: None,
connector_metadata: None,
+ test_mode: router_data.test_mode,
})
}
}