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(router): allow post-authorization flows on disabled connectors (#14133)
Ayush Anand26223ecdee70
diff --git a/api-reference/docs.json b/api-reference/docs.jsonindex 41383a86cf..8da40e26d4 100644--- a/api-reference/docs.json+++ b/api-reference/docs.json@@ -278,6 +278,8 @@"v1/blocklist/post-blocklist","v1/blocklist/delete-blocklist","v1/blocklist/post-blocklisttoggle",+ "v1/blocklist/blocklist--count",+ "v1/blocklist/blocklist--lookup","v1/blocklist/blocklist--batch-upload","v1/blocklist/blocklist--batch-list","v1/blocklist/blocklist--batch-status"diff --git a/api-reference/v1/blocklist/blocklist--count.mdx b/api-reference/v1/blocklist/blocklist--count.mdxnew file mode 100644index 0000000000..9f1d8076c9--- /dev/null+++ b/api-reference/v1/blocklist/blocklist--count.mdx@@ -0,0 +1,3 @@+---+openapi: get /blocklist/count+---diff --git a/api-reference/v1/blocklist/blocklist--lookup.mdx b/api-reference/v1/blocklist/blocklist--lookup.mdxnew file mode 100644index 0000000000..0a24445493--- /dev/null+++ b/api-reference/v1/blocklist/blocklist--lookup.mdx@@ -0,0 +1,3 @@+---+openapi: get /blocklist/lookup+---diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rsindex 924dca95f2..f801104967 100644--- a/crates/router/src/core/payments/flows/authorize_flow.rs+++ b/crates/router/src/core/payments/flows/authorize_flow.rs@@ -5,7 +5,7 @@ use common_enums as enums;use common_types::payments as common_payments_types;#[cfg(feature = "v2")]use common_utils::types::MinorUnit;-use common_utils::{errors, ext_traits::ValueExt, id_type, ucs_types};+use common_utils::{errors, ext_traits::ValueExt, fp_utils, id_type, ucs_types};use error_stack::ResultExt;use external_services::grpc_client;use hyperswitch_connectors::constants as connector_consts;@@ -157,6 +157,10 @@ impltypes::PaymentsResponseData,>,> {+ fp_utils::when(merchant_connector_account.is_disabled(), || {+ Err(ApiErrorResponse::MerchantConnectorAccountDisabled)+ })?;+Box::pin(transformers::construct_payment_router_data::<api::Authorize,types::PaymentsAuthorizeData,diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rsindex 62e9f7215e..9bc9319151 100644--- a/crates/router/src/core/payments/flows/session_flow.rs+++ b/crates/router/src/core/payments/flows/session_flow.rs@@ -5,6 +5,7 @@ use api_models::{use async_trait::async_trait;use common_utils::{ext_traits::ByteSliceExt,+ fp_utils,request::RequestContent,types::{AmountConvertor, StringMajorUnitForConnector},};@@ -85,6 +86,10 @@ implpayment_method: Option<common_enums::PaymentMethod>,payment_method_type: Option<common_enums::PaymentMethodType>,) -> RouterResult<types::PaymentsSessionRouterData> {+ fp_utils::when(merchant_connector_account.is_disabled(), || {+ Err(errors::ApiErrorResponse::MerchantConnectorAccountDisabled)+ })?;+Box::pin(transformers::construct_payment_router_data::<api::Session,types::PaymentsSessionData,diff --git a/crates/router/src/core/payments/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rsindex 9ddd2755b2..9edfcf4136 100644--- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs+++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs@@ -1,6 +1,7 @@use async_trait::async_trait;use common_enums;use common_types::payments as common_payments_types;+use common_utils::fp_utils;use hyperswitch_connectors::constants as connector_consts;use hyperswitch_domain_models::{mandates, payments as domain_payments, router_data,@@ -16,7 +17,7 @@ use router_env::logger;use super::{ConstructFlowSpecificData, Feature};use crate::{core::{- errors::{ConnectorErrorExt, RouterResult},+ errors::{self, ConnectorErrorExt, RouterResult},mandate,payments::{self, access_token, customers, gateway as payments_gateway,@@ -49,6 +50,10 @@ impl_payment_method: Option<common_enums::PaymentMethod>,_payment_method_type: Option<common_enums::PaymentMethodType>,) -> RouterResult<types::SetupMandateRouterData> {+ fp_utils::when(merchant_connector_account.is_disabled(), || {+ Err(errors::ApiErrorResponse::MerchantConnectorAccountDisabled)+ })?;+Box::pin(transformers::construct_payment_router_data::<api::SetupMandate,types::SetupMandateRequestData,diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex f7735d8be1..0043b548f3 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -1971,10 +1971,6 @@ whereerror_stack::Report<errors::ApiErrorResponse>:From<<T as TryFrom<PaymentAdditionalData<'a, F>>>::Error>,{- fp_utils::when(merchant_connector_account.is_disabled(), || {- Err(errors::ApiErrorResponse::MerchantConnectorAccountDisabled)- })?;-let test_mode = merchant_connector_account.is_test_mode_on();let auth_type: types::ConnectorAuthType = merchant_connector_account