diff --git a/config/config.example.toml b/config/config.example.toml index b69519b6ac4a..93f3469f46e6 100644 --- a/config/config.example.toml +++ b/config/config.example.toml @@ -321,9 +321,11 @@ square = {long_lived_token = false, payment_method = "card"} braintree = { long_lived_token = false, payment_method = "card" } gocardless = {long_lived_token = true, payment_method = "bank_debit"} -[temp_locker_disable_config] -trustpay = {payment_method = "card,bank_redirect,wallet"} -stripe = {payment_method = "card,bank_redirect,pay_later,wallet,bank_debit"} +[temp_locker_enable_config] +stripe = {payment_method = "bank_transfer"} +nuvei = {payment_method = "card"} +shift4 = {payment_method = "card"} +bluesnap = {payment_method = "card"} [dummy_connector] enabled = true # Whether dummy connector is enabled or not diff --git a/config/development.toml b/config/development.toml index 75a5a89ca9dc..411b1364ea31 100644 --- a/config/development.toml +++ b/config/development.toml @@ -377,9 +377,11 @@ braintree = { long_lived_token = false, payment_method = "card" } payme = {long_lived_token = false, payment_method = "card"} gocardless = {long_lived_token = true, payment_method = "bank_debit"} -[temp_locker_disable_config] -trustpay = {payment_method = "card,bank_redirect,wallet"} -stripe = {payment_method = "card,bank_redirect,pay_later,wallet,bank_debit"} +[temp_locker_enable_config] +stripe = {payment_method = "bank_transfer"} +nuvei = {payment_method = "card"} +shift4 = {payment_method = "card"} +bluesnap = {payment_method = "card"} [connector_customer] connector_list = "gocardless,stax,stripe" diff --git a/config/docker_compose.toml b/config/docker_compose.toml index b1483327ee0c..ac96278f5370 100644 --- a/config/docker_compose.toml +++ b/config/docker_compose.toml @@ -208,9 +208,11 @@ square = {long_lived_token = false, payment_method = "card"} braintree = { long_lived_token = false, payment_method = "card" } gocardless = {long_lived_token = true, payment_method = "bank_debit"} -[temp_locker_disable_config] -trustpay = {payment_method = "card,bank_redirect,wallet"} -stripe = {payment_method = "card,bank_redirect,pay_later,wallet,bank_debit"} +[temp_locker_enable_config] +stripe = {payment_method = "bank_transfer"} +nuvei = {payment_method = "card"} +shift4 = {payment_method = "card"} +bluesnap = {payment_method = "card"} [dummy_connector] enabled = true diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs index 70d05b79f962..a2feb55e86a2 100644 --- a/crates/router/src/configs/settings.rs +++ b/crates/router/src/configs/settings.rs @@ -99,7 +99,7 @@ pub struct Settings { pub multiple_api_version_supported_connectors: MultipleApiVersionSupportedConnectors, pub applepay_merchant_configs: ApplepayMerchantConfigs, pub lock_settings: LockSettings, - pub temp_locker_disable_config: TempLockerDisableConfig, + pub temp_locker_enable_config: TempLockerEnableConfig, } #[derive(Debug, Deserialize, Clone, Default)] @@ -123,7 +123,7 @@ pub struct TokenizationConfig(pub HashMap); #[derive(Debug, Deserialize, Clone, Default)] #[serde(transparent)] -pub struct TempLockerDisableConfig(pub HashMap); +pub struct TempLockerEnableConfig(pub HashMap); #[derive(Debug, Deserialize, Clone, Default)] pub struct ConnectorCustomer { @@ -216,7 +216,7 @@ pub struct PaymentMethodTokenFilter { } #[derive(Debug, Deserialize, Clone, Default)] -pub struct TempLockerDisablePaymentMethodFilter { +pub struct TempLockerEnablePaymentMethodFilter { #[serde(deserialize_with = "pm_deser")] pub payment_method: HashSet, } diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index a6e3b2f12785..143b9923958c 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -31,7 +31,7 @@ use super::{ CustomerDetails, PaymentData, }; use crate::{ - configs::settings::{ConnectorRequestReferenceIdConfig, Server, TempLockerDisableConfig}, + configs::settings::{ConnectorRequestReferenceIdConfig, Server, TempLockerEnableConfig}, connector, consts::{self, BASE64_ENGINE}, core::{ @@ -1480,7 +1480,7 @@ pub async fn store_payment_method_data_in_vault( payment_method_data: &api::PaymentMethodData, ) -> RouterResult> { if should_store_payment_method_data_in_vault( - &state.conf.temp_locker_disable_config, + &state.conf.temp_locker_enable_config, payment_attempt.connector.clone(), payment_method, ) { @@ -1499,18 +1499,17 @@ pub async fn store_payment_method_data_in_vault( Ok(None) } pub fn should_store_payment_method_data_in_vault( - temp_locker_disable_config: &TempLockerDisableConfig, + temp_locker_enable_config: &TempLockerEnableConfig, option_connector: Option, payment_method: enums::PaymentMethod, ) -> bool { option_connector .map(|connector| { - temp_locker_disable_config + temp_locker_enable_config .0 .get(&connector) - //should be true only if payment_method is not in the disable payment_method list for connector - .map(|config| !config.payment_method.contains(&payment_method)) - .unwrap_or(true) + .map(|config| config.payment_method.contains(&payment_method)) + .unwrap_or(false) }) .unwrap_or(true) } diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs index db2c9e27c9b9..506a9b4421cd 100644 --- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs +++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs @@ -115,7 +115,7 @@ impl let should_validate_pm_or_token_given = //this validation should happen if data was stored in the vault helpers::should_store_payment_method_data_in_vault( - &state.conf.temp_locker_disable_config, + &state.conf.temp_locker_enable_config, payment_attempt.connector.clone(), payment_method, ); @@ -300,11 +300,6 @@ impl Domain { let (op, payment_method_data) = helpers::make_pm_data(Box::new(self), state, payment_data).await?; - - utils::when(payment_method_data.is_none(), || { - Err(errors::ApiErrorResponse::PaymentMethodNotFound) - })?; - Ok((op, payment_method_data)) }