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): send webhook connector header on ParseEvent (#15270)

Amitsingh Tanwar0dae1c780db7
diff --git a/crates/external_services/src/grpc_client/unified_connector_service.rs b/crates/external_services/src/grpc_client/unified_connector_service.rs
index 2d116045f4..f774348543 100644
--- a/crates/external_services/src/grpc_client/unified_connector_service.rs
+++ b/crates/external_services/src/grpc_client/unified_connector_service.rs
@@ -1099,6 +1099,7 @@ impl UnifiedConnectorServiceClient {
/// `WebhookEventType`, without requiring credentials or making any outbound connector
/// call. The caller uses the returned reference to resolve the merchant-connector
/// account (and thus the webhook secret) before invoking `incoming_webhook_handle_event`.
+ /// Sends `x-webhook-connector` as provider identity alongside the legacy connector metadata.
pub async fn incoming_webhook_parse_event(
&self,
incoming_webhook_parse_event_request: payments_grpc::EventServiceParseRequest,
@@ -1109,8 +1110,14 @@ impl UnifiedConnectorServiceClient {
let mut request = tonic::Request::new(incoming_webhook_parse_event_request);
let connector_name = connector_auth_metadata.connector_name.clone();
- let metadata =
+ let mut metadata =
build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
+ let webhook_connector = connector_name.parse::<MetadataValue<_>>().change_context(
+ UnifiedConnectorServiceError::HeaderInjectionFailed(
+ consts::UCS_HEADER_WEBHOOK_CONNECTOR.to_string(),
+ ),
+ )?;
+ metadata.insert(consts::UCS_HEADER_WEBHOOK_CONNECTOR, webhook_connector);
*request.metadata_mut() = metadata;
self.event_service_client
diff --git a/crates/external_services/src/lib.rs b/crates/external_services/src/lib.rs
index 3167e012b5..72fb7475e3 100644
--- a/crates/external_services/src/lib.rs
+++ b/crates/external_services/src/lib.rs
@@ -102,6 +102,9 @@ pub mod consts {
/// Header key used to specify the connector name in UCS requests.
pub(crate) const UCS_HEADER_CONNECTOR: &str = "x-connector";
+ /// Provider identity for UCS webhook event parsing, independent of the resource family.
+ pub(crate) const UCS_HEADER_WEBHOOK_CONNECTOR: &str = "x-webhook-connector";
+
/// Header key used to specify the payout connector name in UCS requests.
pub(crate) const UCS_HEADER_PAYOUT_CONNECTOR: &str = "x-payout-connector";