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(core): Added mandate_id flow support in HS<>UCS (#10399)
Saptak Dutta7bd663d91c40
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rsindex f414a58e86..f6935f0150 100644--- a/crates/hyperswitch_domain_models/src/router_request_types.rs+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs@@ -313,7 +313,7 @@ impl TryFrom<SetupMandateRequestData> for ConnectorCustomerData {payment_method_data: Some(data.payment_method_data),description: None,phone: None,- name: None,+ name: data.customer_name.clone(),preprocessing_id: None,split_payments: data.split_payments,setup_future_usage: data.setup_future_usage,diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rsindex 712a7b7456..824a4063d3 100644--- a/crates/router/src/core/payments/flows/authorize_flow.rs+++ b/crates/router/src/core/payments/flows/authorize_flow.rs@@ -1044,8 +1044,8 @@ async fn call_unified_connector_service_authorize(router_data.connector_customer = Some(connector_customer_id);});- ucs_data.connector_response.map(|customer_response| {- router_data.connector_response = Some(customer_response);+ ucs_data.connector_response.map(|connector_response| {+ router_data.connector_response = Some(connector_response);});Ok((router_data, (), payment_authorize_response))diff --git a/crates/router/src/core/payments/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rsindex 051fecbb0a..f34cfc2d96 100644--- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs+++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs@@ -396,6 +396,10 @@ impl Feature<api::SetupMandate, types::SetupMandateRequestData> for types::Setuprouter_data.connector_customer = Some(connector_customer_id);});+ ucs_data.connector_response.map(|connector_response| {+ router_data.connector_response = Some(connector_response);+ });+Ok((router_data, (), payment_register_response))},))diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rsindex ab67ab4630..4cc4bf5965 100644--- a/crates/router/src/core/unified_connector_service.rs+++ b/crates/router/src/core/unified_connector_service.rs@@ -1247,11 +1247,14 @@ pub fn handle_unified_connector_service_response_for_payment_register(let connector_customer_id =extract_connector_customer_id_from_ucs_state(response.state.as_ref());+ let connector_response =+ extract_connector_response_from_ucs(response.connector_response.as_ref());Ok(UcsSetupMandateResponseData {router_data_response,status_code,connector_customer_id,+ connector_response,})}diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rsindex 9ff71ec2ef..eda0813df0 100644--- a/crates/router/src/core/unified_connector_service/transformers.rs+++ b/crates/router/src/core/unified_connector_service/transformers.rs@@ -37,7 +37,7 @@ use unified_connector_service_client::payments::{};use crate::{- core::{errors, unified_connector_service},+ core::{errors, mandate::MandateBehaviour, unified_connector_service},types::{api,transformers::{self, ForeignFrom},@@ -1365,12 +1365,22 @@ impl.setup_future_usage.map(payments_grpc::FutureUsage::foreign_try_from).transpose()?;- let customer_acceptance = router_data- .request- .customer_acceptance- .clone()- .map(payments_grpc::CustomerAcceptance::foreign_try_from)- .transpose()?;++ // If this is the deprecated mandate_id flow, take customer_acceptance+ // from setup_mandate_details. Otherwise, take it from request.customer_acceptance.+ let customer_acceptance = match router_data.request.get_setup_mandate_details() {+ Some(mandate_data) => mandate_data+ .customer_acceptance+ .clone()+ .map(payments_grpc::CustomerAcceptance::foreign_try_from)+ .transpose(),+ None => router_data+ .request+ .customer_acceptance+ .clone()+ .map(payments_grpc::CustomerAcceptance::foreign_try_from)+ .transpose(),+ }?;let state = router_data.access_tokendiff --git a/crates/router/src/types.rs b/crates/router/src/types.rsindex 952f66a62f..458185ef40 100644--- a/crates/router/src/types.rs+++ b/crates/router/src/types.rs@@ -744,6 +744,7 @@ pub struct UcsSetupMandateResponseData {Result<(PaymentsResponseData, common_enums::AttemptStatus), ErrorResponse>,pub status_code: u16,pub connector_customer_id: Option<String>,+ pub connector_response: Option<ConnectorResponseData>,}#[derive(Debug, Clone, Copy)]