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
chore: fix for setupmandate and complete authorize for granular flows (#11070)
Amitsingh Tanwar7d35b649fb72
diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard.rsindex 3bf9d53e9d..08d159bc4c 100644--- a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs+++ b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs@@ -1656,6 +1656,7 @@ impl ConnectorSpecifications for Barclaycard {api::CurrentFlowInfo::CompleteAuthorize {request_data,payment_method: _,+ ..} => {// TODO: add logic before deciding the pre processing flow Authenticate or PostAuthenticatelet redirection_params = request_data@@ -1680,6 +1681,7 @@ impl ConnectorSpecifications for Barclaycard {api::CurrentFlowInfo::CompleteAuthorize {request_data,payment_method: _,+ ..} => {// TODO: add logic before deciding the pre processing flow Authenticate or PostAuthenticatelet redirection_params = request_datadiff --git a/crates/hyperswitch_connectors/src/connectors/cybersource.rs b/crates/hyperswitch_connectors/src/connectors/cybersource.rsindex 240670538d..d5107f25a5 100644--- a/crates/hyperswitch_connectors/src/connectors/cybersource.rs+++ b/crates/hyperswitch_connectors/src/connectors/cybersource.rs@@ -2291,6 +2291,7 @@ impl ConnectorSpecifications for Cybersource {api::CurrentFlowInfo::CompleteAuthorize {request_data,payment_method: _,+ ..} => {// TODO: add logic before deciding the pre processing flow Authenticate or PostAuthenticatelet redirect_response = request_data.redirect_response.as_ref()?;@@ -2345,6 +2346,7 @@ impl ConnectorSpecifications for Cybersource {api::CurrentFlowInfo::CompleteAuthorize {request_data,payment_method: _,+ ..} => {// TODO: add logic before deciding the pre processing flow Authenticate or PostAuthenticatelet redirection_params = request_data@@ -2369,6 +2371,7 @@ impl ConnectorSpecifications for Cybersource {api::CurrentFlowInfo::CompleteAuthorize {request_data,payment_method: _,+ ..} => {// TODO: add logic before deciding the pre processing flow Authenticate or PostAuthenticatelet redirection_params = request_datadiff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay.rsindex 1629d052e7..3535aa0f01 100644--- a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs@@ -1242,9 +1242,11 @@ 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 { payment_method, .. } => {- payment_method == Some(enums::PaymentMethod::Card)- }+ api::CurrentFlowInfo::CompleteAuthorize {+ payment_method,+ auth_type,+ ..+ } => payment_method == Some(enums::PaymentMethod::Card) && auth_type.is_three_ds(),api::CurrentFlowInfo::SetupMandate { .. } => false,}}diff --git a/crates/hyperswitch_connectors/src/connectors/nmi.rs b/crates/hyperswitch_connectors/src/connectors/nmi.rsindex c484b610a3..4e0493e2d4 100644--- a/crates/hyperswitch_connectors/src/connectors/nmi.rs+++ b/crates/hyperswitch_connectors/src/connectors/nmi.rs@@ -56,7 +56,10 @@ use transformers as nmi;use crate::{types::ResponseRouterData,- utils::{self, convert_amount, get_header_key_value, PaymentsAuthorizeRequestData},+ utils::{+ self, convert_amount, get_header_key_value, PaymentsAuthorizeRequestData,+ PaymentsSetupMandateRequestData,+ },};#[derive(Clone)]@@ -1198,9 +1201,10 @@ impl ConnectorSpecifications for Nmi {request_data,} => auth_type.is_three_ds() && request_data.is_card(),api::CurrentFlowInfo::CompleteAuthorize { .. } => false,- api::CurrentFlowInfo::SetupMandate { auth_type, .. } => {- *auth_type == enums::AuthenticationType::ThreeDs- }+ api::CurrentFlowInfo::SetupMandate {+ auth_type,+ request_data,+ } => auth_type.is_three_ds() && request_data.is_card(),}}fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rsindex 26189e0ef7..2577ce9c9a 100644--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs+++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs@@ -73,7 +73,7 @@ use crate::{types::ResponseRouterData,utils::{self, is_mandate_supported, PaymentMethodDataType, PaymentsAuthorizeRequestData,- RouterData as _,+ PaymentsSetupMandateRequestData, RouterData as _,},};@@ -1701,9 +1701,10 @@ impl ConnectorSpecifications for Nuvei {request_data,} => auth_type.is_three_ds() && request_data.is_card(),api::CurrentFlowInfo::CompleteAuthorize { .. } => false,- api::CurrentFlowInfo::SetupMandate { auth_type, .. } => {- *auth_type == enums::AuthenticationType::ThreeDs- }+ api::CurrentFlowInfo::SetupMandate {+ auth_type,+ request_data,+ } => auth_type.is_three_ds() && request_data.is_card(),}}diff --git a/crates/hyperswitch_connectors/src/connectors/paypal.rs b/crates/hyperswitch_connectors/src/connectors/paypal.rsindex b32ece545f..b1b9947fae 100644--- a/crates/hyperswitch_connectors/src/connectors/paypal.rs+++ b/crates/hyperswitch_connectors/src/connectors/paypal.rs@@ -2577,6 +2577,7 @@ impl ConnectorSpecifications for Paypal {api::CurrentFlowInfo::CompleteAuthorize {request_data: _,payment_method,+ ..} => payment_method == Some(enums::PaymentMethod::Card),api::CurrentFlowInfo::SetupMandate { .. } => false,}diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rsindex b74c9ae0f3..31d4f0216e 100644--- a/crates/hyperswitch_interfaces/src/api.rs+++ b/crates/hyperswitch_interfaces/src/api.rs@@ -401,6 +401,8 @@ pub enum CurrentFlowInfo<'a> {},/// CompleteAuthorize flow informationCompleteAuthorize {+ /// The authentication type being used+ auth_type: &'a enums::AuthenticationType,/// The payment authorize request datarequest_data: &'a router_request_types::CompleteAuthorizeData,/// The payment method that is useddiff --git a/crates/router/src/core/payments/flows/complete_authorize_flow.rs b/crates/router/src/core/payments/flows/complete_authorize_flow.rsindex de9b4722db..03d2e96bf3 100644--- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs+++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs@@ -173,6 +173,7 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>) -> RouterResult<types::BalanceCheckResult> {if connector.connector.is_balance_check_flow_required(api_interface::CurrentFlowInfo::CompleteAuthorize {+ auth_type: &self.auth_type,payment_method: Some(self.payment_method),request_data: &self.request,},@@ -358,6 +359,7 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>{if connector.connector.is_authentication_flow_required(api_interface::CurrentFlowInfo::CompleteAuthorize {+ auth_type: &self.auth_type,request_data: &self.request,payment_method: Some(self.payment_method),},@@ -444,6 +446,7 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>{if connector.connector.is_post_authentication_flow_required(api_interface::CurrentFlowInfo::CompleteAuthorize {+ auth_type: &self.auth_type,request_data: &self.request,payment_method: Some(self.payment_method),},