Skip to content

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

fix(authentication): skip authentication table fetch when modular auth service is enabled (#14908)

Sahkal Poddarb89e8ae4173f
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index c0cbd0ae3b..450953c5fa 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -487,34 +487,40 @@ async fn get_tracker_for_sync<
let key_manager_state = &(state).into();
- let authentication_store =
- if let Some(ref authentication_id) = payment_attempt.authentication_id {
- let authentication = db
- .find_authentication_by_processor_merchant_id_authentication_id(
- platform.get_processor().get_account().get_id(),
- authentication_id,
- platform.get_processor().get_key_store(),
- key_manager_state,
- platform.get_processor().get_account().storage_scheme,
+ // When the authentication micro-service is enabled, the authentication record lives in that
+ // service and is never stored locally, so there is nothing to fetch here.
+ let authentication_id = payment_attempt
+ .authentication_id
+ .as_ref()
+ .filter(|_| state.conf.micro_services.authentication_service.is_none());
+
+ let authentication_store = if let Some(authentication_id) = authentication_id {
+ let authentication = db
+ .find_authentication_by_processor_merchant_id_authentication_id(
+ platform.get_processor().get_account().get_id(),
+ authentication_id,
+ platform.get_processor().get_key_store(),
+ key_manager_state,
+ platform.get_processor().get_account().storage_scheme,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable_lazy(|| {
+ format!(
+ "Error while fetching authentication record with authentication_id {}",
+ authentication_id.get_string_repr()
)
- .await
- .to_not_found_response(errors::ApiErrorResponse::InternalServerError)
- .attach_printable_lazy(|| {
- format!(
- "Error while fetching authentication record with authentication_id {}",
- authentication_id.get_string_repr()
- )
- })?;
+ })?;
- Some(
+ Some(
hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore {
authentication,
cavv: None, // marking this as None since we don't need authentication value in payment status flow
},
)
- } else {
- None
- };
+ } else {
+ None
+ };
let payment_link_data = payment_intent
.payment_link_id