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

feat(authentication): added VM for authentication ctp (#10803)

Sahkal Poddarbfeb44119c3a
diff --git a/crates/router/src/core/metrics.rs b/crates/router/src/core/metrics.rs
index 411a6d419b..3ba369b647 100644
--- a/crates/router/src/core/metrics.rs
+++ b/crates/router/src/core/metrics.rs
@@ -94,3 +94,9 @@ counter_metric!(PARTIAL_AUTH_FAILURE, GLOBAL_METER);
counter_metric!(API_KEY_REQUEST_INITIATED, GLOBAL_METER);
counter_metric!(API_KEY_REQUEST_COMPLETED, GLOBAL_METER);
+
+counter_metric!(
+ POST_AUTHENTICATION_CARDS_SUCCESSFULLY_DECRYPTED,
+ GLOBAL_METER
+);
+counter_metric!(POST_AUTHENTICATION_TOKEN_PUSHED_TO_VGS, GLOBAL_METER);
diff --git a/crates/router/src/core/unified_authentication_service.rs b/crates/router/src/core/unified_authentication_service.rs
index 837b32d527..98107ee53b 100644
--- a/crates/router/src/core/unified_authentication_service.rs
+++ b/crates/router/src/core/unified_authentication_service.rs
@@ -54,7 +54,7 @@ use crate::{
core::{
authentication::utils as auth_utils,
errors::utils::StorageErrorExt,
- payment_methods,
+ metrics, payment_methods,
payments::{helpers, validate_customer_details_for_click_to_pay},
unified_authentication_service::types::{
ClickToPay, ExternalAuthentication, UnifiedAuthenticationService,
@@ -1812,7 +1812,7 @@ pub async fn authentication_sync_core(
let (updated_authentication, payment_method_data, vault_token_data) =
if !authentication.authentication_status.is_terminal_status() {
let post_auth_response = if authentication_connector.is_click_to_pay() {
- ClickToPay::post_authentication(
+ let response = ClickToPay::post_authentication(
&state,
&business_profile,
None,
@@ -1823,7 +1823,9 @@ pub async fn authentication_sync_core(
merchant_id,
None,
)
- .await?
+ .await?;
+ metrics::POST_AUTHENTICATION_CARDS_SUCCESSFULLY_DECRYPTED.add(1, &[]);
+ response
} else {
ExternalAuthentication::post_authentication(
&state,
@@ -1857,13 +1859,15 @@ pub async fn authentication_sync_core(
// Do not tokenize if the disable flag is present in the config
None
} else {
- Box::pin(utils::get_auth_multi_token_from_external_vault(
+ let response = Box::pin(utils::get_auth_multi_token_from_external_vault(
&state,
&platform,
&business_profile,
&post_auth_response,
))
- .await?
+ .await?;
+ metrics::POST_AUTHENTICATION_TOKEN_PUSHED_TO_VGS.add(1, &[]);
+ response
};
let payment_method_data =