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: implement is_pre_authentication_flow_required function for nmi (#10692)

Hrithikesha738f7e5c788
diff --git a/crates/hyperswitch_connectors/src/connectors/nmi.rs b/crates/hyperswitch_connectors/src/connectors/nmi.rs
index d55fd5df7b..1e9ff53410 100644
--- a/crates/hyperswitch_connectors/src/connectors/nmi.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nmi.rs
@@ -1184,6 +1184,15 @@ static NMI_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] =
[enums::EventClass::Payments, enums::EventClass::Refunds];
impl ConnectorSpecifications for Nmi {
+ fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {
+ match current_flow {
+ api::CurrentFlowInfo::Authorize {
+ request_data: _,
+ auth_type,
+ } => *auth_type == enums::AuthenticationType::ThreeDs,
+ api::CurrentFlowInfo::CompleteAuthorize { .. } => false,
+ }
+ }
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
Some(&NMI_CONNECTOR_INFO)
}
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index 056ca59465..2485b99bbf 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -723,7 +723,7 @@ impl TryFrom<CompleteAuthorizeData> for PaymentsPostAuthenticateData {
email: data.email,
currency: Some(data.currency),
browser_info: data.browser_info,
- connector_transaction_id: None,
+ connector_transaction_id: data.connector_transaction_id,
redirect_response: data.redirect_response,
})
}
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index bb3ebbba58..2d3ee0b4f7 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -4184,9 +4184,16 @@ where
.preprocessing_flow_config
.as_ref()
.is_some_and(|config| {
+ // If authentication flow is bloated up for the current connector
+ // and external 3ds was not attempted,
+ // continue with authentication flows.
config
.authentication_bloated_connectors
.contains(&connector.connector_name)
+ && payment_data
+ .get_payment_attempt()
+ .external_three_ds_authentication_attempted
+ != Some(true)
}) {
logger::info!(
"Using granular authentication steps for connector: {}",