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
feat(authentication): added merchantId and paymentId support for better tracing for authentication service (#11386)
Sahkal Poddar18ce6e7ce727
diff --git a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rsindex f02531330a..cbcb5fb9e1 100644--- a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs@@ -43,7 +43,7 @@ use error_stack::ResultExt;#[derive(Debug, Serialize)]pub struct UnifiedAuthenticationServicePreAuthenticateRequest {pub authenticate_by: String,- pub session_id: common_utils::id_type::AuthenticationId,+ pub session_id: String,pub source_authentication_id: common_utils::id_type::AuthenticationId,pub authentication_info: Option<AuthenticationInfo>,pub service_details: Option<CtpServiceDetails>,@@ -258,7 +258,7 @@ impl TryFrom<&UnifiedAuthenticationServiceRouterData<&UasPreAuthenticationRouterUnifiedAuthenticationServiceAuthType::try_from(&item.router_data.connector_auth_type)?;Ok(Self {authenticate_by: item.router_data.connector.clone(),- session_id: authentication_id.clone(),+ session_id: item.router_data.payment_id.clone(),source_authentication_id: authentication_id,authentication_info,service_details: Some(CtpServiceDetails {@@ -283,7 +283,69 @@ impl TryFrom<&UnifiedAuthenticationServiceRouterData<&UasPreAuthenticationRouter.and_then(|service_session_ids| service_session_ids.x_src_flow_id),},),- merchant_details: None,+ merchant_details: Some(MerchantDetails {+ merchant_id: item+ .router_data+ .request+ .merchant_details+ .as_ref()+ .and_then(|details| details.merchant_id.clone()),+ merchant_name: item+ .router_data+ .request+ .merchant_details+ .as_ref()+ .and_then(|details| details.merchant_name.clone()),+ merchant_category_code: item+ .router_data+ .request+ .merchant_details+ .as_ref()+ .and_then(|details| details.merchant_category_code.clone()),+ configuration_id: None,+ endpoint_prefix: item+ .router_data+ .request+ .merchant_details+ .as_ref()+ .and_then(|details| details.endpoint_prefix.clone()),+ three_ds_requestor_url: item+ .router_data+ .request+ .merchant_details+ .as_ref()+ .and_then(|details| details.three_ds_requestor_url.clone()),+ three_ds_requestor_id: item+ .router_data+ .request+ .merchant_details+ .as_ref()+ .and_then(|details| details.three_ds_requestor_id.clone()),+ three_ds_requestor_name: item+ .router_data+ .request+ .merchant_details+ .as_ref()+ .and_then(|details| details.three_ds_requestor_name.clone()),+ merchant_country_code: item+ .router_data+ .request+ .merchant_details+ .as_ref()+ .and_then(|details| details.merchant_country_code.clone()),+ notification_url: item+ .router_data+ .request+ .merchant_details+ .as_ref()+ .and_then(|details| details.notification_url.clone()),+ webhook_url: item+ .router_data+ .request+ .merchant_details+ .as_ref()+ .and_then(|details| details.webhook_url.clone()),+ }),}),customer_details: None,pmt_details: None,@@ -648,7 +710,7 @@ impl TryFrom<&UasPreAuthenticationRouterData>let authentication_info = item.request.authentication_info.clone();Ok(Self {authenticate_by: item.connector.clone(),- session_id: authentication_id.clone(),+ session_id: item.payment_id.clone(),source_authentication_id: authentication_id,authentication_info,service_details,diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rsindex aded2bc88f..da3b01b0f3 100644--- a/crates/router/src/core/payments/operations/payment_confirm.rs+++ b/crates/router/src/core/payments/operations/payment_confirm.rs@@ -1679,6 +1679,20 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forfield_name: "payment_method",},)?;++ let merchant_details = Some(unified_authentication_service::MerchantDetails {+ merchant_id: Some(business_profile.merchant_id.get_string_repr().to_string()),+ merchant_name: None,+ merchant_category_code: business_profile.merchant_category_code.clone(),+ merchant_country_code: business_profile.merchant_country_code.clone(),+ endpoint_prefix: None,+ three_ds_requestor_url: None,+ three_ds_requestor_id: None,+ three_ds_requestor_name: None,+ notification_url: None,+ webhook_url: None,+ });+ClickToPay::pre_authentication(state,&payment_data.payment_attempt.merchant_id,@@ -1692,7 +1706,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forpayment_data.payment_intent.amount,payment_data.payment_intent.currency,payment_data.service_details.clone(),- None,+ merchant_details.as_ref(),None,None,None,