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): Fix Capture & Void calls bypass UCS and always route via HS direct (#11009)

Saptak Dutta5b009fdece22
diff --git a/crates/router/src/core/payments/flows/cancel_flow.rs b/crates/router/src/core/payments/flows/cancel_flow.rs
index e5b2f84aab..47124149c1 100644
--- a/crates/router/src/core/payments/flows/cancel_flow.rs
+++ b/crates/router/src/core/payments/flows/cancel_flow.rs
@@ -1,4 +1,5 @@
use async_trait::async_trait;
+use hyperswitch_domain_models::router_data_v2::PaymentFlowData;
use super::{ConstructFlowSpecificData, Feature};
use crate::{
@@ -87,31 +88,23 @@ impl Feature<api::Void, types::PaymentsCancelData>
_business_profile: &domain::Profile,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
return_raw_connector_response: Option<bool>,
- _gateway_context: payments::gateway::context::RouterGatewayContext,
+ gateway_context: payments::gateway::context::RouterGatewayContext,
) -> RouterResult<Self> {
metrics::PAYMENT_CANCEL_COUNT.add(
1,
router_env::metric_attributes!(("connector", connector.connector_name.to_string())),
);
- let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<
- api::Void,
- types::PaymentsCancelData,
- types::PaymentsResponseData,
- > = connector.connector.get_connector_integration();
-
- let resp = services::execute_connector_processing_step(
+ payments::gateway::handle_gateway_call::<_, _, _, PaymentFlowData, _>(
state,
- connector_integration,
- &self,
+ self,
+ connector,
+ &gateway_context,
call_connector_action,
connector_request,
return_raw_connector_response,
)
.await
- .to_payment_failed_response()?;
-
- Ok(resp)
}
async fn add_access_token<'a>(
diff --git a/crates/router/src/core/payments/flows/capture_flow.rs b/crates/router/src/core/payments/flows/capture_flow.rs
index 03197e67a0..a95211e242 100644
--- a/crates/router/src/core/payments/flows/capture_flow.rs
+++ b/crates/router/src/core/payments/flows/capture_flow.rs
@@ -1,4 +1,5 @@
use async_trait::async_trait;
+use hyperswitch_domain_models::router_data_v2::PaymentFlowData;
use super::ConstructFlowSpecificData;
use crate::{
@@ -93,24 +94,19 @@ impl Feature<api::Capture, types::PaymentsCaptureData>
_business_profile: &domain::Profile,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
return_raw_connector_response: Option<bool>,
- _gateway_context: payments::gateway::context::RouterGatewayContext,
+ gateway_context: payments::gateway::context::RouterGatewayContext,
) -> RouterResult<Self> {
- let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<
- api::Capture,
- types::PaymentsCaptureData,
- types::PaymentsResponseData,
- > = connector.connector.get_connector_integration();
-
- let mut new_router_data = services::execute_connector_processing_step(
- state,
- connector_integration,
- &self,
- call_connector_action,
- connector_request,
- return_raw_connector_response,
- )
- .await
- .to_payment_failed_response()?;
+ let mut new_router_data =
+ payments::gateway::handle_gateway_call::<_, _, _, PaymentFlowData, _>(
+ state,
+ self,
+ connector,
+ &gateway_context,
+ call_connector_action,
+ connector_request,
+ return_raw_connector_response,
+ )
+ .await?;
// Initiating Integrity check
let integrity_result = helpers::check_integrity_based_on_flow(