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: Mandate data passage to ucs (#11053)
Tushar Shuklafffa19be65df
diff --git a/Cargo.lock b/Cargo.lockindex 975bf3d602..7b5fa05fd2 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2129,7 +2129,7 @@ dependencies = [[[package]]name = "config_patch_derive"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37#1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37"+source = "git+https://github.com/juspay/connector-service?rev=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"dependencies = ["proc-macro2","quote",@@ -3800,7 +3800,7 @@ dependencies = [[[package]]name = "grpc-api-types"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37#1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37"+source = "git+https://github.com/juspay/connector-service?rev=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"dependencies = ["axum 0.8.4","error-stack 0.5.0",@@ -7473,7 +7473,7 @@ dependencies = [[[package]]name = "rust-grpc-client"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37#1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37"+source = "git+https://github.com/juspay/connector-service?rev=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"dependencies = ["grpc-api-types",]@@ -10263,7 +10263,7 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"[[package]]name = "ucs_cards"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37#1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37"+source = "git+https://github.com/juspay/connector-service?rev=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"dependencies = ["bytes 1.10.1","error-stack 0.4.1",@@ -10279,7 +10279,7 @@ dependencies = [[[package]]name = "ucs_common_enums"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37#1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37"+source = "git+https://github.com/juspay/connector-service?rev=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"dependencies = ["serde","strum 0.26.3",@@ -10290,7 +10290,7 @@ dependencies = [[[package]]name = "ucs_common_utils"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37#1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37"+source = "git+https://github.com/juspay/connector-service?rev=23ae5acea8cfb1f1d35517dc95b7da8d101df5b9#23ae5acea8cfb1f1d35517dc95b7da8d101df5b9"dependencies = ["anyhow","base64 0.21.7",diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.tomlindex a5629c290b..565ce988aa 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 = "1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37", package = "rust-grpc-client" }+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "23ae5acea8cfb1f1d35517dc95b7da8d101df5b9", package = "rust-grpc-client" }open-feature = { version = "0.2.5", optional = true }superposition_provider = { version = "0.88.1", optional = true }diff --git a/crates/hyperswitch_interfaces/Cargo.toml b/crates/hyperswitch_interfaces/Cargo.tomlindex ed221cf258..072e86d1c4 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 = "1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37", package = "rust-grpc-client" }+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "23ae5acea8cfb1f1d35517dc95b7da8d101df5b9", 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 748c2d9a67..d0ba2a7157 100644--- a/crates/router/Cargo.toml+++ b/crates/router/Cargo.toml@@ -88,8 +88,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 = "1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37", package = "rust-grpc-client" }-unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "1abde2fb6dd203fc7b0cf5b2b184ce1c0d964e37", package = "ucs_cards" }+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "23ae5acea8cfb1f1d35517dc95b7da8d101df5b9", package = "rust-grpc-client" }+unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "23ae5acea8cfb1f1d35517dc95b7da8d101df5b9", 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/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rsindex bc83a72744..ff87aaf4e5 100644--- a/crates/router/src/core/unified_connector_service/transformers.rs+++ b/crates/router/src/core/unified_connector_service/transformers.rs@@ -19,7 +19,7 @@ use diesel_models::enums as storage_enums;use error_stack::{report, ResultExt};use external_services::grpc_client::unified_connector_service::UnifiedConnectorServiceError;use hyperswitch_domain_models::{- mandates::MandateData,+ mandates::{MandateData, MandateDataType},router_data::{AccessToken, ErrorResponse, RouterData},router_flow_types::{payments::{Authorize, Capture, PSync, SetupMandate},@@ -1800,7 +1800,6 @@ impl.map(|pm_type| pm_type.into());let address = payments_grpc::PaymentAddress::foreign_try_from(router_data.address.clone())?;-let mandate_reference_id = match &router_data.request.mandate_id {Some(mandate) => match &mandate.mandate_reference_id {Some(api_models::payments::MandateReferenceId::ConnectorMandateId(@@ -4917,9 +4916,56 @@ impl transformers::ForeignTryFrom<&MandateData> for payments_grpc::SetupMandateD.clone().map(payments_grpc::CustomerAcceptance::foreign_try_from).transpose()?;++ // Map the mandate_type from domain type to grpc type+ let mandate_type = mandate_data+ .mandate_type+ .as_ref()+ .map(|domain_mandate_type| match domain_mandate_type {+ MandateDataType::SingleUse(amount_data) => payments_grpc::MandateType {+ mandate_type: Some(payments_grpc::mandate_type::MandateType::SingleUse(+ payments_grpc::MandateAmountData {+ amount: amount_data.amount.get_amount_as_i64(),+ currency: payments_grpc::Currency::foreign_try_from(+ amount_data.currency,+ )+ .unwrap_or(payments_grpc::Currency::Unspecified)+ .into(),+ start_date: amount_data.start_date.map(+ |dt: time::PrimitiveDateTime| dt.assume_utc().unix_timestamp(),+ ),+ end_date: amount_data.end_date.map(|dt: time::PrimitiveDateTime| {+ dt.assume_utc().unix_timestamp()+ }),+ },+ )),+ },+ MandateDataType::MultiUse(amount_data_opt) => payments_grpc::MandateType {+ mandate_type: amount_data_opt.as_ref().map(|amount_data| {+ payments_grpc::mandate_type::MandateType::MultiUse(+ payments_grpc::MandateAmountData {+ amount: amount_data.amount.get_amount_as_i64(),+ currency: payments_grpc::Currency::foreign_try_from(+ amount_data.currency,+ )+ .unwrap_or(payments_grpc::Currency::Unspecified)+ .into(),+ start_date: amount_data.start_date.map(+ |dt: time::PrimitiveDateTime| dt.assume_utc().unix_timestamp(),+ ),+ end_date: amount_data.end_date.map(+ |dt: time::PrimitiveDateTime| dt.assume_utc().unix_timestamp(),+ ),+ },+ )+ }),+ },+ });+Ok(Self {update_mandate_id: mandate_data.update_mandate_id.clone(),customer_acceptance,+ mandate_type,})}}