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(constraint_graph): add setup_future_usage for mandate check in payments (#6744)
Prajjwal Kumar1aa4ad60e232
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rsindex 259f77c81a..1357596110 100644--- a/crates/router/src/core/payment_methods/cards.rs+++ b/crates/router/src/core/payment_methods/cards.rs@@ -4558,6 +4558,12 @@ pub async fn filter_payment_methods(if payment_attempt.and_then(|attempt| attempt.mandate_details.as_ref()).is_some()+ || payment_intent+ .and_then(|intent| intent.setup_future_usage)+ .map(|future_usage| {+ future_usage == common_enums::FutureUsage::OffSession+ })+ .unwrap_or(false){context_values.push(dir::DirValue::PaymentType(euclid::enums::PaymentType::NewMandate,@@ -4576,7 +4582,14 @@ pub async fn filter_payment_methods(payment_attempt.map(|attempt| {- attempt.mandate_data.is_none() && attempt.mandate_details.is_none()+ attempt.mandate_data.is_none()+ && attempt.mandate_details.is_none()+ && payment_intent+ .and_then(|intent| intent.setup_future_usage)+ .map(|future_usage| {+ future_usage == common_enums::FutureUsage::OnSession+ })+ .unwrap_or(false)}).and_then(|res| {res.then(|| {diff --git a/crates/router/src/core/payment_methods/utils.rs b/crates/router/src/core/payment_methods/utils.rsindex 816807fe01..d7e83cb5bf 100644--- a/crates/router/src/core/payment_methods/utils.rs+++ b/crates/router/src/core/payment_methods/utils.rs@@ -429,16 +429,20 @@ fn construct_supported_connectors_for_update_mandate_node(}}- Ok(Some(- builder- .make_any_aggregator(- &agg_nodes,- Some("any node for card and non card pm"),- None::<()>,- Some(domain_id),- )- .map_err(KgraphError::GraphConstructionError)?,- ))+ if !agg_nodes.is_empty() {+ Ok(Some(+ builder+ .make_any_aggregator(+ &agg_nodes,+ Some("any node for card and non card pm"),+ None::<()>,+ Some(domain_id),+ )+ .map_err(KgraphError::GraphConstructionError)?,+ ))+ } else {+ Ok(None)+ }}fn construct_supported_connectors_for_mandate_node(