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(router): Added authentication success check for fetching authentication value (#9769)
Sahkal Poddar79e1443c0014
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex af81c2af82..bf856569f8 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -8230,6 +8230,10 @@ impl AuthenticationStatus {pub fn is_failed(self) -> bool {self == Self::Failed}++ pub fn is_success(self) -> bool {+ self == Self::Success+ }}#[derive(diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rsindex 293cfb2cda..4799b88ea7 100644--- a/crates/router/src/core/payments/operations/payment_confirm.rs+++ b/crates/router/src/core/payments/operations/payment_confirm.rs@@ -1592,10 +1592,14 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forauthentication};- let tokenized_data = crate::core::payment_methods::vault::get_tokenized_data(state, authentication_id.get_string_repr(), false, key_store.key.get_inner()).await?;+ let tokenized_data = if updated_authentication.authentication_status.is_success() {+ Some(crate::core::payment_methods::vault::get_tokenized_data(state, authentication_id.get_string_repr(), false, key_store.key.get_inner()).await?)+ } else {+ None+ };let authentication_store = hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore {- cavv: Some(masking::Secret::new(tokenized_data.value1)),+ cavv: tokenized_data.map(|tokenized_data| masking::Secret::new(tokenized_data.value1)),authentication: updated_authentication};