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): PSync Redirection Data in HS <> UCS Integration (#11095)

Shubhodip palccbc3db52e75
diff --git a/Cargo.lock b/Cargo.lock
index 7b5fa05fd2..5c52501075 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=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"
+source = "git+https://github.com/juspay/connector-service?rev=d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0#d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0"
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=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"
+source = "git+https://github.com/juspay/connector-service?rev=d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0#d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0"
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=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"
+source = "git+https://github.com/juspay/connector-service?rev=d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0#d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0"
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=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"
+source = "git+https://github.com/juspay/connector-service?rev=d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0#d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0"
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=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"
+source = "git+https://github.com/juspay/connector-service?rev=d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0#d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0"
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=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"
+source = "git+https://github.com/juspay/connector-service?rev=d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0#d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0"
dependencies = [
"anyhow",
"base64 0.21.7",
diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.toml
index 565ce988aa..39e741270d 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 = "23ae5acea8cfb1f1d35517dc95b7da8d101df5b9", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0", 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 072e86d1c4..4a85ddb588 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 = "23ae5acea8cfb1f1d35517dc95b7da8d101df5b9", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0", 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 68ba76ba42..b66df23cbf 100644
--- a/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs
+++ b/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs
@@ -1,11 +1,13 @@
use common_enums::AttemptStatus;
use common_types::primitive_wrappers::{ExtendedAuthorizationAppliedBool, OvercaptureEnabledBool};
+use common_utils::request::Method;
+use error_stack::ResultExt;
use hyperswitch_domain_models::{
router_data::{
AdditionalPaymentMethodConnectorResponse, ConnectorResponseData, ErrorResponse,
ExtendedAuthorizationResponseData,
},
- router_response_types::PaymentsResponseData,
+ router_response_types::{PaymentsResponseData, RedirectForm},
};
use crate::{helpers::ForeignTryFrom, unified_connector_service::payments_grpc};
@@ -221,14 +223,14 @@ impl ForeignTryFrom<(payments_grpc::PaymentServiceGetResponse, AttemptStatus)>
Err(ErrorResponse {
code: response.error_code().to_owned(),
message: response.error_message().to_owned(),
- reason: Some(response.error_message().to_owned()),
+ reason: Some(response.error_reason().to_owned()),
status_code,
attempt_status,
connector_transaction_id: resource_id.get_optional_response_id(),
connector_response_reference_id,
- network_decline_code: None,
- network_advice_code: None,
- network_error_message: None,
+ network_decline_code: response.network_decline_code.clone(),
+ network_advice_code: response.network_advice_code.clone(),
+ network_error_message: response.network_error_message.clone(),
connector_metadata: None,
})
} else {
@@ -237,7 +239,13 @@ impl ForeignTryFrom<(payments_grpc::PaymentServiceGetResponse, AttemptStatus)>
Ok((
PaymentsResponseData::TransactionResponse {
resource_id,
- redirection_data: Box::new(None),
+ redirection_data: Box::new(
+ response
+ .redirection_data
+ .clone()
+ .map(ForeignTryFrom::foreign_try_from)
+ .transpose()?,
+ ),
mandate_reference: Box::new(response.mandate_reference.map(|grpc_mandate| {
hyperswitch_domain_models::router_response_types::MandateReference {
connector_mandate_id: grpc_mandate.mandate_id,
@@ -620,3 +628,62 @@ impl ForeignTryFrom<payments_grpc::BankNames> for common_enums::BankNames {
}
}
}
+
+impl ForeignTryFrom<payments_grpc::RedirectForm> for RedirectForm {
+ type Error = error_stack::Report<UnifiedConnectorServiceError>;
+
+ fn foreign_try_from(value: payments_grpc::RedirectForm) -> Result<Self, Self::Error> {
+ match value.form_type {
+ Some(payments_grpc::redirect_form::FormType::Form(form)) => Ok(Self::Form {
+ endpoint: form.clone().endpoint,
+ method: Method::foreign_try_from(form.clone().method())?,
+ form_fields: form.clone().form_fields,
+ }),
+ Some(payments_grpc::redirect_form::FormType::Html(html)) => Ok(Self::Html {
+ html_data: html.html_data,
+ }),
+ Some(payments_grpc::redirect_form::FormType::Uri(_)) => Err(
+ UnifiedConnectorServiceError::RequestEncodingFailedWithReason(
+ "URI form type is not implemented".to_string(),
+ )
+ .into(),
+ ),
+ Some(payments_grpc::redirect_form::FormType::Braintree(braintree)) => {
+ Ok(Self::Braintree {
+ client_token: braintree.client_token,
+ card_token: braintree.card_token,
+ bin: braintree.bin,
+ acs_url: braintree.acs_url,
+ })
+ }
+ Some(payments_grpc::redirect_form::FormType::Mifinity(mifinity)) => {
+ Ok(Self::Mifinity {
+ initialization_token: mifinity.initialization_token,
+ })
+ }
+ None => Err(
+ UnifiedConnectorServiceError::RequestEncodingFailedWithReason(
+ "Missing form type".to_string(),
+ )
+ .into(),
+ ),
+ }
+ }
+}
+
+impl ForeignTryFrom<payments_grpc::HttpMethod> for Method {
+ type Error = error_stack::Report<UnifiedConnectorServiceError>;
+
+ fn foreign_try_from(value: payments_grpc::HttpMethod) -> Result<Self, Self::Error> {
+ match value {
+ payments_grpc::HttpMethod::Get => Ok(Self::Get),
+ payments_grpc::HttpMethod::Post => Ok(Self::Post),
+ payments_grpc::HttpMethod::Put => Ok(Self::Put),
+ payments_grpc::HttpMethod::Delete => Ok(Self::Delete),
+ payments_grpc::HttpMethod::Unspecified => {
+ Err(UnifiedConnectorServiceError::ResponseDeserializationFailed)
+ .attach_printable("Invalid Http Method")
+ }
+ }
+ }
+}
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index d0ba2a7157..8f35aac723 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 = "23ae5acea8cfb1f1d35517dc95b7da8d101df5b9", package = "rust-grpc-client" }
-unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "23ae5acea8cfb1f1d35517dc95b7da8d101df5b9", package = "ucs_cards" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0", package = "rust-grpc-client" }
+unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "d1a28bfe75ac219f7a3e5558c3b60fb67a64a5b0", 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 4046cf596b..b7df9546ef 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -12,7 +12,6 @@ use api_models::payments::{
use common_enums::{AttemptStatus, AuthenticationType, AuthorizationStatus, RefundStatus};
use common_utils::{
ext_traits::Encode,
- request::Method,
types::{self, AmountConvertor, MinorUnit, StringMajorUnitForConnector},
};
use diesel_models::enums as storage_enums;
@@ -771,6 +770,7 @@ impl
),
merchant_account_metadata: None,
metadata: None,
+ test_mode: router_data.test_mode,
})
}
}
@@ -1179,6 +1179,7 @@ impl transformers::ForeignTryFrom<&RouterData<Capture, PaymentsCaptureData, Paym
.change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
.map(|s| s.into()),
merchant_account_metadata,
+ test_mode: router_data.test_mode,
})
}
}
@@ -3739,66 +3740,6 @@ impl transformers::ForeignTryFrom<router_request_types::UcsAuthenticationData>
}
}
-impl transformers::ForeignTryFrom<payments_grpc::RedirectForm> for RedirectForm {
- type Error = error_stack::Report<UnifiedConnectorServiceError>;
-
- fn foreign_try_from(value: payments_grpc::RedirectForm) -> Result<Self, Self::Error> {
- match value.form_type {
- Some(payments_grpc::redirect_form::FormType::Form(form)) => Ok(Self::Form {
- endpoint: form.clone().endpoint,
- method: Method::foreign_try_from(form.clone().method())?,
- form_fields: form.clone().form_fields,
- }),
- Some(payments_grpc::redirect_form::FormType::Html(html)) => Ok(Self::Html {
- html_data: html.html_data,
- }),
- Some(payments_grpc::redirect_form::FormType::Uri(_)) => Err(
- UnifiedConnectorServiceError::RequestEncodingFailedWithReason(
- "URI form type is not implemented".to_string(),
- )
- .into(),
- ),
- Some(payments_grpc::redirect_form::FormType::Braintree(braintree)) => {
- Ok(Self::Braintree {
- client_token: braintree.client_token,
- card_token: braintree.card_token,
- bin: braintree.bin,
- acs_url: braintree.acs_url,
- })
- }
- Some(payments_grpc::redirect_form::FormType::Mifinity(mifinity)) => {
- Ok(Self::Mifinity {
- initialization_token: mifinity.initialization_token,
- })
- }
- None => Err(
- UnifiedConnectorServiceError::RequestEncodingFailedWithReason(
- "Missing form type".to_string(),
- )
- .into(),
- ),
- }
- }
-}
-
-impl transformers::ForeignTryFrom<payments_grpc::HttpMethod> for Method {
- type Error = error_stack::Report<UnifiedConnectorServiceError>;
-
- fn foreign_try_from(value: payments_grpc::HttpMethod) -> Result<Self, Self::Error> {
- tracing::debug!("Converting gRPC HttpMethod: {:?}", value);
- match value {
- payments_grpc::HttpMethod::Get => Ok(Self::Get),
- payments_grpc::HttpMethod::Post => Ok(Self::Post),
- payments_grpc::HttpMethod::Put => Ok(Self::Put),
- payments_grpc::HttpMethod::Delete => Ok(Self::Delete),
- payments_grpc::HttpMethod::Unspecified => {
- Err(UnifiedConnectorServiceError::ResponseDeserializationFailed)
- .attach_printable("Invalid Http Method")
- }
- }
- }
-}
-
impl transformers::ForeignTryFrom<storage_enums::FutureUsage> for payments_grpc::FutureUsage {
type Error = error_stack::Report<UnifiedConnectorServiceError>;
@@ -5579,6 +5520,7 @@ impl transformers::ForeignTryFrom<&RouterData<api::Void, PaymentsCancelData, Pay
.change_context(UnifiedConnectorServiceError::RequestEncodingFailed)?
.map(|s| s.into()),
merchant_account_metadata,
+ test_mode: router_data.test_mode,
})
}
}