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(router): [stripe] add support for googlepay via stripe connect (#10466)
AkshayaFoigerb5ae66630657
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rsindex f6935f0150..5a493ee32f 100644--- a/crates/hyperswitch_domain_models/src/router_request_types.rs+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs@@ -1416,6 +1416,7 @@ pub struct PaymentsSessionData {/// The specific payment method type for which the session token is being generatedpub payment_method_type: Option<common_enums::PaymentMethodType>,pub payment_method: Option<common_enums::PaymentMethod>,+ pub split_payments: Option<common_types::payments::SplitPaymentsRequest>,}#[derive(Debug, Clone, Default)]diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rsindex 698355662e..8d5bb90078 100644--- a/crates/router/src/core/payments/flows/session_flow.rs+++ b/crates/router/src/core/payments/flows/session_flow.rs@@ -1089,6 +1089,21 @@ fn create_gpay_session_token(billing_address_parameters: billing_address_parameters.clone(),..allowed_payment_methods.parameters},+ tokenization_specification: payment_types::GpayTokenizationSpecification {+ parameters: payment_types::GpayTokenParameters {+ stripe_publishable_key: construct_stripe_publishable_key(+ &allowed_payment_methods+ .tokenization_specification+ .parameters,+ router_data,+ )+ .expose_option(),+ ..allowed_payment_methods+ .tokenization_specification+ .parameters+ },+ ..allowed_payment_methods.tokenization_specification+ },..allowed_payment_methods},)@@ -1181,6 +1196,31 @@ fn get_allowed_payment_methods_from_cards(})}+fn construct_stripe_publishable_key(+ gpay_token_specific_parameters: &payment_types::GpayTokenParameters,+ router_data: &types::PaymentsSessionRouterData,+) -> Option<masking::Secret<String>> {+ let suffix =+ if let Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(stripe)) =+ &router_data.request.split_payments+ {+ if stripe.charge_type+ == common_enums::PaymentChargeType::Stripe(common_enums::StripeChargeType::Direct)+ {+ format!("/{}", stripe.transfer_account_id)+ } else {+ String::new()+ }+ } else {+ String::new()+ };++ gpay_token_specific_parameters+ .stripe_publishable_key+ .clone()+ .map(|key| masking::Secret::new(format!("{}{}", key, suffix)))+}+fn is_session_response_delayed(state: &routes::SessionState,connector: &api::ConnectorData,diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex 51adaf5b91..49395c5166 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -1324,6 +1324,7 @@ pub async fn construct_payment_router_data_for_sdk_session<'a>(shipping_cost: payment_data.payment_intent.amount_details.shipping_cost,payment_method,payment_method_type,+ split_payments: payment_data.payment_intent.split_payments,};// TODO: evaluate the fields in router data, if they are required or not@@ -5602,6 +5603,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSessionDshipping_cost: payment_data.payment_intent.amount_details.shipping_cost,payment_method: Some(payment_data.payment_attempt.payment_method_type),payment_method_type: Some(payment_data.payment_attempt.payment_method_subtype),+ split_payments: payment_data.payment_intent.split_payments,})}}@@ -5707,6 +5709,7 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSessionDmetadata,payment_method: payment_data.payment_attempt.payment_method,payment_method_type: payment_data.payment_attempt.payment_method_type,+ split_payments: payment_data.payment_intent.split_payments,})}}