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(payment_methods): set `requires_cvv` to false when either `connector_mandate_details` or `network_transaction_id` is present during MITs (#5331)
Shankar Singh C29f8732d308e
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rsindex db95b5c838..24cc9583d9 100644--- a/crates/router/src/core/payment_methods/cards.rs+++ b/crates/router/src/core/payment_methods/cards.rs@@ -3744,6 +3744,11 @@ pub async fn list_customer_payment_method().await?;+ let is_connector_agnostic_mit_enabled = business_profile+ .as_ref()+ .and_then(|business_profile| business_profile.is_connector_agnostic_mit_enabled)+ .unwrap_or(false);+for pm in resp.into_iter() {let parent_payment_method_token = generate_id(consts::ID_LENGTH, "token");@@ -3861,9 +3866,20 @@ pub async fn list_customer_payment_method(state,&key_store,&merchant_account.merchant_id,+ is_connector_agnostic_mit_enabled,connector_mandate_details,+ pm.network_transaction_id.as_ref(),).await?;++ let requires_cvv = if is_connector_agnostic_mit_enabled {+ requires_cvv+ && !(off_session_payment_flag+ && (pm.connector_mandate_details.is_some()+ || pm.network_transaction_id.is_some()))+ } else {+ requires_cvv && !(off_session_payment_flag && pm.connector_mandate_details.is_some())+ };// Need validation for enabled payment method ,querying MCAlet pma = api::CustomerPaymentMethod {payment_token: parent_payment_method_token.to_owned(),@@ -3883,8 +3899,7 @@ pub async fn list_customer_payment_method(bank_transfer: payment_method_retrieval_context.bank_transfer_details,bank: bank_details,surcharge_details: None,- requires_cvv: requires_cvv- && !(off_session_payment_flag && pm.connector_mandate_details.is_some()),+ requires_cvv,last_used_at: Some(pm.last_used_at),default_payment_method_set: customer.default_payment_method_id.is_some()&& customer.default_payment_method_id == Some(pm.payment_method_id),@@ -3982,8 +3997,13 @@ pub async fn get_mca_status(state: &routes::SessionState,key_store: &domain::MerchantKeyStore,merchant_id: &str,+ is_connector_agnostic_mit_enabled: bool,connector_mandate_details: Option<storage::PaymentsMandateReference>,+ network_transaction_id: Option<&String>,) -> errors::RouterResult<bool> {+ if is_connector_agnostic_mit_enabled && network_transaction_id.is_some() {+ return Ok(true);+ }if let Some(connector_mandate_details) = connector_mandate_details {let mcas = state.storediff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex ccca6eaed6..acfebf9304 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -3503,7 +3503,8 @@ pub async fn decide_multiplex_connector_for_normal_or_recurring_payment<F: Clonelet merchant_connector_id = connector_data.merchant_connector_id.as_ref()- .ok_or(errors::ApiErrorResponse::InternalServerError)?;+ .ok_or(errors::ApiErrorResponse::InternalServerError)+ .attach_printable("Failed to find the merchant connector id")?;if is_network_transaction_id_flow(state,