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
chore: Wallets Refactor and Added Paze in tunnel HS<>UCS (#11338)
Amitsingh Tanwareb831bfc3d75
diff --git a/Cargo.lock b/Cargo.lockindex fc7e8af2f2..914aa68333 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2183,7 +2183,7 @@ dependencies = [[[package]]name = "config_patch_derive"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=5976300a6eb3746990502970ca089b4eac4b4e24#5976300a6eb3746990502970ca089b4eac4b4e24"+source = "git+https://github.com/juspay/connector-service?rev=bb898deefab57b6100ca07754c1427a8035cfe50#bb898deefab57b6100ca07754c1427a8035cfe50"dependencies = ["proc-macro2","quote",@@ -3854,7 +3854,7 @@ dependencies = [[[package]]name = "grpc-api-types"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=5976300a6eb3746990502970ca089b4eac4b4e24#5976300a6eb3746990502970ca089b4eac4b4e24"+source = "git+https://github.com/juspay/connector-service?rev=bb898deefab57b6100ca07754c1427a8035cfe50#bb898deefab57b6100ca07754c1427a8035cfe50"dependencies = ["axum 0.8.4","error-stack 0.5.0",@@ -7561,7 +7561,7 @@ dependencies = [[[package]]name = "rust-grpc-client"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=5976300a6eb3746990502970ca089b4eac4b4e24#5976300a6eb3746990502970ca089b4eac4b4e24"+source = "git+https://github.com/juspay/connector-service?rev=bb898deefab57b6100ca07754c1427a8035cfe50#bb898deefab57b6100ca07754c1427a8035cfe50"dependencies = ["grpc-api-types",]@@ -10362,7 +10362,7 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"[[package]]name = "ucs_cards"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=5976300a6eb3746990502970ca089b4eac4b4e24#5976300a6eb3746990502970ca089b4eac4b4e24"+source = "git+https://github.com/juspay/connector-service?rev=bb898deefab57b6100ca07754c1427a8035cfe50#bb898deefab57b6100ca07754c1427a8035cfe50"dependencies = ["bytes 1.10.1","error-stack 0.4.1",@@ -10378,7 +10378,7 @@ dependencies = [[[package]]name = "ucs_common_enums"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=5976300a6eb3746990502970ca089b4eac4b4e24#5976300a6eb3746990502970ca089b4eac4b4e24"+source = "git+https://github.com/juspay/connector-service?rev=bb898deefab57b6100ca07754c1427a8035cfe50#bb898deefab57b6100ca07754c1427a8035cfe50"dependencies = ["serde","strum 0.26.3",@@ -10389,7 +10389,7 @@ dependencies = [[[package]]name = "ucs_common_utils"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=5976300a6eb3746990502970ca089b4eac4b4e24#5976300a6eb3746990502970ca089b4eac4b4e24"+source = "git+https://github.com/juspay/connector-service?rev=bb898deefab57b6100ca07754c1427a8035cfe50#bb898deefab57b6100ca07754c1427a8035cfe50"dependencies = ["anyhow","base64 0.21.7",diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.tomlindex 511a64935e..288e5bf474 100644--- a/crates/external_services/Cargo.toml+++ b/crates/external_services/Cargo.toml@@ -69,7 +69,7 @@ reqwest = { version = "0.11.27", features = ["rustls-tls"] }http = "0.2.12"url = { version = "2.5.4", features = ["serde"] }quick-xml = { version = "0.31.0", features = ["serialize"] }-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "5976300a6eb3746990502970ca089b4eac4b4e24", package = "rust-grpc-client" }+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "bb898deefab57b6100ca07754c1427a8035cfe50", package = "rust-grpc-client" }open-feature = { version = "0.2.5", optional = true }superposition_provider = { version = "0.97.0", optional = true }diff --git a/crates/hyperswitch_interfaces/Cargo.toml b/crates/hyperswitch_interfaces/Cargo.tomlindex 570e039313..78ab437bc4 100644--- a/crates/hyperswitch_interfaces/Cargo.toml+++ b/crates/hyperswitch_interfaces/Cargo.toml@@ -30,7 +30,7 @@ strum = { version = "0.26", features = ["derive"] }thiserror = "1.0.69"time = "0.3.41"url = { version = "2.5.4", features = ["serde"] }-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "5976300a6eb3746990502970ca089b4eac4b4e24", package = "rust-grpc-client" }+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "bb898deefab57b6100ca07754c1427a8035cfe50", package = "rust-grpc-client" }unified-connector-service-masking = { git = "https://github.com/juspay/hyperswitch", tag = "2025.11.24.0", package = "masking" }tokio = { version = "1.45.1", features = ["macros", "rt-multi-thread"] }diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.tomlindex 98d3f6772a..437213da55 100644--- a/crates/router/Cargo.toml+++ b/crates/router/Cargo.toml@@ -90,8 +90,8 @@ reqwest = { version = "0.11.27", features = ["json", "rustls-tls", "gzip", "multring = "0.17.14"rust_decimal = { version = "1.37.1", features = ["serde-with-float", "serde-with-str"] }rust-i18n = { git = "https://github.com/kashif-m/rust-i18n", rev = "f2d8096aaaff7a87a847c35a5394c269f75e077a" }-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "5976300a6eb3746990502970ca089b4eac4b4e24", package = "rust-grpc-client" }-unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "5976300a6eb3746990502970ca089b4eac4b4e24", package = "ucs_cards" }+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "bb898deefab57b6100ca07754c1427a8035cfe50", package = "rust-grpc-client" }+unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "bb898deefab57b6100ca07754c1427a8035cfe50", package = "ucs_cards" }unified-connector-service-masking = { git = "https://github.com/juspay/hyperswitch", tag = "2025.11.24.0", package = "masking" }rustc-hash = "1.1.0"rustls = "0.22"diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rsindex 70b3e6a747..e078f4223a 100644--- a/crates/router/src/core/unified_connector_service.rs+++ b/crates/router/src/core/unified_connector_service.rs@@ -33,7 +33,7 @@ use hyperswitch_domain_models::merchant_connector_account::{};use hyperswitch_domain_models::{platform::Processor,- router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, PaymentMethodToken, RouterData},router_flow_types::refunds,router_request_types::RefundsData,router_response_types::{PaymentsResponseData, RefundsResponseData},@@ -71,6 +71,57 @@ use crate::{};pub mod transformers;+/// Returns Apple Pay data from payment method token when it has decrypt data,+/// otherwise returns the original payment data.+fn get_apple_pay_payment_data(+ payment_data: &common_types::payments::ApplePayPaymentData,+ payment_method_token: Option<&PaymentMethodToken>,+) -> common_types::payments::ApplePayPaymentData {+ match (payment_data, payment_method_token) {+ (+ common_types::payments::ApplePayPaymentData::Encrypted(_),+ Some(PaymentMethodToken::ApplePayDecrypt(apple_pay_decrypt_data)),+ ) => common_types::payments::ApplePayPaymentData::Decrypted(+ apple_pay_decrypt_data.as_ref().clone(),+ ),+ // Fallback: keep original payload for non-matching token cases.+ _ => payment_data.clone(),+ }+}++/// Returns Google Pay tokenization data from payment method token when it has decrypt data,+/// otherwise returns the original tokenization data.+fn get_google_pay_tokenization_data(+ tokenization_data: &common_types::payments::GpayTokenizationData,+ payment_method_token: Option<&PaymentMethodToken>,+) -> common_types::payments::GpayTokenizationData {+ match (tokenization_data, payment_method_token) {+ (+ common_types::payments::GpayTokenizationData::Encrypted(_),+ Some(PaymentMethodToken::GooglePayDecrypt(google_pay_decrypt_data)),+ ) => common_types::payments::GpayTokenizationData::Decrypted(+ google_pay_decrypt_data.as_ref().clone(),+ ),+ // Fallback: keep original payload for non-matching token cases.+ _ => tokenization_data.clone(),+ }+}++/// Returns Paze data from payment method token when it has decrypt data,+/// otherwise returns data from wallet payload.+fn get_paze_wallet_data(+ wallet_data: &hyperswitch_domain_models::payment_method_data::PazeWalletData,+ payment_method_token: Option<&PaymentMethodToken>,+) -> CustomResult<payments_grpc::paze_wallet::PazeData, UnifiedConnectorServiceError> {+ match payment_method_token {+ Some(PaymentMethodToken::PazeDecrypt(paze_decrypted_data)) => {+ Ok(payments_grpc::paze_wallet::PazeData::DecryptedData(+ payments_grpc::PazeDecryptedData::foreign_try_from(paze_decrypted_data.as_ref())?,+ ))+ }+ _ => payments_grpc::paze_wallet::PazeData::foreign_try_from(wallet_data),+ }+}pub async fn get_access_token_from_ucs_response(session_state: &SessionState,@@ -83,7 +134,13 @@ pub async fn get_access_token_from_ucs_response(let ucs_access_token = ucs_state.and_then(|state| state.access_token.as_ref()).map(AccessToken::foreign_try_from)- .transpose()?;+ .transpose()+ .inspect_err(|err| {+ logger::warn!(+ error = ?err,+ "Invalid access token received from UCS connector state"+ )+ })?;let merchant_id = processor.get_account().get_id();@@ -659,6 +716,7 @@ pub async fn should_call_unified_connector_service_for_webhooks(pub fn build_unified_connector_service_payment_method(payment_method_data: hyperswitch_domain_models::payment_method_data::PaymentMethodData,payment_method_type: Option<PaymentMethodType>,+ payment_method_token: Option<&PaymentMethodToken>,) -> CustomResult<payments_grpc::PaymentMethod, UnifiedConnectorServiceError> {match payment_method_data {hyperswitch_domain_models::payment_method_data::PaymentMethodData::Card(card) => {@@ -1088,40 +1146,64 @@ pub fn build_unified_connector_service_payment_method(}),hyperswitch_domain_models::payment_method_data::WalletData::ApplePay(apple_pay_wallet_data- ) => Ok(payments_grpc::PaymentMethod {- payment_method: Some(PaymentMethod::ApplePay(payments_grpc::AppleWallet {- payment_data: Some(payments_grpc::apple_wallet::PaymentData {- payment_data: Some(payments_grpc::apple_wallet::payment_data::PaymentData::foreign_try_from(&apple_pay_wallet_data.payment_data)?),- }),- payment_method: Some(payments_grpc::apple_wallet::PaymentMethod {- display_name: apple_pay_wallet_data.payment_method.display_name,- network: apple_pay_wallet_data.payment_method.network,- r#type: apple_pay_wallet_data.payment_method.pm_type,- }),- transaction_identifier: apple_pay_wallet_data.transaction_identifier,- })),- }),+ ) => {+ let apple_pay_payment_data = get_apple_pay_payment_data(+ &apple_pay_wallet_data.payment_data,+ payment_method_token,+ );++ let payment_data =+ payments_grpc::apple_wallet::payment_data::PaymentData::foreign_try_from(+ &apple_pay_payment_data,+ )?;++ Ok(payments_grpc::PaymentMethod {+ payment_method: Some(PaymentMethod::ApplePay(payments_grpc::AppleWallet {+ payment_data: Some(payments_grpc::apple_wallet::PaymentData {+ payment_data: Some(payment_data),+ }),+ payment_method: Some(payments_grpc::apple_wallet::PaymentMethod {+ display_name: apple_pay_wallet_data.payment_method.display_name,+ network: apple_pay_wallet_data.payment_method.network,+ r#type: apple_pay_wallet_data.payment_method.pm_type,+ }),+ transaction_identifier: apple_pay_wallet_data.transaction_identifier,+ })),+ })+ }hyperswitch_domain_models::payment_method_data::WalletData::GooglePay(google_pay_wallet_data,- ) => Ok(payments_grpc::PaymentMethod {- payment_method: Some(PaymentMethod::GooglePay(payments_grpc::GoogleWallet {- r#type: google_pay_wallet_data.pm_type,- description: google_pay_wallet_data.description,- info: Some(payments_grpc::google_wallet::PaymentMethodInfo {- card_network: google_pay_wallet_data.info.card_network,- card_details: google_pay_wallet_data.info.card_details,- assurance_details: google_pay_wallet_data.info.assurance_details.map(|details| {- payments_grpc::google_wallet::payment_method_info::AssuranceDetails {- card_holder_authenticated: details.card_holder_authenticated,- account_verified: details.account_verified,- }+ ) => {+ let google_pay_tokenization_data = get_google_pay_tokenization_data(+ &google_pay_wallet_data.tokenization_data,+ payment_method_token,+ );++ let tokenization_data =+ payments_grpc::google_wallet::tokenization_data::TokenizationData::foreign_try_from(+ &google_pay_tokenization_data,+ )?;++ Ok(payments_grpc::PaymentMethod {+ payment_method: Some(PaymentMethod::GooglePay(payments_grpc::GoogleWallet {+ r#type: google_pay_wallet_data.pm_type,+ description: google_pay_wallet_data.description,+ info: Some(payments_grpc::google_wallet::PaymentMethodInfo {+ card_network: google_pay_wallet_data.info.card_network,+ card_details: google_pay_wallet_data.info.card_details,+ assurance_details: google_pay_wallet_data.info.assurance_details.map(|details| {+ payments_grpc::google_wallet::payment_method_info::AssuranceDetails {+ card_holder_authenticated: details.card_holder_authenticated,+ account_verified: details.account_verified,+ }+ }),}),- }),- tokenization_data: Some(payments_grpc::google_wallet::TokenizationData {- tokenization_data: Some(payments_grpc::google_wallet::tokenization_data::TokenizationData::foreign_try_from(&google_pay_wallet_data.tokenization_data)?),- }),- })),- }),+ tokenization_data: Some(payments_grpc::google_wallet::TokenizationData {+ tokenization_data: Some(tokenization_data),+ }),+ })),+ })+ }hyperswitch_domain_models::payment_method_data::WalletData::GooglePayThirdPartySdk(google_pay_sdk_data,) => {@@ -1204,6 +1286,14 @@ pub fn build_unified_connector_service_payment_method(})),}),+ hyperswitch_domain_models::payment_method_data::WalletData::Paze(paze_data) => {+ let paze_wallet_data = get_paze_wallet_data(&paze_data, payment_method_token)?;+ Ok(payments_grpc::PaymentMethod {+ payment_method: Some(PaymentMethod::Paze(payments_grpc::PazeWallet {+ paze_data: Some(paze_wallet_data),+ })),+ })+ }_ => Err(UnifiedConnectorServiceError::NotImplemented(format!("Unimplemented payment method subtype: {payment_method_type:?}"))diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rsindex 9ca639bb38..85ffe2cd84 100644--- a/crates/router/src/core/unified_connector_service/transformers.rs+++ b/crates/router/src/core/unified_connector_service/transformers.rs@@ -152,12 +152,12 @@ impl// Always build payment_method using payment_method_data (which is non-optional).// payment_method_type is passed as optional, but payment_method must always be present// for UCS to process the tokenization request.- let payment_method = Some(+ let payment_method =unified_connector_service::build_unified_connector_service_payment_method(router_data.request.payment_method_data.clone(),router_data.request.payment_method_type,- )?,- );+ router_data.payment_method_token.as_ref(),+ )?;let address = payments_grpc::PaymentAddress::foreign_try_from(router_data.address.clone())?;@@ -173,7 +173,7 @@ implamount,currency: currency.into(),minor_amount: amount,- payment_method,+ payment_method: Some(payment_method),customer_name: None,email: None,customer_id: None,@@ -202,12 +202,12 @@ impl) -> Result<Self, Self::Error> {let currency = payments_grpc::Currency::foreign_try_from(router_data.request.currency)?;- let payment_method = Some(+ let payment_method =unified_connector_service::build_unified_connector_service_payment_method(router_data.request.payment_method_data.clone(),router_data.request.payment_method_type,- )?,- );+ router_data.payment_method_token.as_ref(),+ )?;let address = payments_grpc::PaymentAddress::foreign_try_from(router_data.address.clone())?;@@ -269,7 +269,7 @@ implconnector_order_reference_id: router_data.request.order_id.clone(),amount: router_data.request.amount,currency: currency.into(),- payment_method,+ payment_method: Some(payment_method),return_url: router_data.request.router_return_url.clone(),address: Some(address),auth_type: auth_type.into(),@@ -337,8 +337,10 @@ implpayment_method_token: router_data.payment_method_token.as_ref()- .and_then(|pmt| pmt.get_payment_method_token())- .map(ExposeInterface::expose),+ .and_then(|payment_method_token| payment_method_token.get_payment_method_token())+ .map(|payment_method_token| {+ unified_connector_service_masking::Secret::new(payment_method_token.expose())+ }),merchant_account_metadata,description: router_data.description.clone(),setup_mandate_details: router_data@@ -420,6 +422,7 @@ implunified_connector_service::build_unified_connector_service_payment_method(payment_method_data,router_data.request.payment_method_type,+ router_data.payment_method_token.as_ref(),)}).transpose()?;@@ -548,8 +551,10 @@ implpayment_method_token: router_data.payment_method_token.as_ref()- .and_then(|pmt| pmt.get_payment_method_token())- .map(ExposeInterface::expose),+ .and_then(|payment_method_token| payment_method_token.get_payment_method_token())+ .map(|payment_method_token| {+ unified_connector_service_masking::Secret::new(payment_method_token.expose())+ }),merchant_account_metadata,description: router_data.description.clone(),setup_mandate_details: router_data@@ -918,6 +923,7 @@ implunified_connector_service::build_unified_connector_service_payment_method(payment_method_data,router_data.request.payment_method_type,+ router_data.payment_method_token.as_ref(),)}).transpose()?;@@ -1022,6 +1028,7 @@ implunified_connector_service::build_unified_connector_service_payment_method(payment_method_data,router_data.request.payment_method_type,+ router_data.payment_method_token.as_ref(),)}).transpose()?;@@ -1100,12 +1107,12 @@ implrouter_data.request.currency.unwrap_or_default(),)?;- let payment_method = Some(+ let payment_method =unified_connector_service::build_unified_connector_service_payment_method(router_data.request.payment_method_data.clone(),router_data.request.payment_method_type,- )?,- );+ router_data.payment_method_token.as_ref(),+ )?;let capture_method = router_data.request@@ -1141,7 +1148,7 @@ implamount,currency: currency.into(),minor_amount: minor_amount.get_amount_as_i64(),- payment_method,+ payment_method: Some(payment_method),email: router_data.request@@ -1286,6 +1293,7 @@ implunified_connector_service::build_unified_connector_service_payment_method(payment_method_data,router_data.request.payment_method_type,+ router_data.payment_method_token.as_ref(),)}).transpose()?;@@ -1414,12 +1422,12 @@ impl) -> Result<Self, Self::Error> {let currency = payments_grpc::Currency::foreign_try_from(router_data.request.currency)?;- let payment_method = Some(+ let payment_method =unified_connector_service::build_unified_connector_service_payment_method(router_data.request.payment_method_data.clone(),router_data.request.payment_method_type,- )?,- );+ router_data.payment_method_token.as_ref(),+ )?;let address = payments_grpc::PaymentAddress::foreign_try_from(router_data.address.clone())?;@@ -1480,7 +1488,7 @@ implOk(Self {amount: router_data.request.amount,currency: currency.into(),- payment_method,+ payment_method: Some(payment_method),return_url: router_data.request.router_return_url.clone(),address: Some(address),auth_type: auth_type.into(),@@ -1763,12 +1771,12 @@ implrouter_data: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,) -> Result<Self, Self::Error> {let currency = payments_grpc::Currency::foreign_try_from(router_data.request.currency)?;- let payment_method = Some(+ let payment_method =unified_connector_service::build_unified_connector_service_payment_method(router_data.request.payment_method_data.clone(),router_data.request.payment_method_type,- )?,- );+ router_data.payment_method_token.as_ref(),+ )?;let address = payments_grpc::PaymentAddress::foreign_try_from(router_data.address.clone())?;let auth_type = payments_grpc::AuthenticationType::foreign_try_from(router_data.auth_type)?;let browser_info = router_data@@ -1805,21 +1813,20 @@ impl.map(ConnectorState::foreign_from);Ok(Self {- payment_method_token: router_data.payment_method_token.as_ref().and_then(|payment_method_token|{- match payment_method_token {- hyperswitch_domain_models::router_data::PaymentMethodToken::Token(secret_token) => Some(secret_token.peek().clone()),- hyperswitch_domain_models::router_data::PaymentMethodToken::ApplePayDecrypt(_) |- hyperswitch_domain_models::router_data::PaymentMethodToken::GooglePayDecrypt(_) |- hyperswitch_domain_models::router_data::PaymentMethodToken::PazeDecrypt(_) => None- }- }),+ payment_method_token: router_data+ .payment_method_token+ .as_ref()+ .and_then(|payment_method_token| payment_method_token.get_payment_method_token())+ .map(|payment_method_token| {+ unified_connector_service_masking::Secret::new(payment_method_token.expose())+ }),request_ref_id: Some(Identifier {id_type: Some(payments_grpc::identifier::IdType::Id(router_data.connector_request_reference_id.clone(),)),}),currency: currency.into(),- payment_method,+ payment_method: Some(payment_method),minor_amount: Some(router_data.request.amount),email: router_data.request@@ -1880,17 +1887,26 @@ implstate,order_id: None,connector_metadata: None,- enable_partial_authorization: router_data.request.enable_partial_authorization.map(|e| e.is_true()),- billing_descriptor: router_data.request.billing_descriptor.as_ref().map(payments_grpc::BillingDescriptor::foreign_from),- payment_channel: router_data.request.payment_channel.as_ref().map(payments_grpc::PaymentChannel::foreign_try_from)+ enable_partial_authorization: router_data+ .request+ .enable_partial_authorization+ .map(|e| e.is_true()),+ billing_descriptor: router_data+ .request+ .billing_descriptor+ .as_ref()+ .map(payments_grpc::BillingDescriptor::foreign_from),+ payment_channel: router_data+ .request+ .payment_channel+ .as_ref()+ .map(payments_grpc::PaymentChannel::foreign_try_from).transpose()?.map(|payment_channel| payment_channel.into()),locale: None,- connector_testing_data: router_data- .request- .connector_testing_data- .as_ref()- .map(|data| unified_connector_service_masking::Secret::new(data.peek().to_string())),+ connector_testing_data: router_data.request.connector_testing_data.as_ref().map(+ |data| unified_connector_service_masking::Secret::new(data.peek().to_string()),+ ),})}}@@ -1993,17 +2009,21 @@ impl.as_ref().map(ConnectorState::foreign_from);- let payment_method = match router_data.request.payment_method_data {+ let payment_method_data = match router_data.request.payment_method_data.clone() {hyperswitch_domain_models::payment_method_data::PaymentMethodData::MandatePayment => {None}- _ => Some(+ payment_method_data => Some(payment_method_data),+ };+ let payment_method = payment_method_data+ .map(|payment_method_data| {unified_connector_service::build_unified_connector_service_payment_method(- router_data.request.payment_method_data.clone(),+ payment_method_data,router_data.request.payment_method_type,- )?,- ),- };+ router_data.payment_method_token.as_ref(),+ )+ })+ .transpose()?;let authentication_data = router_data.request@@ -3280,7 +3300,7 @@ impl transformers::ForeignTryFrom<&common_types::payments::ApplePayPaymentData>"Failed to parse card number".to_string(),),)?;- Ok(Self::DecryptedData(payments_grpc::ApplePayPredecryptData {+ Ok(Self::DecryptedData(payments_grpc::ApplePayDecryptedData {application_primary_account_number: Some(application_primary_account_number),application_expiration_month: Some(decrypted_data@@ -3313,6 +3333,168 @@ impl transformers::ForeignTryFrom<&common_types::payments::ApplePayPaymentData>}}+impl transformers::ForeignTryFrom<&hyperswitch_domain_models::router_data::PazeToken>+ for payments_grpc::PazeToken+{+ type Error = error_stack::Report<UnifiedConnectorServiceError>;++ fn foreign_try_from(+ value: &hyperswitch_domain_models::router_data::PazeToken,+ ) -> Result<Self, Self::Error> {+ let payment_token = NetworkToken::from_str(&value.payment_token.get_card_no())+ .change_context(+ UnifiedConnectorServiceError::RequestEncodingFailedWithReason(+ "Failed to parse network token".to_string(),+ ),+ )?;+ Ok(Self {+ payment_token: Some(payment_token),+ token_expiration_month: Some(value.token_expiration_month.clone().expose().into()),+ token_expiration_year: Some(value.token_expiration_year.clone().expose().into()),+ payment_account_reference: Some(+ value.payment_account_reference.clone().expose().into(),+ ),+ })+ }+}++impl transformers::ForeignTryFrom<&hyperswitch_domain_models::router_data::PazeDynamicData>+ for payments_grpc::PazeDynamicData+{+ type Error = error_stack::Report<UnifiedConnectorServiceError>;++ fn foreign_try_from(+ value: &hyperswitch_domain_models::router_data::PazeDynamicData,+ ) -> Result<Self, Self::Error> {+ Ok(Self {+ dynamic_data_value: value+ .dynamic_data_value+ .clone()+ .map(|dynamic_data| dynamic_data.expose().into()),+ dynamic_data_type: value.dynamic_data_type.clone(),+ dynamic_data_expiration: value.dynamic_data_expiration.clone(),+ })+ }+}++impl transformers::ForeignTryFrom<&hyperswitch_domain_models::router_data::PazePhoneNumber>+ for payments_grpc::PazePhoneNumber+{+ type Error = error_stack::Report<UnifiedConnectorServiceError>;++ fn foreign_try_from(+ value: &hyperswitch_domain_models::router_data::PazePhoneNumber,+ ) -> Result<Self, Self::Error> {+ Ok(Self {+ country_code: Some(value.country_code.clone().expose().into()),+ phone_number: Some(value.phone_number.clone().expose().into()),+ })+ }+}++impl transformers::ForeignTryFrom<&hyperswitch_domain_models::router_data::PazeConsumer>+ for payments_grpc::PazeConsumer+{+ type Error = error_stack::Report<UnifiedConnectorServiceError>;++ fn foreign_try_from(+ value: &hyperswitch_domain_models::router_data::PazeConsumer,+ ) -> Result<Self, Self::Error> {+ Ok(Self {+ first_name: value+ .first_name+ .clone()+ .map(|first_name| first_name.expose().into()),+ last_name: value+ .last_name+ .clone()+ .map(|last_name| last_name.expose().into()),+ full_name: Some(value.full_name.clone().expose().into()),+ email_address: Some(value.email_address.clone().expose().expose().into()),+ mobile_number: value+ .mobile_number+ .as_ref()+ .map(payments_grpc::PazePhoneNumber::foreign_try_from)+ .transpose()?,+ country_code: value.country_code.and_then(|country_code| {+ payments_grpc::CountryAlpha2::from_str_name(&country_code.to_string())+ .map(|country| country.into())+ }),+ language_code: value.language_code.clone(),+ })+ }+}++impl transformers::ForeignTryFrom<&hyperswitch_domain_models::router_data::PazeAddress>+ for payments_grpc::PazeAddress+{+ type Error = error_stack::Report<UnifiedConnectorServiceError>;++ fn foreign_try_from(+ value: &hyperswitch_domain_models::router_data::PazeAddress,+ ) -> Result<Self, Self::Error> {+ Ok(Self {+ name: value.name.clone().map(|name| name.expose().into()),+ line1: value.line1.clone().map(|line1| line1.expose().into()),+ line2: value.line2.clone().map(|line2| line2.expose().into()),+ line3: value.line3.clone().map(|line3| line3.expose().into()),+ city: value.city.clone().map(|city| city.expose().into()),+ state: value.state.clone().map(|state| state.expose().into()),+ zip: value.zip.clone().map(|zip| zip.expose().into()),+ country_code: value.country_code.and_then(|country_code| {+ payments_grpc::CountryAlpha2::from_str_name(&country_code.to_string())+ .map(|country| country.into())+ }),+ })+ }+}++impl transformers::ForeignTryFrom<&hyperswitch_domain_models::router_data::PazeDecryptedData>+ for payments_grpc::PazeDecryptedData+{+ type Error = error_stack::Report<UnifiedConnectorServiceError>;++ fn foreign_try_from(+ value: &hyperswitch_domain_models::router_data::PazeDecryptedData,+ ) -> Result<Self, Self::Error> {+ Ok(Self {+ client_id: Some(value.client_id.clone().expose().into()),+ profile_id: value.profile_id.clone(),+ token: Some(payments_grpc::PazeToken::foreign_try_from(&value.token)?),+ payment_card_network: payments_grpc::CardNetwork::foreign_from(+ value.payment_card_network.clone(),+ )+ .into(),+ dynamic_data: value+ .dynamic_data+ .iter()+ .map(payments_grpc::PazeDynamicData::foreign_try_from)+ .collect::<Result<Vec<_>, _>>()?,+ billing_address: Some(payments_grpc::PazeAddress::foreign_try_from(+ &value.billing_address,+ )?),+ consumer: Some(payments_grpc::PazeConsumer::foreign_try_from(+ &value.consumer,+ )?),+ eci: value.eci.clone(),+ })+ }+}++impl transformers::ForeignTryFrom<&hyperswitch_domain_models::payment_method_data::PazeWalletData>+ for payments_grpc::paze_wallet::PazeData+{+ type Error = error_stack::Report<UnifiedConnectorServiceError>;++ fn foreign_try_from(+ value: &hyperswitch_domain_models::payment_method_data::PazeWalletData,+ ) -> Result<Self, Self::Error> {+ Ok(Self::CompleteResponse(+ value.complete_response.clone().expose().into(),+ ))+ }+}+impl transformers::ForeignTryFrom<&common_types::payments::GpayTokenizationData>for payments_grpc::google_wallet::tokenization_data::TokenizationData{@@ -3323,7 +3505,7 @@ impl transformers::ForeignTryFrom<&common_types::payments::GpayTokenizationData>) -> Result<Self, Self::Error> {match tokenization_data {common_types::payments::GpayTokenizationData::Encrypted(encrypted_data) => Ok(- Self::EncryptedData(payments_grpc::GpayEncryptedTokenizationData {+ Self::EncryptedData(payments_grpc::GooglePayEncryptedTokenizationData {token_type: encrypted_data.token_type.clone(),token: encrypted_data.token.clone(),}),@@ -3339,7 +3521,7 @@ impl transformers::ForeignTryFrom<&common_types::payments::GpayTokenizationData>"Failed to parse card number".to_string(),),)?;- Ok(Self::DecryptedData(payments_grpc::GPayPredecryptData {+ Ok(Self::DecryptedData(payments_grpc::GooglePayDecryptedData {card_exp_month: Some(decrypted_data.card_exp_month.clone().expose().into()),card_exp_year: Some(decrypted_data.card_exp_year.clone().expose().into()),application_primary_account_number: Some(application_primary_account_number),