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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(connector): Fix PreAuth Conditions in NMI, Nuvei and Redsys (#11041)
Anuragbde0ba78cdfa
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay.rsindex 19f298228e..1629d052e7 100644--- a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs@@ -1242,16 +1242,8 @@ impl ConnectorSpecifications for Nexixpay {fn is_post_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {match current_flow {api::CurrentFlowInfo::Authorize { .. } => false,- api::CurrentFlowInfo::CompleteAuthorize {- request_data,- payment_method,- } => {+ api::CurrentFlowInfo::CompleteAuthorize { payment_method, .. } => {payment_method == Some(enums::PaymentMethod::Card)- && request_data- .redirect_response- .as_ref()- .and_then(|redirect_response| redirect_response.payload.as_ref())- .is_some()}api::CurrentFlowInfo::SetupMandate { .. } => false,}diff --git a/crates/hyperswitch_connectors/src/connectors/nmi.rs b/crates/hyperswitch_connectors/src/connectors/nmi.rsindex b1a334f934..c484b610a3 100644--- a/crates/hyperswitch_connectors/src/connectors/nmi.rs+++ b/crates/hyperswitch_connectors/src/connectors/nmi.rs@@ -56,7 +56,7 @@ use transformers as nmi;use crate::{types::ResponseRouterData,- utils::{self, convert_amount, get_header_key_value},+ utils::{self, convert_amount, get_header_key_value, PaymentsAuthorizeRequestData},};#[derive(Clone)]@@ -1194,9 +1194,9 @@ 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,+ request_data,+ } => auth_type.is_three_ds() && request_data.is_card(),api::CurrentFlowInfo::CompleteAuthorize { .. } => false,api::CurrentFlowInfo::SetupMandate { auth_type, .. } => {*auth_type == enums::AuthenticationType::ThreeDsdiff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rsindex 5b22df4b05..26189e0ef7 100644--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs+++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs@@ -71,7 +71,10 @@ use crate::{connectors::nuvei::transformers::{NuveiPaymentsResponse, NuveiTransactionSyncResponse},constants::headers,types::ResponseRouterData,- utils::{self, is_mandate_supported, PaymentMethodDataType, RouterData as _},+ utils::{+ self, is_mandate_supported, PaymentMethodDataType, PaymentsAuthorizeRequestData,+ RouterData as _,+ },};#[derive(Clone)]@@ -1695,8 +1698,8 @@ impl ConnectorSpecifications for Nuvei {match current_flow {api::CurrentFlowInfo::Authorize {auth_type,- request_data: _,- } => *auth_type == enums::AuthenticationType::ThreeDs,+ request_data,+ } => auth_type.is_three_ds() && request_data.is_card(),api::CurrentFlowInfo::CompleteAuthorize { .. } => false,api::CurrentFlowInfo::SetupMandate { auth_type, .. } => {*auth_type == enums::AuthenticationType::ThreeDsdiff --git a/crates/hyperswitch_connectors/src/connectors/redsys.rs b/crates/hyperswitch_connectors/src/connectors/redsys.rsindex 9a9a78b137..0065a46093 100644--- a/crates/hyperswitch_connectors/src/connectors/redsys.rs+++ b/crates/hyperswitch_connectors/src/connectors/redsys.rs@@ -53,8 +53,10 @@ use hyperswitch_interfaces::{use transformers as redsys;use crate::{- constants::headers, types::ResponseRouterData, utils as connector_utils,- utils::PaymentsPreAuthenticateRequestData,+ constants::headers,+ types::ResponseRouterData,+ utils as connector_utils,+ utils::{PaymentsAuthorizeRequestData, PaymentsPreAuthenticateRequestData},};#[derive(Clone)]@@ -975,9 +977,10 @@ static REDSYS_SUPPORTED_WEBHOOK_FLOWS: [common_enums::EventClass; 0] = [];impl ConnectorSpecifications for Redsys {fn is_pre_authentication_flow_required(&self, current_flow: api::CurrentFlowInfo<'_>) -> bool {match current_flow {- api::CurrentFlowInfo::Authorize { auth_type, .. } => {- *auth_type == common_enums::AuthenticationType::ThreeDs- }+ api::CurrentFlowInfo::Authorize {+ auth_type,+ request_data,+ } => auth_type.is_three_ds() && request_data.is_card(),api::CurrentFlowInfo::CompleteAuthorize { .. } => false,api::CurrentFlowInfo::SetupMandate { .. } => false,}