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

fix: Corrected the mapping of metadata fields in HS<>UCS tunnel (#10626)

Amitsingh Tanward104ce9f7829
diff --git a/Cargo.lock b/Cargo.lock
index 98e195dea0..2dbc15025d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3791,7 +3791,7 @@ dependencies = [
[[package]]
name = "grpc-api-types"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=f43fbfdb01f6d3086e4ed7f258369daceaf86518#f43fbfdb01f6d3086e4ed7f258369daceaf86518"
+source = "git+https://github.com/juspay/connector-service?rev=0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6#0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6"
dependencies = [
"axum 0.8.4",
"error-stack 0.5.0",
@@ -7450,7 +7450,7 @@ dependencies = [
[[package]]
name = "rust-grpc-client"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=f43fbfdb01f6d3086e4ed7f258369daceaf86518#f43fbfdb01f6d3086e4ed7f258369daceaf86518"
+source = "git+https://github.com/juspay/connector-service?rev=0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6#0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6"
dependencies = [
"grpc-api-types",
]
@@ -10240,7 +10240,7 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]]
name = "ucs_cards"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=f43fbfdb01f6d3086e4ed7f258369daceaf86518#f43fbfdb01f6d3086e4ed7f258369daceaf86518"
+source = "git+https://github.com/juspay/connector-service?rev=0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6#0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6"
dependencies = [
"bytes 1.10.1",
"error-stack 0.4.1",
@@ -10256,7 +10256,7 @@ dependencies = [
[[package]]
name = "ucs_common_enums"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=f43fbfdb01f6d3086e4ed7f258369daceaf86518#f43fbfdb01f6d3086e4ed7f258369daceaf86518"
+source = "git+https://github.com/juspay/connector-service?rev=0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6#0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6"
dependencies = [
"serde",
"strum 0.26.3",
@@ -10267,7 +10267,7 @@ dependencies = [
[[package]]
name = "ucs_common_utils"
version = "0.1.0"
-source = "git+https://github.com/juspay/connector-service?rev=f43fbfdb01f6d3086e4ed7f258369daceaf86518#f43fbfdb01f6d3086e4ed7f258369daceaf86518"
+source = "git+https://github.com/juspay/connector-service?rev=0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6#0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6"
dependencies = [
"anyhow",
"base64 0.21.7",
diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.toml
index 9b056c66e7..1af0477d73 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 = "f43fbfdb01f6d3086e4ed7f258369daceaf86518", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6", 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 112a98fbda..d3865b2da5 100644
--- a/crates/hyperswitch_interfaces/Cargo.toml
+++ b/crates/hyperswitch_interfaces/Cargo.toml
@@ -29,7 +29,7 @@ serde_json = "1.0.140"
strum = { version = "0.26", features = ["derive"] }
thiserror = "1.0.69"
time = "0.3.41"
-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "f43fbfdb01f6d3086e4ed7f258369daceaf86518", package = "rust-grpc-client" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6", 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"] }
# First party crates
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 65ee817509..5d5cfb9784 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -89,8 +89,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 = "f43fbfdb01f6d3086e4ed7f258369daceaf86518", package = "rust-grpc-client" }
-unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "f43fbfdb01f6d3086e4ed7f258369daceaf86518", package = "ucs_cards" }
+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6", package = "rust-grpc-client" }
+unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "0f0dd5f23b19161f7ecef29f09d0022a3d86e3c6", 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/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
index bfaaccebc7..d64ecc3e25 100644
--- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs
+++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
@@ -325,15 +325,14 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
payment_register_request,
header_payload,
|mut router_data, payment_register_request, grpc_headers| async move {
- let response = client
- .payment_setup_mandate(
- payment_register_request,
- connector_auth_metadata,
- grpc_headers,
- )
- .await
- .change_context(ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to Setup Mandate payment")?;
+ let response = Box::pin(client.payment_setup_mandate(
+ payment_register_request,
+ connector_auth_metadata,
+ grpc_headers,
+ ))
+ .await
+ .change_context(ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to Setup Mandate payment")?;
let payment_register_response = response.into_inner();
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index a7eb0c3663..6b28ab15c4 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -204,6 +204,8 @@ impl
customer_id: None,
address: None,
metadata: HashMap::new(),
+ connector_metadata: HashMap::new(),
+ return_url: None,
})
}
}
@@ -294,10 +296,11 @@ impl
.map(ConnectorState::foreign_from);
Ok(Self {
- order_id: router_data.request.order_id.clone(),
+ connector_order_reference_id: router_data.request.order_id.clone(),
amount: router_data.request.amount,
currency: currency.into(),
payment_method,
+ billing_descriptor: None,
return_url: router_data.request.router_return_url.clone(),
address: Some(address),
auth_type: auth_type.into(),
@@ -379,6 +382,9 @@ impl
.as_ref()
.and_then(|descriptor| descriptor.statement_descriptor_suffix.clone()),
order_details: vec![],
+ connector_metadata: HashMap::new(),
+ enable_partial_authorization: None,
+ payment_channel: None,
})
}
}
@@ -482,7 +488,7 @@ impl
.map(ConnectorState::foreign_from);
Ok(Self {
- order_id: None,
+ connector_order_reference_id: None,
amount: router_data.request.amount,
currency: currency.into(),
payment_method,
@@ -542,6 +548,10 @@ impl
statement_descriptor_name: None,
statement_descriptor_suffix: None,
order_details: vec![],
+ connector_metadata: HashMap::new(),
+ enable_partial_authorization: None,
+ payment_channel: None,
+ billing_descriptor: None,
})
}
}
@@ -581,6 +591,8 @@ impl
currency: currency.into(),
metadata: HashMap::new(),
webhook_url: None,
+ connector_metadata: HashMap::new(),
+ merchant_account_metadata: HashMap::new(),
state,
})
}
@@ -636,6 +648,7 @@ impl
.map(|phone| phone.peek().to_string()),
address: Some(address),
metadata: HashMap::new(),
+ connector_metadata: HashMap::new(),
})
}
}
@@ -715,6 +728,11 @@ impl
amount: router_data.request.amount.get_amount_as_i64(),
currency: currency.into(),
state,
+ connector_metadata: None,
+ merchant_account_metadata: HashMap::new(),
+ metadata: HashMap::new(),
+ setup_future_usage: None,
+ sync_type: None,
})
}
}
@@ -755,6 +773,8 @@ impl
metadata: HashMap::new(),
state: None,
browser_info: None,
+ connector_metadata: HashMap::new(),
+ merchant_account_metadata: HashMap::new(),
})
}
}
@@ -840,6 +860,7 @@ impl
.clone()
.map(payments_grpc::BrowserInformation::foreign_try_from)
.transpose()?,
+ connector_metadata: HashMap::new(),
})
}
}
@@ -925,6 +946,8 @@ impl
.clone()
.map(payments_grpc::BrowserInformation::foreign_try_from)
.transpose()?,
+ connector_metadata: HashMap::new(),
+ connector_order_reference_id: None,
})
}
}
@@ -1004,6 +1027,7 @@ impl
.clone()
.map(payments_grpc::BrowserInformation::foreign_try_from)
.transpose()?,
+ connector_metadata: HashMap::new(),
})
}
}
@@ -1066,7 +1090,7 @@ impl transformers::ForeignTryFrom<&RouterData<Capture, PaymentsCaptureData, Paym
.get_amount_as_i64(),
currency: currency.into(),
capture_method: capture_method.map(|capture_method| capture_method.into()),
- connector_metadata: router_data
+ metadata: router_data
.request
.metadata
.as_ref()
@@ -1081,6 +1105,7 @@ impl transformers::ForeignTryFrom<&RouterData<Capture, PaymentsCaptureData, Paym
},
),
state,
+ connector_metadata: HashMap::new(),
merchant_account_metadata,
})
}
@@ -1159,6 +1184,7 @@ impl
Ok(Self {
amount: router_data.request.amount,
currency: currency.into(),
+ billing_descriptor: None,
payment_method,
return_url: router_data.request.complete_authorize_url.clone(),
address: Some(address),
@@ -1213,6 +1239,10 @@ impl
statement_descriptor_name: None,
statement_descriptor_suffix: None,
order_details: vec![],
+ connector_metadata: HashMap::new(),
+ connector_order_reference_id: Some(router_data.connector_request_reference_id.clone()),
+ enable_partial_authorization: None,
+ payment_channel: None,
})
}
}
@@ -1293,6 +1323,7 @@ impl
Ok(Self {
amount: router_data.request.amount,
currency: currency.into(),
+ billing_descriptor: None,
payment_method,
return_url: router_data.request.router_return_url.clone(),
address: Some(address),
@@ -1370,6 +1401,10 @@ impl
.as_ref()
.and_then(|descriptor| descriptor.statement_descriptor_suffix.clone()),
order_details: vec![],
+ connector_metadata: HashMap::new(),
+ connector_order_reference_id: router_data.request.order_id.clone(),
+ enable_partial_authorization: None,
+ payment_channel: None,
})
}
}
@@ -1437,6 +1472,7 @@ impl
Ok(Self {
amount: router_data.request.amount,
currency: currency.into(),
+ billing_descriptor: None,
payment_method,
return_url: router_data.request.router_return_url.clone(),
address: Some(address),
@@ -1452,7 +1488,6 @@ impl
.clone()
.map(|e| e.expose().expose().into()),
browser_info,
-
session_token: None,
order_tax_amount: router_data
.request
@@ -1523,6 +1558,10 @@ impl
statement_descriptor_name: router_data.request.statement_descriptor.clone(),
statement_descriptor_suffix: router_data.request.statement_descriptor_suffix.clone(),
order_details: vec![],
+ connector_metadata: HashMap::new(),
+ connector_order_reference_id: router_data.request.order_id.clone(),
+ enable_partial_authorization: None,
+ payment_channel: None,
})
}
}
@@ -1588,6 +1627,7 @@ impl
hyperswitch_domain_models::router_data::PaymentMethodToken::PazeDecrypt(_) => None
}
}),
+ billing_descriptor: None,
request_ref_id: Some(Identifier {
id_type: Some(payments_grpc::identifier::IdType::Id(
router_data.connector_request_reference_id.clone(),
@@ -1642,7 +1682,6 @@ impl
request_extended_authorization: None,
customer_acceptance,
browser_info,
- order_id: None,
payment_experience: None,
merchant_account_metadata: router_data
.connector_meta_data
@@ -1652,6 +1691,10 @@ impl
.unwrap_or_default(),
connector_customer_id: router_data.connector_customer.clone(),
state,
+ order_id: None,
+ connector_metadata: HashMap::new(),
+ enable_partial_authorization: None,
+ payment_channel: None,
})
}
}
@@ -1694,6 +1737,7 @@ impl
)) => Some(payments_grpc::MandateReference {
mandate_id: connector_mandate_id.get_connector_mandate_id(),
payment_method_id: connector_mandate_id.get_payment_method_id(),
+ connector_mandate_request_reference_id: None,
}),
_ => {
return Err(UnifiedConnectorServiceError::MissingRequiredField {
@@ -1722,6 +1766,7 @@ impl
)),
}),
mandate_reference,
+ shipping_cost: None,
amount: router_data.request.amount,
currency: currency.into(),
minor_amount: router_data.request.amount,
@@ -1756,6 +1801,10 @@ impl
address: Some(address),
off_session: router_data.request.off_session,
recurring_mandate_payment_data: None,
+ connector_metadata: HashMap::new(),
+ enable_partial_authorization: None,
+ billing_descriptor: None,
+ mit_category: None,
})
}
}
@@ -1814,6 +1863,8 @@ impl transformers::ForeignTryFrom<&RouterData<Session, PaymentsSessionData, Paym
.map(payments_grpc::PaymentMethodType::foreign_try_from)
.transpose()?
.map(|payment_method_type| payment_method_type.into()),
+ metadata: HashMap::new(),
+ connector_metadata: HashMap::new(),
})
}
}
@@ -4244,7 +4295,7 @@ impl transformers::ForeignTryFrom<&RouterData<Execute, RefundsData, RefundsRespo
});
// Convert connector_metadata to gRPC format
- let metadata = router_data
+ let connector_metadata = router_data
.request
.connector_metadata
.as_ref()
@@ -4304,7 +4355,7 @@ impl transformers::ForeignTryFrom<&RouterData<Execute, RefundsData, RefundsRespo
)
})?
.map(i32::from),
- metadata,
+ connector_metadata,
refund_metadata,
browser_info: router_data
.request
@@ -4319,6 +4370,8 @@ impl transformers::ForeignTryFrom<&RouterData<Execute, RefundsData, RefundsRespo
})?,
state,
merchant_account_metadata,
+ metadata: HashMap::new(),
+ payment_method_type: None,
test_mode: router_data.test_mode,
})
}
@@ -4390,6 +4443,7 @@ impl transformers::ForeignTryFrom<&RouterData<RSync, RefundsData, RefundsRespons
.map(|metadata| convert_value_map_to_hashmap(&metadata.clone().expose()))
.transpose()?
.unwrap_or_default(),
+ payment_method_type: None,
test_mode: router_data.test_mode,
})
}
@@ -4500,7 +4554,7 @@ impl transformers::ForeignTryFrom<&RouterData<api::Void, PaymentsCancelData, Pay
browser_info,
amount: router_data.request.amount,
currency: currency.map(|c| c.into()),
- connector_metadata: router_data
+ metadata: router_data
.request
.metadata
.as_ref()
@@ -4508,6 +4562,7 @@ impl transformers::ForeignTryFrom<&RouterData<api::Void, PaymentsCancelData, Pay
.transpose()?
.unwrap_or_default(),
state,
+ connector_metadata: HashMap::new(),
merchant_account_metadata,
})
}
@@ -4671,6 +4726,8 @@ impl
merchant_account_metadata: HashMap::new(),
// depricated field we have to remove this/ Default to unspecified connector
connector: 0_i32,
+ connector_metadata: HashMap::new(),
+ metadata: HashMap::new(),
})
}
}