From 9f94900ccdce3cde15df34395e88bd1b4c4d446e Mon Sep 17 00:00:00 2001 From: AkshayaFoiger <131388445+AkshayaFoiger@users.noreply.github.com> Date: Wed, 30 Apr 2025 17:04:05 +0530 Subject: [PATCH] fix(router): conditionally store saved cards with cvc in temp locker based on config (#7773) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- crates/router/src/core/payments/helpers.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index 962475acd2..edd62680d2 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -2637,6 +2637,21 @@ pub async fn make_pm_data<'a, F: Clone, R, D>( if let Some(vault_operation) = updated_vault_operation { payment_data.set_vault_operation(vault_operation); } + + // Temporarily store payment method data along with the cvc in redis for saved card payments, if required by the connector based on its configs + if payment_data.token.is_none() { + let (_, payment_token) = payment_methods::retrieve_payment_method_core( + &Some(payment_method_data.clone()), + state, + &payment_data.payment_intent, + &payment_data.payment_attempt, + merchant_key_store, + Some(business_profile), + ) + .await?; + + payment_data.token = payment_token; + } }; Ok::<_, error_stack::Report>(