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(payouts): propagate source_bank_data to prism (#12236)
Sakil Mostak56aaece55499
diff --git a/Cargo.lock b/Cargo.lockindex d3afd4af68..8c4d4aeaeb 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2232,7 +2232,7 @@ dependencies = [[[package]]name = "config_patch_derive"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=59d3a57e08727945362d916585a90935a375ef3b#59d3a57e08727945362d916585a90935a375ef3b"+source = "git+https://github.com/juspay/connector-service?rev=d47a8d04d0338bba0719efec3e7cff8220df3f96#d47a8d04d0338bba0719efec3e7cff8220df3f96"dependencies = ["proc-macro2","quote",@@ -3948,9 +3948,10 @@ checksum = "32619942b8be646939eaf3db0602b39f5229b74575b67efc897811ded1db4e57"[[package]]name = "grpc-api-types"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=59d3a57e08727945362d916585a90935a375ef3b#59d3a57e08727945362d916585a90935a375ef3b"+source = "git+https://github.com/juspay/connector-service?rev=d47a8d04d0338bba0719efec3e7cff8220df3f96#d47a8d04d0338bba0719efec3e7cff8220df3f96"dependencies = ["axum 0.8.4",+ "bytes 1.10.1","error-stack 0.5.0","g2h","heck 0.5.0",@@ -3958,7 +3959,7 @@ dependencies = ["hyperswitch_masking","prost 0.14.3","prost-build",- "prost-types 0.13.5",+ "prost-types 0.14.3","serde","tonic 0.14.5","tonic-build",@@ -8116,7 +8117,7 @@ dependencies = [[[package]]name = "rust-grpc-client"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=59d3a57e08727945362d916585a90935a375ef3b#59d3a57e08727945362d916585a90935a375ef3b"+source = "git+https://github.com/juspay/connector-service?rev=d47a8d04d0338bba0719efec3e7cff8220df3f96#d47a8d04d0338bba0719efec3e7cff8220df3f96"dependencies = ["grpc-api-types",]@@ -10944,7 +10945,7 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"[[package]]name = "ucs_cards"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=59d3a57e08727945362d916585a90935a375ef3b#59d3a57e08727945362d916585a90935a375ef3b"+source = "git+https://github.com/juspay/connector-service?rev=d47a8d04d0338bba0719efec3e7cff8220df3f96#d47a8d04d0338bba0719efec3e7cff8220df3f96"dependencies = ["bytes 1.10.1","error-stack 0.4.1",@@ -10960,7 +10961,7 @@ dependencies = [[[package]]name = "ucs_common_enums"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=59d3a57e08727945362d916585a90935a375ef3b#59d3a57e08727945362d916585a90935a375ef3b"+source = "git+https://github.com/juspay/connector-service?rev=d47a8d04d0338bba0719efec3e7cff8220df3f96#d47a8d04d0338bba0719efec3e7cff8220df3f96"dependencies = ["serde","strum 0.26.3",@@ -10971,7 +10972,7 @@ dependencies = [[[package]]name = "ucs_common_utils"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=59d3a57e08727945362d916585a90935a375ef3b#59d3a57e08727945362d916585a90935a375ef3b"+source = "git+https://github.com/juspay/connector-service?rev=d47a8d04d0338bba0719efec3e7cff8220df3f96#d47a8d04d0338bba0719efec3e7cff8220df3f96"dependencies = ["anyhow","base64 0.21.7",diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rsindex bbe1c3e4c1..fa1711355b 100644--- a/crates/connector_configs/src/connector.rs+++ b/crates/connector_configs/src/connector.rs@@ -283,6 +283,8 @@ pub struct ConnectorConfig {pub iatapay: Option<ConnectorTomlConfig>,pub imerchantsolutions: Option<ConnectorTomlConfig>,pub itaubank: Option<ConnectorTomlConfig>,+ #[cfg(feature = "payouts")]+ pub itaubank_payout: Option<ConnectorTomlConfig>,pub opennode: Option<ConnectorTomlConfig>,pub bambora: Option<ConnectorTomlConfig>,pub cybersourcedecisionmanager: Option<ConnectorTomlConfig>,@@ -455,7 +457,7 @@ impl ConnectorConfig {PayoutConnectors::Worldpay => Ok(connector_data.worldpay_payout),PayoutConnectors::Worldpayxml => Ok(connector_data.worldpayxml_payout),PayoutConnectors::Envoy => Ok(connector_data.envoy_payout),- PayoutConnectors::Itaubank => Ok(connector_data.itaubank),+ PayoutConnectors::Itaubank => Ok(connector_data.itaubank_payout),}}diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.tomlindex 888d6768c6..416468c986 100644--- a/crates/external_services/Cargo.toml+++ b/crates/external_services/Cargo.toml@@ -74,7 +74,7 @@ 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 = "59d3a57e08727945362d916585a90935a375ef3b", package = "rust-grpc-client" }+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "d47a8d04d0338bba0719efec3e7cff8220df3f96", package = "rust-grpc-client" }open-feature = { version = "0.2.5", optional = true }superposition_provider = { version = "0.102.0", optional = true}superposition_types = "0.102.0"diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rsindex c8219d7e16..339aec5c51 100644--- a/crates/hyperswitch_domain_models/src/router_request_types.rs+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs@@ -1666,6 +1666,7 @@ pub struct PayoutsData {pub browser_info: Option<BrowserInformation>,pub payout_connector_metadata: Option<pii::SecretSerdeValue>,pub additional_payout_method_data: Option<payout_method_utils::AdditionalPayoutMethodData>,+ pub source_bank_data: Option<api_models::payouts::BankTransfer>,}#[derive(Debug, Default, Clone, Serialize)]diff --git a/crates/hyperswitch_interfaces/Cargo.toml b/crates/hyperswitch_interfaces/Cargo.tomlindex a666cc67c3..ef9135301d 100644--- a/crates/hyperswitch_interfaces/Cargo.toml+++ b/crates/hyperswitch_interfaces/Cargo.toml@@ -31,7 +31,7 @@ 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 = "59d3a57e08727945362d916585a90935a375ef3b", package = "rust-grpc-client" }+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "d47a8d04d0338bba0719efec3e7cff8220df3f96", package = "rust-grpc-client" }tokio = { version = "1.45.1", features = ["macros", "rt-multi-thread"] }# First party cratesdiff --git a/crates/router/Cargo.toml b/crates/router/Cargo.tomlindex bacf80adef..9751fd1b1d 100644--- a/crates/router/Cargo.toml+++ b/crates/router/Cargo.toml@@ -89,8 +89,8 @@ ring = "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 = "59d3a57e08727945362d916585a90935a375ef3b", package = "rust-grpc-client" }-unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "59d3a57e08727945362d916585a90935a375ef3b", package = "ucs_cards" }+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "d47a8d04d0338bba0719efec3e7cff8220df3f96", package = "rust-grpc-client" }+unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "d47a8d04d0338bba0719efec3e7cff8220df3f96", package = "ucs_cards" }rustc-hash = "1.1.0"rustls = "0.22"rustls-pemfile = "2"diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rsindex 71444bfcb6..ac720f5ea0 100644--- a/crates/router/src/core/unified_connector_service/transformers.rs+++ b/crates/router/src/core/unified_connector_service/transformers.rs@@ -2034,6 +2034,7 @@ impl transformers::ForeignTryFrom<&RouterData<Session, PaymentsSessionData, Paymdomain_context: Some(payments_grpc::merchant_authentication_service_create_client_authentication_token_request::DomainContext::Payment(payment_sdk_session_context),),+ permissions: None,})}}@@ -5797,6 +5798,17 @@ impl transformers::ForeignTryFrom<&RouterData<RSync, RefundsData, RefundsRespons"Missing connector_refund_id for refund sync operation".to_string(),),)?,+ refund_amount: Some(payments_grpc::Money {+ minor_amount: router_data.request.minor_refund_amount.get_amount_as_i64(),+ currency: i32::from(payments_grpc::Currency::foreign_try_from(+ router_data.request.currency,+ )?),+ }),+ connector_refund_id: router_data.request.connector_refund_id.clone().ok_or(+ UnifiedConnectorServiceError::RequestEncodingFailedWithReason(+ "Missing connector_refund_id for refund sync operation".to_string(),+ ),+ )?,refund_reason: router_data.request.reason.clone(),browser_info: router_data.request@@ -6284,6 +6296,12 @@ implwebhook_url: router_data.request.webhook_url.clone(),browser_info,access_token,+ source_bank_data: router_data+ .request+ .source_bank_data+ .as_ref()+ .map(payments_grpc::SourceBankData::foreign_try_from)+ .transpose()?,})}}@@ -6395,6 +6413,12 @@ implconnector_payout_method_id: router_data.request.connector_transfer_method_id.clone(),webhook_url: router_data.request.webhook_url.clone(),browser_info,+ source_bank_data: router_data+ .request+ .source_bank_data+ .as_ref()+ .map(payments_grpc::SourceBankData::foreign_try_from)+ .transpose()?,})}}@@ -6796,18 +6820,16 @@ impl transformers::ForeignTryFrom<&api_models::payouts::PayoutMethodData>),))?}- api_models::payouts::BankTransfer::PixKey(_) => Err(error_stack::Report::new(- UnifiedConnectorServiceError::RequestEncodingFailedWithReason(- "Pix Key bank transfer not supported for Unified Connector Service"- .to_string(),- ),- ))?,- api_models::payouts::BankTransfer::PixEmv(_) => Err(error_stack::Report::new(- UnifiedConnectorServiceError::RequestEncodingFailedWithReason(- "Pix EMV bank transfer not supported for Unified Connector Service"- .to_string(),- ),- ))?,+ api_models::payouts::BankTransfer::PixKey(pix_key) => {+ payments_grpc::payout_method::PayoutMethodData::PixKey(+ payments_grpc::PixKeyBankTransferPayout::foreign_from(pix_key),+ )+ }+ api_models::payouts::BankTransfer::PixEmv(pix_emv) => {+ payments_grpc::payout_method::PayoutMethodData::PixEmv(+ payments_grpc::PixEmvBankTransferPayout::foreign_from(pix_emv),+ )+ }}}api_models::payouts::PayoutMethodData::Wallet(wallet) => match wallet {@@ -6950,9 +6972,8 @@ impl transformers::ForeignTryFrom<&api_models::payouts::PixBankTransfer>bank_name: None,bank_branch: item.bank_branch.clone(),bank_account_number: item.bank_account_number.clone(),- pix_key: item.pix_key.clone(),tax_id: item.tax_id.clone(),- // TODO: pix_emv: item.pix_emv.clone(), to be added in future when UCS supports it+ ispb: None,})}}@@ -6971,7 +6992,7 @@ impl transformers::ForeignTryFrom<&api_models::payouts::PixAccountBankTransfer>bank_branch: item.bank_branch.clone(),bank_account_number: Some(item.bank_account_number.clone()),tax_id: item.tax_id.clone(),- pix_key: None,+ ispb: None,})}}@@ -7068,3 +7089,72 @@ impl transformers::ForeignTryFrom<&api_models::payouts::Passthrough>})}}+#[cfg(feature = "payouts")]+impl transformers::ForeignTryFrom<&api_models::payouts::BankTransfer>+ for payments_grpc::SourceBankData+{+ type Error = error_stack::Report<UnifiedConnectorServiceError>;++ fn foreign_try_from(item: &api_models::payouts::BankTransfer) -> Result<Self, Self::Error> {+ let source_bank_data = match item {+ api_models::payouts::BankTransfer::Ach(ach) => {+ Some(payments_grpc::source_bank_data::SourceBankData::Ach(+ payments_grpc::AchBankTransferPayout::foreign_try_from(ach)?,+ ))+ }+ api_models::payouts::BankTransfer::Bacs(bacs) => {+ Some(payments_grpc::source_bank_data::SourceBankData::Bacs(+ payments_grpc::BacsBankTransferPayout::foreign_try_from(bacs)?,+ ))+ }+ api_models::payouts::BankTransfer::Sepa(sepa) => {+ Some(payments_grpc::source_bank_data::SourceBankData::Sepa(+ payments_grpc::SepaBankTransferPayout::foreign_try_from(sepa)?,+ ))+ }+ api_models::payouts::BankTransfer::Pix(pix) => {+ Some(payments_grpc::source_bank_data::SourceBankData::Pix(+ payments_grpc::PixBankTransferPayout::foreign_try_from(pix)?,+ ))+ }+ api_models::payouts::BankTransfer::PixKey(pix_key) => {+ Some(payments_grpc::source_bank_data::SourceBankData::PixKey(+ payments_grpc::PixKeyBankTransferPayout::foreign_from(pix_key),+ ))+ }+ api_models::payouts::BankTransfer::PixEmv(pix_emv) => {+ Some(payments_grpc::source_bank_data::SourceBankData::PixEmv(+ payments_grpc::PixEmvBankTransferPayout::foreign_from(pix_emv),+ ))+ }+ api_models::payouts::BankTransfer::Trustly(_) => Err(error_stack::Report::new(+ UnifiedConnectorServiceError::RequestEncodingFailedWithReason(+ "Trustly bank transfer not supported for Unified Connector Service".to_string(),+ ),+ ))?,+ };+ Ok(Self { source_bank_data })+ }+}++#[cfg(feature = "payouts")]+impl ForeignFrom<&api_models::payouts::PixKeyBankTransfer>+ for payments_grpc::PixKeyBankTransferPayout+{+ fn foreign_from(item: &api_models::payouts::PixKeyBankTransfer) -> Self {+ Self {+ pix_key: Some(item.pix_key.clone()),+ }+ }+}++#[cfg(feature = "payouts")]+impl ForeignFrom<&api_models::payouts::PixEmvBankTransfer>+ for payments_grpc::PixEmvBankTransferPayout+{+ fn foreign_from(item: &api_models::payouts::PixEmvBankTransfer) -> Self {+ Self {+ emv: Some(item.emv.clone()),+ }+ }+}diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rsindex 5a75deec68..1ba0b5660b 100644--- a/crates/router/src/core/utils.rs+++ b/crates/router/src/core/utils.rs@@ -289,6 +289,7 @@ pub async fn construct_payout_router_data<'a, F>(browser_info,payout_connector_metadata: payout_attempt.payout_connector_metadata.to_owned(),additional_payout_method_data: payout_attempt.additional_payout_method_data.to_owned(),+ source_bank_data: payout_data.source_bank_data.clone(),},response: Ok(types::PayoutsResponseData::default()),access_token: None,diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rsindex e51ca8e834..541c140ea0 100644--- a/crates/router/tests/connectors/utils.rs+++ b/crates/router/tests/connectors/utils.rs@@ -482,6 +482,7 @@ pub trait ConnectorActions: Connector {browser_info: None,payout_connector_metadata: None,additional_payout_method_data: None,+ source_bank_data: None,},payment_info,)