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(core): add validation to check if routable connector supports network tokenization in CIT repeat flow (#6749)
Prasunna Soppa9f0d8efa8dad
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rsindex 53ec012989..041fb52091 100644--- a/crates/router/src/core/payment_methods.rs+++ b/crates/router/src/core/payment_methods.rs@@ -588,6 +588,7 @@ pub async fn retrieve_payment_method_with_token(mandate_id,payment_method_info,business_profile,+ payment_attempt.connector.clone(),).await.map(|card| Some((card, enums::PaymentMethod::Card)))?@@ -622,6 +623,7 @@ pub async fn retrieve_payment_method_with_token(mandate_id,payment_method_info,business_profile,+ payment_attempt.connector.clone(),).await.map(|card| Some((card, enums::PaymentMethod::Card)))?diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex 01bac9a212..923f6d24fe 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -1916,6 +1916,7 @@ pub async fn retrieve_card_with_permanent_token(mandate_id: Option<api_models::payments::MandateIds>,payment_method_info: Option<domain::PaymentMethod>,business_profile: &domain::Profile,+ connector: Option<String>,) -> RouterResult<domain::PaymentMethodData> {let customer_id = payment_intent.customer_id@@ -1986,7 +1987,28 @@ pub async fn retrieve_card_with_permanent_token(.attach_printable("Payment method data is not present"),(Some(ref pm_data), None) => {// Regular (non-mandate) Payment flow- if let Some(token_ref) = pm_data.network_token_requestor_reference_id.clone() {+ let network_tokenization_supported_connectors = &state+ .conf+ .network_tokenization_supported_connectors+ .connector_list;+ let connector_variant = connector+ .as_ref()+ .map(|conn| {+ api_enums::Connector::from_str(conn.as_str())+ .change_context(errors::ApiErrorResponse::InvalidDataValue {+ field_name: "connector",+ })+ .attach_printable_lazy(|| {+ format!("unable to parse connector name {connector:?}")+ })+ })+ .transpose()?;+ if let (Some(_conn), Some(token_ref)) = (+ connector_variant+ .filter(|conn| network_tokenization_supported_connectors.contains(conn)),+ pm_data.network_token_requestor_reference_id.clone(),+ ) {+ logger::info!("Fetching network token data from tokenization service");match network_tokenization::get_token_from_tokenization_service(state, token_ref, pm_data,)@@ -2016,6 +2038,8 @@ pub async fn retrieve_card_with_permanent_token(}}} else {+ logger::info!("Either the connector is not in the NT supported list or token requestor reference ID is absent");+ logger::info!("Falling back to fetch card details from locker");fetch_card_details_from_locker(state,customer_id,@@ -5773,6 +5797,7 @@ pub async fn get_payment_method_details_from_payment_token(None,None,business_profile,+ payment_attempt.connector.clone(),).await.map(|card| Some((card, enums::PaymentMethod::Card))),@@ -5791,6 +5816,7 @@ pub async fn get_payment_method_details_from_payment_token(None,None,business_profile,+ payment_attempt.connector.clone(),).await.map(|card| Some((card, enums::PaymentMethod::Card))),