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
refactor(blocking): consolidate profile-based blocklist check into should_payment_be_blocked (#11621)
Ayush Anand2542b6197e88
diff --git a/crates/router/src/core/blocklist/utils.rs b/crates/router/src/core/blocklist/utils.rsindex 34a0cd6610..8076db14f3 100644--- a/crates/router/src/core/blocklist/utils.rs+++ b/crates/router/src/core/blocklist/utils.rs@@ -310,6 +310,7 @@ pub async fn should_payment_be_blocked(state: &SessionState,processor: &domain::Processor,payment_method_data: &Option<domain::PaymentMethodData>,+ business_profile: &domain::Profile,) -> CustomResult<bool, errors::ApiErrorResponse> {let db = &state.store;let merchant_id = processor.get_account().get_id();@@ -394,6 +395,16 @@ pub async fn should_payment_be_blocked(}}}++ if !should_payment_be_blocked {+ should_payment_be_blocked = should_payment_be_blocked_by_profile_config(+ state,+ payment_method_data,+ business_profile,+ )+ .await?;+ }+Ok(should_payment_be_blocked)}@@ -407,17 +418,13 @@ whereF: Send + Clone,{let db = &state.store;- let mut should_block =- should_payment_be_blocked(state, processor, &payment_data.payment_method_data).await?;-- if !should_block {- should_block = should_payment_be_blocked_by_profile_config(- state,- &payment_data.payment_method_data,- business_profile,- )- .await?;- }+ let should_block = should_payment_be_blocked(+ state,+ processor,+ &payment_data.payment_method_data,+ business_profile,+ )+ .await?;if should_block {db.update_payment_intent(diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex ab3d53c03a..b0e2097da0 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -11538,12 +11538,13 @@ impl EligibilityCheck for BlockListCheck {state: &SessionState,platform: &domain::Platform,payment_elgibility_data: &PaymentEligibilityData,- _business_profile: &domain::Profile,+ business_profile: &domain::Profile,) -> CustomResult<CheckResult, errors::ApiErrorResponse> {let should_payment_be_blocked = blocklist_utils::should_payment_be_blocked(state,platform.get_processor(),&payment_elgibility_data.payment_method_data,+ business_profile,).await?;if should_payment_be_blocked {