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
Refactor: Customer email and browser Information (#7034)
Amey Waled35a9222815e
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rsindex 2517559e2f..2f8594662e 100644--- a/crates/hyperswitch_domain_models/src/router_request_types.rs+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs@@ -491,6 +491,27 @@ pub struct BrowserInformation {pub device_model: Option<String>,}+#[cfg(feature = "v2")]+impl From<common_utils::types::BrowserInformation> for BrowserInformation {+ fn from(value: common_utils::types::BrowserInformation) -> Self {+ Self {+ color_depth: value.color_depth,+ java_enabled: value.java_enabled,+ java_script_enabled: value.java_script_enabled,+ language: value.language,+ screen_height: value.screen_height,+ screen_width: value.screen_width,+ time_zone: value.time_zone,+ ip_address: value.ip_address,+ accept_header: value.accept_header,+ user_agent: value.user_agent,+ os_type: value.os_type,+ os_version: value.os_version,+ device_model: value.device_model,+ }+ }+}+#[derive(Debug, Clone, Default, Serialize)]pub enum ResponseId {ConnectorTransactionId(String),diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex 70db7a581a..80c10a294e 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -241,6 +241,17 @@ pub async fn construct_payment_router_data_for_authorize<'a>(.map(|id| id.get_string_repr().to_owned()).unwrap_or(payment_data.payment_attempt.id.get_string_repr().to_owned());+ let email = customer+ .as_ref()+ .and_then(|customer| customer.email.clone())+ .map(pii::Email::from);++ let browser_info = payment_data+ .payment_attempt+ .browser_info+ .clone()+ .map(types::BrowserInformation::from);+// TODO: few fields are repeated in both routerdata and requestlet request = types::PaymentsAuthorizeData {payment_method_data: payment_data@@ -262,8 +273,8 @@ pub async fn construct_payment_router_data_for_authorize<'a>(minor_amount: payment_data.payment_attempt.amount_details.get_net_amount(),order_tax_amount: None,currency: payment_data.payment_intent.amount_details.currency,- browser_info: None,- email: None,+ browser_info,+ email,customer_name: None,payment_experience: None,order_details: None,