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(ucs): Bumped UCS Client dependency to bring latest changes (#11229)

Saptak Dutta9ae4bb6ae506
diff --git a/Cargo.lock b/Cargo.lock
index b3a3b1a68f..b8868318c8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2183,7 +2183,7 @@ dependencies = [
[[package]]
name = "config_patch_derive"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
+source = "git+https://github.com/juspay/connector-service?rev=425566c6060cff496b7fcf03d6d4ba36ed3bdf64#425566c6060cff496b7fcf03d6d4ba36ed3bdf64"
dependencies = [
"proc-macro2",
"quote",
@@ -3854,7 +3854,7 @@ dependencies = [
[[package]]
name = "grpc-api-types"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
+source = "git+https://github.com/juspay/connector-service?rev=425566c6060cff496b7fcf03d6d4ba36ed3bdf64#425566c6060cff496b7fcf03d6d4ba36ed3bdf64"
dependencies = [
"axum 0.8.4",
"error-stack 0.5.0",
@@ -7561,7 +7561,7 @@ dependencies = [
[[package]]
name = "rust-grpc-client"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
+source = "git+https://github.com/juspay/connector-service?rev=425566c6060cff496b7fcf03d6d4ba36ed3bdf64#425566c6060cff496b7fcf03d6d4ba36ed3bdf64"
dependencies = [
"grpc-api-types",
]
@@ -10362,7 +10362,7 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]]
name = "ucs_cards"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
+source = "git+https://github.com/juspay/connector-service?rev=425566c6060cff496b7fcf03d6d4ba36ed3bdf64#425566c6060cff496b7fcf03d6d4ba36ed3bdf64"
dependencies = [
"bytes 1.10.1",
"error-stack 0.4.1",
@@ -10378,7 +10378,7 @@ dependencies = [
[[package]]
name = "ucs_common_enums"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
+source = "git+https://github.com/juspay/connector-service?rev=425566c6060cff496b7fcf03d6d4ba36ed3bdf64#425566c6060cff496b7fcf03d6d4ba36ed3bdf64"
dependencies = [
"serde",
"strum 0.26.3",
@@ -10389,7 +10389,7 @@ dependencies = [
[[package]]
name = "ucs_common_utils"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc#d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc"
+source = "git+https://github.com/juspay/connector-service?rev=425566c6060cff496b7fcf03d6d4ba36ed3bdf64#425566c6060cff496b7fcf03d6d4ba36ed3bdf64"
dependencies = [
"anyhow",
"base64 0.21.7",
diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.toml
index 4fe0c2188f..313709761e 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 = "d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "425566c6060cff496b7fcf03d6d4ba36ed3bdf64", package = "rust-grpc-client" }
open-feature = { version = "0.2.5", optional = true }
superposition_provider = { version = "0.97.0", optional = true }
diff --git a/crates/hyperswitch_interfaces/Cargo.toml b/crates/hyperswitch_interfaces/Cargo.toml
index 9f5858711d..726552f613 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 = "d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "425566c6060cff496b7fcf03d6d4ba36ed3bdf64", 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/router/Cargo.toml b/crates/router/Cargo.toml
index 5f0ff361fd..e4188a2ad9 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -90,8 +90,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 = "d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc", package = "rust-grpc-client" }
-unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "d4b923ce29c4c48cd9eb87682010ca7f5dee0ddc", package = "ucs_cards" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "425566c6060cff496b7fcf03d6d4ba36ed3bdf64", package = "rust-grpc-client" }
+unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "425566c6060cff496b7fcf03d6d4ba36ed3bdf64", 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/payments/gateway/psync_gateway.rs b/crates/router/src/core/payments/gateway/psync_gateway.rs
index 07d6b06919..6cc417b5ee 100644
--- a/crates/router/src/core/payments/gateway/psync_gateway.rs
+++ b/crates/router/src/core/payments/gateway/psync_gateway.rs
@@ -68,7 +68,6 @@ where
let connector_enum = common_enums::connector_enums::Connector::from_str(&connector_name)
.change_context(ConnectorError::InvalidConnectorName)?;
let merchant_connector_account = context.merchant_connector_account;
- let creds_identifier = context.creds_identifier;
let processor = &context.processor;
let lineage_ids = context.lineage_ids;
let header_payload = context.header_payload;
@@ -105,8 +104,6 @@ where
.change_context(ConnectorError::RequestEncodingFailed)
.attach_printable("Failed to construct Payment Get Request")?;
- let merchant_connector_id = merchant_connector_account.get_mca_id();
-
let connector_auth_metadata =
unified_connector_service::build_unified_connector_service_auth_metadata(
merchant_connector_account,
@@ -136,7 +133,7 @@ where
.merchant_reference_id(merchant_reference_id)
.resource_id(resource_id)
.lineage_ids(lineage_ids);
- let connector_name = router_data.connector.clone();
+
Box::pin(unified_connector_service::ucs_logging_wrapper_granular(
router_data.clone(),
state,
@@ -158,37 +155,6 @@ where
)
.attach_printable("Failed to deserialize UCS response")?;
- // Extract and store access token if present
- if let Some(access_token) =
- unified_connector_service::get_access_token_from_ucs_response(
- state,
- processor,
- &connector_name,
- merchant_connector_id.as_ref(),
- creds_identifier.clone(),
- payment_get_response.state.as_ref(),
- )
- .await
- {
- if let Err(error) = unified_connector_service::set_access_token_for_ucs(
- state,
- processor,
- &connector_name,
- access_token,
- merchant_connector_id.as_ref(),
- creds_identifier,
- )
- .await
- {
- logger::error!(
- ?error,
- "Failed to store UCS access token from psync response"
- );
- } else {
- logger::debug!("Successfully stored access token from UCS psync response");
- }
- }
-
let router_data_response = match router_data_response {
Ok((response, status)) => {
router_data.status = status;
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index 9d52451c63..e111abc8c3 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -79,10 +79,11 @@ pub async fn get_access_token_from_ucs_response(
merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,
creds_identifier: Option<String>,
ucs_state: Option<&unified_connector_service_client::payments::ConnectorState>,
-) -> Option<AccessToken> {
+) -> CustomResult<Option<AccessToken>, UnifiedConnectorServiceError> {
let ucs_access_token = ucs_state
.and_then(|state| state.access_token.as_ref())
- .map(AccessToken::foreign_from)?;
+ .map(AccessToken::foreign_try_from)
+ .transpose()?;
let merchant_id = processor.get_account().get_id();
@@ -97,12 +98,14 @@ pub async fn get_access_token_from_ucs_response(
);
if let Ok(Some(cached_token)) = session_state.store.get_access_token(key).await {
- if cached_token.token.peek() == ucs_access_token.token.peek() {
- return None;
+ if let Some(ref ucs_token) = ucs_access_token {
+ if cached_token.token.peek() == ucs_token.token.peek() {
+ return Ok(None);
+ }
}
}
- Some(ucs_access_token)
+ Ok(ucs_access_token)
}
pub async fn set_access_token_for_ucs(
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index 4cbf635e2d..d80ca922de 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -84,12 +84,22 @@ pub fn build_upi_wait_screen_data(
.attach_printable("Failed to serialize WaitScreenInstructions to JSON value")
}
-impl ForeignFrom<&payments_grpc::AccessToken> for AccessToken {
- fn foreign_from(grpc_token: &payments_grpc::AccessToken) -> Self {
- Self {
- token: Secret::new(grpc_token.token.clone()),
+impl transformers::ForeignTryFrom<&payments_grpc::AccessToken> for AccessToken {
+ type Error = error_stack::Report<UnifiedConnectorServiceError>;
+
+ fn foreign_try_from(grpc_token: &payments_grpc::AccessToken) -> Result<Self, Self::Error> {
+ let token = grpc_token
+ .token
+ .clone()
+ .ok_or(UnifiedConnectorServiceError::MissingRequiredField {
+ field_name: "token",
+ })
+ .attach_printable("Missing token in AccessToken response")?;
+
+ Ok(Self {
+ token: token.expose().into(),
expires: grpc_token.expires_in_seconds.unwrap_or_default(),
- }
+ })
}
}
@@ -97,7 +107,7 @@ impl ForeignFrom<&AccessToken> for ConnectorState {
fn foreign_from(access_token: &AccessToken) -> Self {
Self {
access_token: Some(payments_grpc::AccessToken {
- token: access_token.token.peek().to_string(),
+ token: Some(access_token.token.clone().expose().into()),
expires_in_seconds: Some(access_token.expires),
token_type: None,
}),
@@ -798,10 +808,30 @@ impl
merchant_account_metadata,
metadata: None,
test_mode: router_data.test_mode,
+ payment_experience: router_data
+ .request
+ .payment_experience
+ .map(payments_grpc::PaymentExperience::foreign_from)
+ .map(Into::into),
})
}
}
+impl ForeignFrom<common_enums::PaymentExperience> for payments_grpc::PaymentExperience {
+ fn foreign_from(tokenization: common_enums::PaymentExperience) -> Self {
+ match tokenization {
+ common_enums::PaymentExperience::RedirectToUrl => Self::RedirectToUrl,
+ common_enums::PaymentExperience::InvokeSdkClient => Self::InvokeSdkClient,
+ common_enums::PaymentExperience::DisplayQrCode => Self::DisplayQrCode,
+ common_enums::PaymentExperience::OneClick => Self::OneClick,
+ common_enums::PaymentExperience::LinkWallet => Self::LinkWallet,
+ common_enums::PaymentExperience::InvokePaymentApp => Self::InvokePaymentApp,
+ common_enums::PaymentExperience::DisplayWaitScreen => Self::DisplayWaitScreen,
+ common_enums::PaymentExperience::CollectOtp => Self::CollectOtp,
+ }
+ }
+}
+
impl
transformers::ForeignTryFrom<
&RouterData<
@@ -2898,8 +2928,15 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceCreateAccessToken
connector_metadata: None,
})
} else {
+ let token = response
+ .access_token
+ .ok_or(UnifiedConnectorServiceError::MissingRequiredField {
+ field_name: "access_token",
+ })
+ .attach_printable("Missing access_token in CreateAccessToken response")?;
+
Ok(AccessToken {
- token: Secret::new(response.access_token),
+ token: token.expose().into(),
expires: response.expires_in_seconds.unwrap_or_default(),
})
};