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

chore(core): deprecate preprocessing flow from core (#10987)

Hrithikesh0b1381f923d1
diff --git a/config/development.toml b/config/development.toml
index 5c0ead4d8f..a6ee93891b 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -38,12 +38,6 @@ dbname = "hyperswitch_db"
pool_size = 5
connection_timeout = 10
-[preprocessing_flow_config]
-authentication_bloated_connectors = "paypal,nmi,cybersource,barclaycard,shift4"
-order_create_bloated_connectors = "trustpay,payme,nordea"
-balance_check_bloated_connectors = "adyen"
-settlement_split_bloated_connectors = "xendit"
-
[redis]
host = "127.0.0.1"
port = 6379
diff --git a/crates/hyperswitch_interfaces/src/api/payments.rs b/crates/hyperswitch_interfaces/src/api/payments.rs
index 4b583f26cd..b334f8af18 100644
--- a/crates/hyperswitch_interfaces/src/api/payments.rs
+++ b/crates/hyperswitch_interfaces/src/api/payments.rs
@@ -51,7 +51,6 @@ pub trait Payment:
+ MandateSetup
+ PaymentSession
+ PaymentToken
- + PaymentsPreProcessing
+ PaymentsPostProcessing
+ ConnectorCustomer
+ PaymentIncrementalAuthorization
diff --git a/crates/hyperswitch_interfaces/src/api/payments_v2.rs b/crates/hyperswitch_interfaces/src/api/payments_v2.rs
index 1f3217c768..20bd73fef1 100644
--- a/crates/hyperswitch_interfaces/src/api/payments_v2.rs
+++ b/crates/hyperswitch_interfaces/src/api/payments_v2.rs
@@ -315,7 +315,6 @@ pub trait PaymentV2:
+ MandateSetupV2
+ PaymentSessionV2
+ PaymentTokenV2
- + PaymentsPreProcessingV2
+ PaymentsPostProcessingV2
+ ConnectorCustomerV2
+ PaymentIncrementalAuthorizationV2
diff --git a/crates/router/src/configs/secrets_transformers.rs b/crates/router/src/configs/secrets_transformers.rs
index 51f752b33d..24ee93e2d2 100644
--- a/crates/router/src/configs/secrets_transformers.rs
+++ b/crates/router/src/configs/secrets_transformers.rs
@@ -623,7 +623,6 @@ pub(crate) async fn fetch_raw_secrets(
theme: conf.theme,
platform: conf.platform,
l2_l3_data_config: conf.l2_l3_data_config,
- preprocessing_flow_config: conf.preprocessing_flow_config.clone(),
authentication_providers: conf.authentication_providers,
open_router: conf.open_router,
#[cfg(feature = "v2")]
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 0825d0f2f6..0e57648c10 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -173,7 +173,6 @@ pub struct Settings<S: SecretState> {
pub revenue_recovery: revenue_recovery::RevenueRecoverySettings,
pub clone_connector_allowlist: Option<CloneConnectorAllowlistConfig>,
pub merchant_id_auth: MerchantIdAuthSettings,
- pub preprocessing_flow_config: Option<PreProcessingFlowConfig>,
pub internal_merchant_id_profile_id_auth: InternalMerchantIdProfileIdAuthSettings,
#[serde(default)]
pub infra_values: Option<HashMap<String, String>>,
@@ -195,18 +194,6 @@ pub struct OnSessionConfig {
HashMap<enums::PaymentMethod, HashSet<enums::PaymentMethodType>>,
}
-#[derive(Debug, Deserialize, Clone, Default)]
-pub struct PreProcessingFlowConfig {
- #[serde(default, deserialize_with = "deserialize_hashset")]
- pub authentication_bloated_connectors: HashSet<enums::Connector>,
- #[serde(default, deserialize_with = "deserialize_hashset")]
- pub order_create_bloated_connectors: HashSet<enums::Connector>,
- #[serde(default, deserialize_with = "deserialize_hashset")]
- pub balance_check_bloated_connectors: HashSet<enums::Connector>,
- #[serde(default, deserialize_with = "deserialize_hashset")]
- pub settlement_split_bloated_connectors: HashSet<enums::Connector>,
-}
-
#[derive(Debug, Deserialize, Clone, Default)]
pub struct DebitRoutingConfig {
#[serde(deserialize_with = "deserialize_hashmap")]
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 1709bdcbf2..9b381d0e3a 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -20,7 +20,7 @@ pub mod vault_session;
#[cfg(feature = "olap")]
use std::collections::HashMap;
use std::{
- collections::HashSet, fmt::Debug, marker::PhantomData, ops::Deref, str::FromStr, time::Instant,
+ collections::HashSet, fmt::Debug, marker::PhantomData, str::FromStr, time::Instant,
vec::IntoIter,
};
@@ -4309,134 +4309,33 @@ where
)
.await?;
- let mut should_continue_further =
- tokenization::update_router_data_with_payment_method_token_result(
- payment_method_token_response,
- &mut router_data,
- is_retry_payment,
- should_continue_further,
- );
+ let should_continue_further = tokenization::update_router_data_with_payment_method_token_result(
+ payment_method_token_response,
+ &mut router_data,
+ is_retry_payment,
+ should_continue_further,
+ );
- (router_data, should_continue_further) = if state
- .conf
- .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_intent()
- .request_external_three_ds_authentication
- != Some(true)
- }) {
- logger::info!(
- "Using granular authentication steps for connector: {}",
- connector.connector_name
- );
- let (router_data, should_continue_further) = if should_continue_further {
- router_data
- .pre_authentication_step(state, &connector, &context)
- .await?
- } else {
- (router_data, false)
- };
- let (router_data, should_continue_further) = if should_continue_further {
- router_data
- .authentication_step(state, &connector, &context)
- .await?
- } else {
- (router_data, false)
- };
- let (router_data, should_continue_further) = if should_continue_further {
- router_data
- .post_authentication_step(state, &connector, &context)
- .await?
- } else {
- (router_data, false)
- };
- (router_data, should_continue_further)
- } else if state
- .conf
- .preprocessing_flow_config
- .as_ref()
- .is_some_and(|config| {
- // If order create flow is bloated up for the current connector
- // order create call would have already happened in the previous step.
- config
- .order_create_bloated_connectors
- .contains(&connector.connector_name)
- })
- {
- // If order create flow is bloated up for the current connector
- // So skip calling complete_preprocessing_steps_if_required function
- logger::info!(
- "skipping preprocessing steps for connector: {}",
- connector.connector_name
- );
- (router_data, should_continue_further)
- } else if state
- .conf
- .tokenization
- .0
- .contains_key(&connector.connector_name.to_string())
- {
- // If payment method tokenization flow is enabled for the current connector
- // Skip calling complete_preprocessing_steps_if_required function
- logger::info!(
- "skipping preprocessing steps for connector as tokenization flow is enabled: {}",
- connector.connector_name
- );
- (router_data, should_continue_further)
- } else if state
- .conf
- .preprocessing_flow_config
- .as_ref()
- .is_some_and(|config| {
- // If balance check flow is bloated up for the current connector
- // balance check call would have already happened in the previous step.
- config
- .balance_check_bloated_connectors
- .contains(&connector.connector_name)
- })
- {
- // If payment method tokenization flow is enabled for the current connector
- // Skip calling complete_preprocessing_steps_if_required function
- logger::info!(
- "skipping preprocessing steps for connector as balance check is enabled: {}",
- connector.connector_name
- );
- (router_data, should_continue_further)
- } else if state
- .conf
- .preprocessing_flow_config
- .as_ref()
- .is_some_and(|config| {
- // If order create flow is bloated up for the current connector
- // order create call would have already happened in the previous step.
- config
- .settlement_split_bloated_connectors
- .contains(&connector.connector_name)
- })
- {
- logger::info!(
- "skipping preprocessing steps for connector as settlement split is bloated: {}",
- connector.connector_name
- );
- (router_data, should_continue_further)
+ let (router_data, should_continue_further) = if should_continue_further {
+ router_data
+ .pre_authentication_step(state, &connector, &context)
+ .await?
} else {
- complete_preprocessing_steps_if_required(
- state,
- &connector,
- payment_data,
- router_data,
- operation,
- should_continue_further,
- )
- .await?
+ (router_data, false)
+ };
+ let (router_data, should_continue_further) = if should_continue_further {
+ router_data
+ .authentication_step(state, &connector, &context)
+ .await?
+ } else {
+ (router_data, false)
+ };
+ let (mut router_data, should_continue_further) = if should_continue_further {
+ router_data
+ .post_authentication_step(state, &connector, &context)
+ .await?
+ } else {
+ (router_data, false)
};
if let Ok(router_types::PaymentsResponseData::PreProcessingResponse {
@@ -5684,22 +5583,12 @@ where
.add_session_token(&updated_state, &connector, &gateway_context)
.await?;
- let mut should_continue_further = access_token::update_router_data_with_access_token_result(
+ let should_continue_further = access_token::update_router_data_with_access_token_result(
&add_access_token_result,
&mut router_data,
&call_connector_action,
);
- (router_data, should_continue_further) = complete_preprocessing_steps_if_required(
- &updated_state,
- &connector,
- payment_data,
- router_data,
- operation,
- should_continue_further,
- )
- .await?;
-
if let Ok(router_types::PaymentsResponseData::PreProcessingResponse {
session_token: Some(session_token),
..
@@ -7211,203 +7100,6 @@ where
}
}
-async fn complete_preprocessing_steps_if_required<F, Req, Q, D>(
- state: &SessionState,
- connector: &api::ConnectorData,
- payment_data: &D,
- mut router_data: RouterData<F, Req, router_types::PaymentsResponseData>,
- operation: &BoxedOperation<'_, F, Q, D>,
- should_continue_payment: bool,
-) -> RouterResult<(RouterData<F, Req, router_types::PaymentsResponseData>, bool)>
-where
- F: Send + Clone + Sync,
- D: OperationSessionGetters<F> + Send + Sync + Clone,
- Req: Send + Sync,
- RouterData<F, Req, router_types::PaymentsResponseData>: Feature<F, Req> + Send,
- dyn api::Connector:
- services::api::ConnectorIntegration<F, Req, router_types::PaymentsResponseData>,
-{
- //TODO: For ACH transfers, if preprocessing_step is not required for connectors encountered in future, add the check
- let router_data_and_should_continue_payment = match payment_data.get_payment_method_data() {
- Some(domain::PaymentMethodData::BankTransfer(_)) => (router_data, should_continue_payment),
- Some(domain::PaymentMethodData::Wallet(_)) => {
- if is_preprocessing_required_for_wallets(connector.connector_name.to_string()) {
- (
- router_data.preprocessing_steps(state, connector).await?,
- false,
- )
- } else if connector.connector_name == router_types::Connector::Paysafe {
- match payment_data.get_payment_method_data() {
- Some(domain::PaymentMethodData::Wallet(domain::WalletData::ApplePay(_))) => {
- router_data = router_data.preprocessing_steps(state, connector).await?;
- let is_error_in_response = router_data.response.is_err();
- (router_data, !is_error_in_response)
- }
- _ => (router_data, should_continue_payment),
- }
- } else {
- (router_data, should_continue_payment)
- }
- }
- Some(domain::PaymentMethodData::Card(_)) => {
- if connector.connector_name == router_types::Connector::Payme
- && !matches!(format!("{operation:?}").as_str(), "CompleteAuthorize")
- {
- router_data = router_data.preprocessing_steps(state, connector).await?;
-
- let is_error_in_response = router_data.response.is_err();
- // If is_error_in_response is true, should_continue_payment should be false, we should throw the error
- (router_data, !is_error_in_response)
- } else if connector.connector_name == router_types::Connector::Nmi
- && !matches!(format!("{operation:?}").as_str(), "CompleteAuthorize")
- && router_data.auth_type == storage_enums::AuthenticationType::ThreeDs
- && !matches!(
- payment_data
- .get_payment_attempt()
- .external_three_ds_authentication_attempted,
- Some(true)
- )
- {
- router_data = router_data.preprocessing_steps(state, connector).await?;
-
- (router_data, false)
- } else if connector.connector_name == router_types::Connector::Paysafe
- && router_data.auth_type == storage_enums::AuthenticationType::NoThreeDs
- {
- router_data = router_data.preprocessing_steps(state, connector).await?;
-
- let is_error_in_response = router_data.response.is_err();
- // If is_error_in_response is true, should_continue_payment should be false, we should throw the error
- (router_data, !is_error_in_response)
- } else if (connector.connector_name == router_types::Connector::Cybersource
- || connector.connector_name == router_types::Connector::Barclaycard)
- && is_operation_complete_authorize(&operation)
- && router_data.auth_type == storage_enums::AuthenticationType::ThreeDs
- {
- router_data = router_data.preprocessing_steps(state, connector).await?;
-
- // Should continue the flow only if no redirection_data is returned else a response with redirection form shall be returned
- let should_continue = matches!(
- router_data.response,
- Ok(router_types::PaymentsResponseData::TransactionResponse {
- ref redirection_data,
- ..
- }) if redirection_data.is_none()
- ) && router_data.status
- != common_enums::AttemptStatus::AuthenticationFailed;
- (router_data, should_continue)
- } else if router_data.auth_type == common_enums::AuthenticationType::ThreeDs
- && (((connector.connector_name == router_types::Connector::Nuvei && {
- #[cfg(feature = "v1")]
- {
- payment_data
- .get_payment_intent()
- .request_external_three_ds_authentication
- != Some(true)
- }
- #[cfg(feature = "v2")]
- {
- payment_data
- .get_payment_intent()
- .request_external_three_ds_authentication
- != Some(true).into()
- }
- }) || connector.connector_name == router_types::Connector::Shift4)
- && !is_operation_complete_authorize(&operation))
- {
- router_data = router_data.preprocessing_steps(state, connector).await?;
- (router_data, should_continue_payment)
- } else if connector.connector_name == router_types::Connector::Xendit
- && is_operation_confirm(&operation)
- {
- match payment_data.get_payment_intent().split_payments {
- Some(common_types::payments::SplitPaymentsRequest::XenditSplitPayment(
- common_types::payments::XenditSplitRequest::MultipleSplits(_),
- )) => {
- router_data = router_data.preprocessing_steps(state, connector).await?;
- let is_error_in_response = router_data.response.is_err();
- (router_data, !is_error_in_response)
- }
- _ => (router_data, should_continue_payment),
- }
- } else if connector.connector_name == router_types::Connector::Redsys
- && router_data.auth_type == common_enums::AuthenticationType::ThreeDs
- && is_operation_confirm(&operation)
- {
- router_data = router_data.preprocessing_steps(state, connector).await?;
- let should_continue = match router_data.response {
- Ok(router_types::PaymentsResponseData::TransactionResponse {
- ref connector_metadata,
- ..
- }) => {
- let three_ds_invoke_data: Option<
- api_models::payments::PaymentsConnectorThreeDsInvokeData,
- > = connector_metadata.clone().and_then(|metadata| {
- metadata
- .parse_value("PaymentsConnectorThreeDsInvokeData")
- .ok() // "ThreeDsInvokeData was not found; proceeding with the payment flow without triggering the ThreeDS invoke action"
- });
- three_ds_invoke_data.is_none()
- }
- _ => false,
- };
- (router_data, should_continue)
- } else if router_data.auth_type == common_enums::AuthenticationType::ThreeDs
- && connector.connector_name == router_types::Connector::Nexixpay
- && is_operation_complete_authorize(&operation)
- {
- router_data = router_data.preprocessing_steps(state, connector).await?;
- let is_error_in_response = router_data.response.is_err();
- (router_data, !is_error_in_response)
- } else {
- (router_data, should_continue_payment)
- }
- }
- Some(domain::PaymentMethodData::GiftCard(gift_card_data)) => {
- if connector.connector_name == router_types::Connector::Adyen
- && matches!(gift_card_data.deref(), domain::GiftCardData::Givex(..))
- {
- router_data = router_data.preprocessing_steps(state, connector).await?;
-
- let is_error_in_response = router_data.response.is_err();
- // If is_error_in_response is true, should_continue_payment should be false, we should throw the error
- (router_data, !is_error_in_response)
- } else {
- (router_data, should_continue_payment)
- }
- }
- Some(domain::PaymentMethodData::BankDebit(_)) => {
- if connector.connector_name == router_types::Connector::Gocardless
- || connector.connector_name == router_types::Connector::Nordea
- {
- router_data = router_data.preprocessing_steps(state, connector).await?;
- let is_error_in_response = router_data.response.is_err();
- // If is_error_in_response is true, should_continue_payment should be false, we should throw the error
- (router_data, !is_error_in_response)
- } else {
- (router_data, should_continue_payment)
- }
- }
- _ => {
- // 3DS validation for paypal cards after verification (authorize call)
- if connector.connector_name == router_types::Connector::Paypal
- && payment_data.get_payment_attempt().get_payment_method()
- == Some(storage_enums::PaymentMethod::Card)
- && matches!(format!("{operation:?}").as_str(), "CompleteAuthorize")
- {
- router_data = router_data.preprocessing_steps(state, connector).await?;
- let is_error_in_response = router_data.response.is_err();
- // If is_error_in_response is true, should_continue_payment should be false, we should throw the error
- (router_data, !is_error_in_response)
- } else {
- (router_data, should_continue_payment)
- }
- }
- };
-
- Ok(router_data_and_should_continue_payment)
-}
-
#[cfg(feature = "v1")]
async fn complete_confirmation_for_click_to_pay_if_required<F, D>(
state: &SessionState,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 754593d9b8..d55fd2c72e 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -205,19 +205,6 @@ pub trait Feature<F, T> {
Ok((self, true))
}
- async fn preprocessing_steps<'a>(
- self,
- _state: &SessionState,
- _connector_data: &api::ConnectorData,
- ) -> RouterResult<Self>
- where
- F: Clone,
- Self: Sized,
- dyn api::Connector: services::ConnectorIntegration<F, T, types::PaymentsResponseData>,
- {
- Ok(self)
- }
-
async fn postprocessing_steps<'a>(
self,
_state: &SessionState,
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index d6ac85f27f..8718c55ae0 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -279,17 +279,7 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
auth_type: &self.auth_type,
request_data: &self.request,
},
- ) && state
- .conf
- .preprocessing_flow_config
- .as_ref()
- .is_some_and(|config| {
- // check balance check flow is bloated up for the current connector
- config
- .balance_check_bloated_connectors
- .contains(&connector.connector_name)
- })
- {
+ ) {
logger::info!(
"Balance check flow is required for connector: {}",
connector.connector_name
@@ -490,7 +480,7 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
None,
))
.await?;
- // Convert back to CompleteAuthorize router data while preserving preprocessing response data
+ // Convert back to CompleteAuthorize router data while preserving pre authentication response data
let pre_authenticate_response = pre_authenticate_router_data.response.clone();
let mut authorize_router_data =
helpers::router_data_type_conversion::<_, api::Authorize, _, _, _, _>(
@@ -537,14 +527,6 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
}
}
- async fn preprocessing_steps<'a>(
- self,
- state: &SessionState,
- connector: &api::ConnectorData,
- ) -> RouterResult<Self> {
- authorize_preprocessing_steps(state, &self, true, connector).await
- }
-
async fn postprocessing_steps<'a>(
self,
state: &SessionState,
@@ -674,17 +656,7 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
auth_type: &self.auth_type,
request_data: &self.request,
},
- ) && state
- .conf
- .preprocessing_flow_config
- .as_ref()
- .is_some_and(|config| {
- // check order create flow is bloated up for the current connector
- config
- .settlement_split_bloated_connectors
- .contains(&connector.connector_name)
- })
- {
+ ) {
logger::info!(
"Settlement Split call is required for connector: {}",
connector.connector_name
@@ -755,16 +727,7 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
auth_type: &self.auth_type,
request_data: &self.request,
},
- ) && state
- .conf
- .preprocessing_flow_config
- .as_ref()
- .is_some_and(|config| {
- // check order create flow is bloated up for the current connector
- config
- .order_create_bloated_connectors
- .contains(&connector.connector_name)
- });
+ );
if (connector
.connector_name
.requires_order_creation_before_payment(self.payment_method)
@@ -954,87 +917,6 @@ impl mandate::MandateBehaviour for types::PaymentsAuthorizeData {
}
}
-pub async fn authorize_preprocessing_steps<F: Clone>(
- state: &SessionState,
- router_data: &types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>,
- confirm: bool,
- connector: &api::ConnectorData,
-) -> RouterResult<types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>> {
- if confirm {
- let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<
- api::PreProcessing,
- types::PaymentsPreProcessingData,
- types::PaymentsResponseData,
- > = connector.connector.get_connector_integration();
-
- let preprocessing_request_data =
- types::PaymentsPreProcessingData::try_from(router_data.request.to_owned())?;
-
- let preprocessing_response_data: Result<types::PaymentsResponseData, types::ErrorResponse> =
- Err(types::ErrorResponse::default());
-
- let preprocessing_router_data =
- helpers::router_data_type_conversion::<_, api::PreProcessing, _, _, _, _>(
- router_data.clone(),
- preprocessing_request_data,
- preprocessing_response_data,
- );
-
- let resp = services::execute_connector_processing_step(
- state,
- connector_integration,
- &preprocessing_router_data,
- payments::CallConnectorAction::Trigger,
- None,
- None,
- )
- .await
- .to_payment_failed_response()?;
-
- metrics::PREPROCESSING_STEPS_COUNT.add(
- 1,
- router_env::metric_attributes!(
- ("connector", connector.connector_name.to_string()),
- ("payment_method", router_data.payment_method.to_string()),
- (
- "payment_method_type",
- router_data
- .request
- .payment_method_type
- .map(|inner| inner.to_string())
- .unwrap_or("null".to_string()),
- ),
- ),
- );
- let mut authorize_router_data = helpers::router_data_type_conversion::<_, F, _, _, _, _>(
- resp.clone(),
- router_data.request.to_owned(),
- resp.response.clone(),
- );
- if connector.connector_name == api_models::enums::Connector::Nuvei {
- let (enrolled_for_3ds, related_transaction_id) = match &authorize_router_data.response {
- Ok(types::PaymentsResponseData::ThreeDSEnrollmentResponse {
- enrolled_v2,
- related_transaction_id,
- }) => (*enrolled_v2, related_transaction_id.clone()),
- _ => (false, None),
- };
- authorize_router_data.request.enrolled_for_3ds = enrolled_for_3ds;
- authorize_router_data.request.related_transaction_id = related_transaction_id;
- } else if connector.connector_name == api_models::enums::Connector::Shift4 {
- if resp.request.enrolled_for_3ds {
- authorize_router_data.response = resp.response;
- authorize_router_data.status = resp.status;
- } else {
- authorize_router_data.request.enrolled_for_3ds = false;
- }
- }
- Ok(authorize_router_data)
- } else {
- Ok(router_data.clone())
- }
-}
-
pub async fn authorize_postprocessing_steps<F: Clone>(
state: &SessionState,
router_data: &types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>,
diff --git a/crates/router/src/core/payments/flows/complete_authorize_flow.rs b/crates/router/src/core/payments/flows/complete_authorize_flow.rs
index 0cd5e289c8..6d18714e86 100644
--- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs
@@ -32,7 +32,7 @@ use crate::{
unified_connector_service as ucs_core,
},
logger,
- routes::{metrics, SessionState},
+ routes::SessionState,
services,
types::{self, api, domain, transformers::ForeignTryFrom},
};
@@ -178,17 +178,7 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>
payment_method: Some(self.payment_method),
request_data: &self.request,
},
- ) && state
- .conf
- .preprocessing_flow_config
- .as_ref()
- .is_some_and(|config| {
- // check balance check flow is bloated up for the current connector
- config
- .balance_check_bloated_connectors
- .contains(&connector.connector_name)
- })
- {
+ ) {
logger::info!(
"Balance check flow is required for connector: {}",
connector.connector_name
@@ -359,14 +349,6 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>
Ok((request, true))
}
- async fn preprocessing_steps<'a>(
- self,
- state: &SessionState,
- connector: &api::ConnectorData,
- ) -> RouterResult<Self> {
- complete_authorize_preprocessing_steps(state, &self, true, connector).await
- }
-
async fn authentication_step<'a>(
self,
state: &SessionState,
@@ -420,7 +402,7 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>
))
.await?;
- // Convert back to CompleteAuthorize router data while preserving preprocessing response data
+ // Convert back to CompleteAuthorize router data while preserving authentication response data
let authenticate_response = authenticate_router_data.response.clone();
if let Ok(types::PaymentsResponseData::TransactionResponse {
connector_metadata, ..
@@ -503,7 +485,7 @@ impl Feature<api::CompleteAuthorize, types::CompleteAuthorizeData>
None,
))
.await?;
- // Convert back to CompleteAuthorize router data while preserving preprocessing response data
+ // Convert back to CompleteAuthorize router data while preserving post authentication response data
let post_authenticate_response = post_authenticate_router_data.response.clone();
if let Ok(types::PaymentsResponseData::TransactionResponse {
connector_metadata, ..
@@ -860,72 +842,6 @@ pub async fn call_unified_connector_service_post_authenticate(
.change_context(interface_errors::ConnectorError::ResponseHandlingFailed)
}
-pub async fn complete_authorize_preprocessing_steps<F: Clone>(
- state: &SessionState,
- router_data: &types::RouterData<F, types::CompleteAuthorizeData, types::PaymentsResponseData>,
- confirm: bool,
- connector: &api::ConnectorData,
-) -> RouterResult<types::RouterData<F, types::CompleteAuthorizeData, types::PaymentsResponseData>> {
- if confirm {
- let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<
- api::PreProcessing,
- types::PaymentsPreProcessingData,
- types::PaymentsResponseData,
- > = connector.connector.get_connector_integration();
-
- let preprocessing_request_data =
- types::PaymentsPreProcessingData::try_from(router_data.request.to_owned())?;
-
- let preprocessing_response_data: Result<types::PaymentsResponseData, types::ErrorResponse> =
- Err(types::ErrorResponse::default());
-
- let preprocessing_router_data =
- helpers::router_data_type_conversion::<_, api::PreProcessing, _, _, _, _>(
- router_data.clone(),
- preprocessing_request_data,
- preprocessing_response_data,
- );
-
- let resp = services::execute_connector_processing_step(
- state,
- connector_integration,
- &preprocessing_router_data,
- payments::CallConnectorAction::Trigger,
- None,
- None,
- )
- .await
- .to_payment_failed_response()?;
-
- metrics::PREPROCESSING_STEPS_COUNT.add(
- 1,
- router_env::metric_attributes!(
- ("connector", connector.connector_name.to_string()),
- ("payment_method", router_data.payment_method.to_string()),
- ),
- );
-
- let mut router_data_request = router_data.request.to_owned();
-
- if let Ok(types::PaymentsResponseData::TransactionResponse {
- connector_metadata, ..
- }) = &resp.response
- {
- connector_metadata.clone_into(&mut router_data_request.connector_meta);
- };
-
- let authorize_router_data = helpers::router_data_type_conversion::<_, F, _, _, _, _>(
- resp.clone(),
- router_data_request,
- resp.response,
- );
-
- Ok(authorize_router_data)
- } else {
- Ok(router_data.clone())
- }
-}
-
impl<F>
ForeignTryFrom<types::RouterData<F, types::CompleteAuthorizeData, types::PaymentsResponseData>>
for types::PaymentsCaptureData
diff --git a/crates/router/src/core/payments/flows/external_proxy_flow.rs b/crates/router/src/core/payments/flows/external_proxy_flow.rs
index 1c05545878..9b76136655 100644
--- a/crates/router/src/core/payments/flows/external_proxy_flow.rs
+++ b/crates/router/src/core/payments/flows/external_proxy_flow.rs
@@ -165,14 +165,6 @@ impl Feature<api::ExternalVaultProxy, types::ExternalVaultProxyPaymentsData>
.await
}
- async fn preprocessing_steps<'a>(
- self,
- state: &SessionState,
- connector: &api::ConnectorData,
- ) -> RouterResult<Self> {
- todo!()
- }
-
async fn postprocessing_steps<'a>(
self,
state: &SessionState,
diff --git a/crates/router/src/core/payments/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
index 1a5cd26c66..e5036dc3ef 100644
--- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs
+++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs
@@ -162,17 +162,7 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
auth_type: &self.auth_type,
request_data: &self.request,
},
- ) && state
- .conf
- .preprocessing_flow_config
- .as_ref()
- .is_some_and(|config| {
- // check balance check flow is bloated up for the current connector
- config
- .balance_check_bloated_connectors
- .contains(&connector.connector_name)
- })
- {
+ ) {
logger::info!(
"Balance check flow is required for connector: {}",
connector.connector_name
@@ -455,14 +445,6 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setup
_ => Ok((None, true)),
}
}
-
- async fn preprocessing_steps<'a>(
- self,
- state: &SessionState,
- connector: &api::ConnectorData,
- ) -> RouterResult<Self> {
- setup_mandate_preprocessing_steps(state, &self, true, connector).await
- }
}
impl mandate::MandateBehaviour for types::SetupMandateRequestData {
@@ -495,66 +477,3 @@ impl mandate::MandateBehaviour for types::SetupMandateRequestData {
self.customer_acceptance.clone()
}
}
-
-pub async fn setup_mandate_preprocessing_steps<F: Clone>(
- state: &SessionState,
- router_data: &types::RouterData<F, types::SetupMandateRequestData, types::PaymentsResponseData>,
- confirm: bool,
- connector: &api::ConnectorData,
-) -> RouterResult<types::RouterData<F, types::SetupMandateRequestData, types::PaymentsResponseData>>
-{
- if confirm {
- let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<
- api::PreProcessing,
- types::PaymentsPreProcessingData,
- types::PaymentsResponseData,
- > = connector.connector.get_connector_integration();
-
- let preprocessing_request_data =
- types::PaymentsPreProcessingData::try_from(router_data.request.clone())?;
-
- let preprocessing_response_data: Result<types::PaymentsResponseData, types::ErrorResponse> =
- Err(types::ErrorResponse::default());
-
- let preprocessing_router_data =
- helpers::router_data_type_conversion::<_, api::PreProcessing, _, _, _, _>(
- router_data.clone(),
- preprocessing_request_data,
- preprocessing_response_data,
- );
-
- let resp = services::execute_connector_processing_step(
- state,
- connector_integration,
- &preprocessing_router_data,
- payments::CallConnectorAction::Trigger,
- None,
- None,
- )
- .await
- .to_payment_failed_response()?;
-
- let mut setup_mandate_router_data = helpers::router_data_type_conversion::<_, F, _, _, _, _>(
- resp.clone(),
- router_data.request.to_owned(),
- resp.response.clone(),
- );
-
- if connector.connector_name == api_models::enums::Connector::Nuvei {
- let (enrolled_for_3ds, related_transaction_id) =
- match &setup_mandate_router_data.response {
- Ok(types::PaymentsResponseData::ThreeDSEnrollmentResponse {
- enrolled_v2,
- related_transaction_id,
- }) => (*enrolled_v2, related_transaction_id.clone()),
- _ => (false, None),
- };
- setup_mandate_router_data.request.enrolled_for_3ds = enrolled_for_3ds;
- setup_mandate_router_data.request.related_transaction_id = related_transaction_id;
- }
-
- Ok(setup_mandate_router_data)
- } else {
- Ok(router_data.clone())
- }
-}