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(UCS): bugs related to UCS granular flow (#10525)

Hrithikeshdfa4954cd9e8
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 78eeec3f4e..5d560e754b 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -2501,6 +2501,16 @@ pub enum ExecutionPath {
ShadowUnifiedConnectorService,
}
+impl ExecutionPath {
+ /// Checks if the execution path is through Direct Gateway (Hyperswitch Direct)
+ pub fn is_direct_gateway(&self) -> bool {
+ match self {
+ Self::Direct | Self::ShadowUnifiedConnectorService => true,
+ Self::UnifiedConnectorService => false,
+ }
+ }
+}
+
#[derive(
Clone,
Copy,
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 82edba0806..23eb59afe2 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -4197,10 +4197,18 @@ where
// In case of authorize flow, pre-task and post-tasks are being called in build request
// if we do not want to proceed further, then the function will return Ok(None, false)
let (connector_request, should_continue_further) = if should_continue_further {
- // Check if the actual flow specific request can be built with available data
- router_data
- .build_flow_specific_connector_request(state, &connector, call_connector_action.clone())
- .await?
+ // Check if the actual flow specific request can be built with available data only for direct gateway
+ if context.execution_path.is_direct_gateway() {
+ router_data
+ .build_flow_specific_connector_request(
+ state,
+ &connector,
+ call_connector_action.clone(),
+ )
+ .await?
+ } else {
+ (None, should_continue_further)
+ }
} else {
(None, false)
};
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index dd7370ba25..4ff0da8496 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -299,7 +299,7 @@ impl
.map(|e| e.expose().expose().into()),
browser_info,
- session_token: None,
+ session_token: router_data.session_token.clone(),
order_tax_amount: router_data
.request
.order_tax_amount