Skip to content

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

feat(connector): add deutschebank payouts support (#12764)

Siddhesh Kulthe7a6f5773c1f2
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 49a6dfed16..ba7f416d8a 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -36591,6 +36591,7 @@
"adyen",
"adyenplatform",
"cybersource",
+ "deutschebank",
"ebanx",
"gigadat",
"loonio",
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 435e1996ab..b1873ddffd 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -25646,6 +25646,7 @@
"adyen",
"adyenplatform",
"cybersource",
+ "deutschebank",
"ebanx",
"gigadat",
"loonio",
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 6d05f3abdf..001c1817d5 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -49,6 +49,7 @@ pub enum PayoutConnectors {
Adyen,
Adyenplatform,
Cybersource,
+ Deutschebank,
Ebanx,
Gigadat,
Loonio,
@@ -94,6 +95,7 @@ impl From<PayoutConnectors> for RoutableConnectors {
PayoutConnectors::Adyen => Self::Adyen,
PayoutConnectors::Adyenplatform => Self::Adyenplatform,
PayoutConnectors::Cybersource => Self::Cybersource,
+ PayoutConnectors::Deutschebank => Self::Deutschebank,
PayoutConnectors::Ebanx => Self::Ebanx,
PayoutConnectors::Gigadat => Self::Gigadat,
PayoutConnectors::Loonio => Self::Loonio,
@@ -120,6 +122,7 @@ impl From<PayoutConnectors> for Connector {
PayoutConnectors::Adyen => Self::Adyen,
PayoutConnectors::Adyenplatform => Self::Adyenplatform,
PayoutConnectors::Cybersource => Self::Cybersource,
+ PayoutConnectors::Deutschebank => Self::Deutschebank,
PayoutConnectors::Ebanx => Self::Ebanx,
PayoutConnectors::Gigadat => Self::Gigadat,
PayoutConnectors::Loonio => Self::Loonio,
@@ -147,6 +150,7 @@ impl TryFrom<Connector> for PayoutConnectors {
Connector::Adyen => Ok(Self::Adyen),
Connector::Adyenplatform => Ok(Self::Adyenplatform),
Connector::Cybersource => Ok(Self::Cybersource),
+ Connector::Deutschebank => Ok(Self::Deutschebank),
Connector::Ebanx => Ok(Self::Ebanx),
Connector::Gigadat => Ok(Self::Gigadat),
Connector::Loonio => Ok(Self::Loonio),
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index cf0378939e..8f14f71891 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -228,6 +228,7 @@ impl Connector {
| (Self::Worldpay, Some(PayoutType::Wallet))
| (Self::Worldpayxml, Some(PayoutType::Wallet))
| (Self::Itaubank, Some(PayoutType::Bank))
+ | (Self::Deutschebank, Some(PayoutType::Bank))
)
}
#[cfg(feature = "payouts")]
@@ -239,7 +240,17 @@ impl Connector {
}
#[cfg(feature = "payouts")]
pub fn supports_payout_eligibility(self, payout_method: Option<PayoutType>) -> bool {
- matches!((self, payout_method), (_, Some(PayoutType::Card)))
+ matches!(
+ (self, payout_method),
+ (_, Some(PayoutType::Card)) | (Self::Deutschebank, Some(PayoutType::Bank))
+ )
+ }
+ #[cfg(feature = "payouts")]
+ pub fn requires_source_bank_data_for_sync(self, payout_method: Option<PayoutType>) -> bool {
+ matches!(
+ (self, payout_method),
+ (Self::Deutschebank, Some(PayoutType::Bank))
+ )
}
#[cfg(feature = "payouts")]
pub fn is_payout_quote_call_required(self) -> bool {
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 5b81984439..dde0ac3a7b 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -308,6 +308,8 @@ pub struct ConnectorConfig {
pub cybersourcedecisionmanager: Option<ConnectorTomlConfig>,
pub datatrans: Option<ConnectorTomlConfig>,
pub deutschebank: Option<ConnectorTomlConfig>,
+ #[cfg(feature = "payouts")]
+ pub deutschebank_payout: Option<ConnectorTomlConfig>,
pub digitalvirgo: Option<ConnectorTomlConfig>,
pub dlocal: Option<ConnectorTomlConfig>,
pub dwolla: Option<ConnectorTomlConfig>,
@@ -464,6 +466,7 @@ impl ConnectorConfig {
PayoutConnectors::Adyen => Ok(connector_data.adyen_payout),
PayoutConnectors::Adyenplatform => Ok(connector_data.adyenplatform_payout),
PayoutConnectors::Cybersource => Ok(connector_data.cybersource_payout),
+ PayoutConnectors::Deutschebank => Ok(connector_data.deutschebank_payout),
PayoutConnectors::Ebanx => Ok(connector_data.ebanx_payout),
PayoutConnectors::Gigadat => Ok(connector_data.gigadat_payout),
PayoutConnectors::Loonio => Ok(connector_data.loonio_payout),
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 9e38b0cbdd..0d6f165a20 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -5985,6 +5985,15 @@ key1 = "Wise Account Id"
merchant_secret="Source verification key"
+[deutschebank_payout]
+[[deutschebank_payout.bank_transfer]]
+ payment_method_type = "sepa_bank_transfer"
+[deutschebank_payout.connector_auth.MultiAuthKey]
+api_key="Customer Identifier"
+key1="Key ID"
+api_secret="Signing Private Key (PEM)"
+key2="Client Certificate Bundle (PEM cert + key concatenated)"
+
[itaubank_payout]
[[itaubank_payout.bank_transfer]]
payment_method_type = "pix"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 97bfe6f3c1..d3898c38c2 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -3749,6 +3749,15 @@ key1 = "Wise Account Id"
[wise_payout.connector_webhook_details]
merchant_secret="Source verification key"
+[deutschebank_payout]
+[[deutschebank_payout.bank_transfer]]
+ payment_method_type = "sepa_bank_transfer"
+[deutschebank_payout.connector_auth.MultiAuthKey]
+api_key="Customer Identifier"
+key1="Key ID"
+api_secret="Signing Private Key (PEM)"
+key2="Client Certificate Bundle (PEM cert + key concatenated)"
+
[itaubank_payout]
[[itaubank_payout.bank_transfer]]
payment_method_type = "pix"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 2a6d0739ac..5b395b90e2 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -5948,6 +5948,15 @@ key1 = "Wise Account Id"
[wise_payout.connector_webhook_details]
merchant_secret="Source verification key"
+[deutschebank_payout]
+[[deutschebank_payout.bank_transfer]]
+ payment_method_type = "sepa_bank_transfer"
+[deutschebank_payout.connector_auth.MultiAuthKey]
+api_key="Customer Identifier"
+key1="Key ID"
+api_secret="Signing Private Key (PEM)"
+key2="Client Certificate Bundle (PEM cert + key concatenated)"
+
[itaubank_payout]
[[itaubank_payout.bank_transfer]]
payment_method_type = "pix"
diff --git a/crates/external_services/src/grpc_client/unified_connector_service.rs b/crates/external_services/src/grpc_client/unified_connector_service.rs
index 572c5eba2a..ea5fa49b8c 100644
--- a/crates/external_services/src/grpc_client/unified_connector_service.rs
+++ b/crates/external_services/src/grpc_client/unified_connector_service.rs
@@ -1188,6 +1188,45 @@ impl UnifiedConnectorServiceClient {
})
}
+ /// Performs Payout Eligibility (e.g. SEPA VoP / payee verification).
+ pub async fn payout_eligibility(
+ &self,
+ payout_eligibility_request: payments_grpc::PayoutMethodEligibilityRequest,
+ connector_auth_metadata: ConnectorAuthMetadata,
+ grpc_headers: GrpcHeadersUcs,
+ ) -> UnifiedConnectorServiceResult<
+ tonic::Response<payments_grpc::PayoutMethodEligibilityResponse>,
+ > {
+ let mut request = tonic::Request::new(payout_eligibility_request);
+
+ let connector_name = connector_auth_metadata.connector_name.clone();
+ let metadata = build_unified_connector_service_grpc_headers_for_payouts(
+ connector_auth_metadata,
+ grpc_headers,
+ )?;
+
+ *request.metadata_mut() = metadata;
+
+ self.payout_service_client
+ .clone()
+ .eligibility(request)
+ .await
+ .map_err(|error| {
+ error_stack::Report::new(UnifiedConnectorServiceError::from_grpc_error(
+ &error,
+ &connector_name,
+ ))
+ })
+ .inspect_err(|error| {
+ logger::error!(
+ grpc_error=?error,
+ method="payout_eligibility",
+ connector_name=?connector_name,
+ "UCS payout eligibility gRPC call failed"
+ )
+ })
+ }
+
/// Performs Payout Get
pub async fn payout_get(
&self,
diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
index 201053d6b7..d61b81ad88 100644
--- a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
@@ -69,6 +69,26 @@ impl TryFrom<&ConnectorAuthType> for DeutschebankAuthType {
merchant_id: key1.to_owned(),
client_key: api_secret.to_owned(),
}),
+ // MultiAuthKey is the payouts shape: CSEAL credentials are routed
+ // to prism (UCS) rather than used by this struct directly. We
+ // accept it here so MCA creation/validation succeeds for
+ // payout_processor connectors; the actual CSEAL flow runs in prism
+ // and reads the four secrets from `ConnectorAuthMetadata`.
+ //
+ // api_key -> customer_identifier
+ // key1 -> key_id
+ // api_secret-> signing_private_key (PEM)
+ // key2 -> client_certificate_bundle (PEM cert + key)
+ ConnectorAuthType::MultiAuthKey {
+ api_key,
+ key1,
+ api_secret,
+ key2: _,
+ } => Ok(Self {
+ client_id: api_key.to_owned(),
+ merchant_id: key1.to_owned(),
+ client_key: api_secret.to_owned(),
+ }),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index aceeadfc21..03f723f1bb 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -1272,6 +1272,7 @@ pub async fn call_connector_payout(
Box::pin(complete_payout_eligibility(
state,
platform,
+ header_payload.clone(),
connector_data,
payout_data,
))
@@ -1642,6 +1643,7 @@ pub async fn create_recipient(
pub async fn complete_payout_eligibility(
state: &SessionState,
platform: &domain::Platform,
+ header_payload: HeaderPayload,
connector_data: &api::ConnectorData,
payout_data: &mut PayoutData,
) -> RouterResult<()> {
@@ -1656,6 +1658,7 @@ pub async fn complete_payout_eligibility(
Box::pin(check_payout_eligibility(
state,
platform,
+ header_payload,
connector_data,
payout_data,
))
@@ -1681,6 +1684,7 @@ pub async fn complete_payout_eligibility(
pub async fn check_payout_eligibility(
state: &SessionState,
platform: &domain::Platform,
+ header_payload: HeaderPayload,
connector_data: &api::ConnectorData,
payout_data: &mut PayoutData,
) -> RouterResult<()> {
@@ -1689,21 +1693,34 @@ pub async fn check_payout_eligibility(
core_utils::construct_payout_router_data(state, connector_data, platform, payout_data)
.await?;
- // 2. Fetch connector integration details
+ // 2. Decide UCS vs Direct execution path for this flow.
+ let (gateway_context, updated_state) = decide_unified_connector_service_payout(
+ state,
+ platform,
+ header_payload,
+ &router_data,
+ connector_data,
+ payout_data,
+ )
+ .await?;
+
+ // 3. Fetch connector integration details
let connector_integration: services::BoxedPayoutConnectorIntegrationInterface<
api::PoEligibility,
types::PayoutsData,
types::PayoutsResponseData,
> = connector_data.connector.get_connector_integration();
- // 3. Call connector service
- let router_data_resp = services::execute_connector_processing_step(
- state,
+ // 4. Dispatch through the gateway (UCS for connectors that route there,
+ // Direct connector integration otherwise).
+ let router_data_resp = payout_gateway::execute_payout_gateway(
+ &updated_state,
connector_integration,
&router_data,
payments::CallConnectorAction::Trigger,
None,
None,
+ gateway_context.clone(),
)
.await
.to_payout_failed_response()?;
@@ -3506,7 +3523,40 @@ pub async fn make_payout_data(
None => (None, None, None),
}
}
- payouts::PayoutRequest::PayoutRetrieveRequest(_) => (None, None, None),
+ payouts::PayoutRequest::PayoutRetrieveRequest(_) => {
+ let requires_source_bank_data = payout_attempt
+ .connector
+ .as_deref()
+ .and_then(|connector| {
+ common_enums::connector_enums::Connector::from_str(connector).ok()
+ })
+ .is_some_and(|connector| {
+ connector.requires_source_bank_data_for_sync(payouts.payout_type)
+ });
+
+ match (
+ requires_source_bank_data,
+ payout_attempt.source_bank_data_token.to_owned(),
+ ) {
+ (true, Some(source_bank_data_token)) => {
+ let customer_id = customer_details
+ .as_ref()
+ .map(|cd| cd.get_id().to_owned())
+ .get_required_value("customer_id when payout_token is sent")?;
+ let source_bank_data =
+ helpers::SourceBankDataOperation::get_temp_source_bank_data(
+ state,
+ Some(source_bank_data_token),
+ Some(customer_id),
+ platform.get_processor().get_key_store(),
+ )
+ .await?;
+
+ (source_bank_data, None, None)
+ }
+ _ => (None, None, None),
+ }
+ }
};
let dimensions = dimensions.with_profile_id(profile_id.clone());
diff --git a/crates/router/src/core/payouts/gateway.rs b/crates/router/src/core/payouts/gateway.rs
index bcb4eb36c5..41920a429a 100644
--- a/crates/router/src/core/payouts/gateway.rs
+++ b/crates/router/src/core/payouts/gateway.rs
@@ -1,6 +1,7 @@
pub mod cancel_gateway;
pub mod context;
pub mod create_gateway;
+pub mod eligibility_gateway;
pub mod fulfill_gateway;
pub mod quote_gateway;
pub mod recipient_account_gateway;
diff --git a/crates/router/src/core/payouts/gateway/eligibility_gateway.rs b/crates/router/src/core/payouts/gateway/eligibility_gateway.rs
new file mode 100644
index 0000000000..1c773a22a7
--- /dev/null
+++ b/crates/router/src/core/payouts/gateway/eligibility_gateway.rs
@@ -0,0 +1,182 @@
+use std::str::FromStr;
+
+use async_trait::async_trait;
+use common_enums::{CallConnectorAction, ExecutionPath};
+use common_utils::{errors::CustomResult, id_type, request::Request, ucs_types};
+use error_stack::ResultExt;
+use hyperswitch_domain_models::{router_data::RouterData, router_flow_types as domain};
+use hyperswitch_interfaces::{
+ api::gateway as payout_gateway,
+ connector_integration_interface::{BoxedConnectorIntegrationInterface, RouterDataConversion},
+ errors::ConnectorError,
+};
+use unified_connector_service_client::payments as payments_grpc;
+
+use crate::{
+ core::{payments::gateway::context::RouterGatewayContext, unified_connector_service},
+ routes::SessionState,
+ services::logger,
+ types::{self, transformers::ForeignTryFrom},
+};
+
+// =============================================================================
+// PayoutGateway Implementation for domain::PoEligibility
+// =============================================================================
+
+#[async_trait]
+impl<RCD>
+ payout_gateway::PayoutGateway<
+ SessionState,
+ RCD,
+ Self,
+ types::PayoutsData,
+ types::PayoutsResponseData,
+ RouterGatewayContext,
+ > for domain::PoEligibility
+where
+ RCD: Clone
+ + Send
+ + Sync
+ + 'static
+ + RouterDataConversion<Self, types::PayoutsData, types::PayoutsResponseData>,
+{
+ async fn execute(
+ self: Box<Self>,
+ state: &SessionState,
+ _connector_integration: BoxedConnectorIntegrationInterface<
+ Self,
+ RCD,
+ types::PayoutsData,
+ types::PayoutsResponseData,
+ >,
+ router_data: &RouterData<Self, types::PayoutsData, types::PayoutsResponseData>,
+ _call_connector_action: CallConnectorAction,
+ _connector_request: Option<Request>,
+ _return_raw_connector_response: Option<bool>,
+ context: RouterGatewayContext,
+ ) -> CustomResult<
+ RouterData<Self, types::PayoutsData, types::PayoutsResponseData>,
+ ConnectorError,
+ > {
+ let merchant_connector_account = context.merchant_connector_account;
+ let processor = &context.processor;
+ let lineage_ids = context.lineage_ids;
+ let header_payload = context.header_payload;
+ let unified_connector_service_execution_mode = context.execution_mode;
+ let client = state
+ .grpc_client
+ .unified_connector_service_client
+ .clone()
+ .ok_or(ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to fetch Unified Connector Service client")?;
+
+ let connector_auth_metadata =
+ unified_connector_service::build_unified_connector_service_auth_metadata(
+ merchant_connector_account,
+ processor.get_account().get_id(),
+ router_data.connector.clone(),
+ )
+ .change_context(ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to construct request metadata")?;
+
+ let merchant_reference_id = unified_connector_service::parse_merchant_payout_reference_id(
+ header_payload
+ .x_reference_id
+ .as_deref()
+ .unwrap_or(router_data.request.payout_id.get_string_repr()),
+ )
+ .map(ucs_types::UcsReferenceId::Payout);
+ let resource_id = id_type::PayoutResourceId::from_str(router_data.attempt_id.as_str())
+ .inspect_err(|err| logger::warn!(error = ?err, "Invalid Payout Resource Id found"))
+ .ok()
+ .map(ucs_types::UcsResourceId::PayoutAttempt);
+
+ let grpc_headers = state
+ .get_grpc_headers_ucs(unified_connector_service_execution_mode)
+ .external_vault_proxy_metadata(None)
+ .merchant_reference_id(merchant_reference_id)
+ .resource_id(resource_id)
+ .lineage_ids(lineage_ids);
+
+ logger::debug!("Granular Gateway: Payout eligibility flow");
+ let granular_payout_eligibility_request =
+ payments_grpc::PayoutMethodEligibilityRequest::foreign_try_from(router_data)
+ .change_context(ConnectorError::RequestEncodingFailed)
+ .attach_printable("Failed to construct Payout Eligibility Request")?;
+
+ let updated_router_data =
+ Box::pin(unified_connector_service::ucs_logging_wrapper_granular(
+ router_data.clone(),
+ state,
+ granular_payout_eligibility_request,
+ grpc_headers,
+ unified_connector_service_execution_mode,
+ |mut router_data, granular_payout_eligibility_request, grpc_headers| async move {
+ let response = Box::pin(client.payout_eligibility(
+ granular_payout_eligibility_request,
+ connector_auth_metadata,
+ grpc_headers,
+ ))
+ .await
+ .attach_printable("Failed to check payout eligibility")?;
+
+ let payout_eligibility_response = response.into_inner();
+
+ let ucs_data = types::UcsPayoutEligibilityResponseData::foreign_try_from((
+ payout_eligibility_response.clone(),
+ common_enums::PayoutStatus::RequiresCreation,
+ ))
+ .attach_printable("Failed to deserialize UCS response")?;
+
+ let router_data_response = ucs_data.router_data_response.inspect_err(|_| {
+ logger::debug!("Error in UCS router data response");
+ });
+ router_data.response = router_data_response;
+
+ router_data.connector_http_status_code = Some(ucs_data.status_code);
+
+ Ok((router_data, (), payout_eligibility_response))
+ },
+ ))
+ .await
+ .map(|(router_data, _)| router_data)
+ .change_context(ConnectorError::ResponseHandlingFailed)?;
+
+ Ok(updated_router_data)
+ }
+}
+
+impl<RCD>
+ payout_gateway::PayoutFlowGateway<
+ SessionState,
+ RCD,
+ types::PayoutsData,
+ types::PayoutsResponseData,
+ RouterGatewayContext,
+ > for domain::PoEligibility
+where
+ RCD: Clone
+ + Send
+ + Sync
+ + 'static
+ + RouterDataConversion<Self, types::PayoutsData, types::PayoutsResponseData>,
+{
+ fn get_payout_gateway(
+ execution_path: ExecutionPath,
+ ) -> Box<
+ dyn payout_gateway::PayoutGateway<
+ SessionState,
+ RCD,
+ Self,
+ types::PayoutsData,
+ types::PayoutsResponseData,
+ RouterGatewayContext,
+ >,
+ > {
+ match execution_path {
+ ExecutionPath::Direct => Box::new(payout_gateway::DirectGateway),
+ ExecutionPath::UnifiedConnectorService
+ | ExecutionPath::ShadowUnifiedConnectorService => Box::new(Self),
+ }
+ }
+}
diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rs
index 4e67117860..c24049fbee 100644
--- a/crates/router/src/core/unified_connector_service.rs
+++ b/crates/router/src/core/unified_connector_service.rs
@@ -1847,6 +1847,12 @@ fn get_ucs_client(
})
}
+fn as_header_value(value: &Secret<String>) -> Option<Secret<String>> {
+ http::HeaderValue::from_str(value.peek())
+ .is_ok()
+ .then(|| value.clone())
+}
+
pub fn build_unified_connector_service_auth_metadata(
#[cfg(feature = "v1")] merchant_connector_account: MerchantConnectorAccountType,
#[cfg(feature = "v2")] merchant_connector_account: MerchantConnectorAccountTypeDetails,
@@ -1938,10 +1944,10 @@ pub fn build_unified_connector_service_auth_metadata(
} => Ok(ConnectorAuthMetadata {
connector_name,
auth_type: consts::UCS_AUTH_MULTI_KEY.to_string(),
- api_key: Some(api_key.clone()),
- key1: Some(key1.clone()),
- key2: Some(key2.clone()),
- api_secret: Some(api_secret.clone()),
+ api_key: as_header_value(api_key),
+ key1: as_header_value(key1),
+ key2: as_header_value(key2),
+ api_secret: as_header_value(api_secret),
auth_key_map: None,
merchant_id: Secret::new(merchant_id.to_string()),
connector_config,
@@ -2532,6 +2538,36 @@ impl
}
}
+impl
+ ForeignTryFrom<(
+ payments_grpc::PayoutMethodEligibilityResponse,
+ common_enums::PayoutStatus,
+ )> for crate::types::UcsPayoutEligibilityResponseData
+{
+ type Error = error_stack::Report<UnifiedConnectorServiceError>;
+
+ fn foreign_try_from(
+ value: (
+ payments_grpc::PayoutMethodEligibilityResponse,
+ common_enums::PayoutStatus,
+ ),
+ ) -> Result<Self, Self::Error> {
+ let (response, prev_status) = value;
+
+ let status_code =
+ transformers::convert_connector_service_status_code(response.status_code)?;
+
+ let router_data_response = Result::<PayoutsResponseData, ErrorResponse>::foreign_try_from(
+ (response.clone(), prev_status),
+ )?;
+
+ Ok(Self {
+ router_data_response,
+ status_code,
+ })
+ }
+}
+
impl
ForeignTryFrom<(
payments_grpc::PayoutServiceGetResponse,
diff --git a/crates/router/src/core/unified_connector_service/connector_config.rs b/crates/router/src/core/unified_connector_service/connector_config.rs
index d1c516b240..a59f2de703 100644
--- a/crates/router/src/core/unified_connector_service/connector_config.rs
+++ b/crates/router/src/core/unified_connector_service/connector_config.rs
@@ -611,6 +611,13 @@ pub enum ConnectorSpecificConfig {
certificates: Option<Secret<String>>,
private_key: Option<Secret<String>>,
},
+ /// Deutsche Bank CSEAL configuration
+ Deutschebank {
+ customer_identifier: Secret<String>,
+ key_id: Secret<String>,
+ signing_private_key: Secret<String>,
+ client_certificate_bundle: Secret<String>,
+ },
/// Imerchantsolutions connector configuration
Imerchantsolutions {
api_key: Secret<String>,
@@ -1592,6 +1599,23 @@ impl ForeignTryFrom<(Connector, &ConnectorAuthType, Option<&serde_json::Value>)>
}),
_ => Err(err("Itaubank requires BodyKey auth type")),
},
+ Connector::Deutschebank => match auth {
+ ConnectorAuthType::MultiAuthKey {
+ api_key,
+ key1,
+ api_secret,
+ key2,
+ } => Ok(Self::Deutschebank {
+ customer_identifier: api_key.clone(),
+ key_id: key1.clone(),
+ signing_private_key: api_secret.clone(),
+ client_certificate_bundle: key2.clone(),
+ }),
+ _ => Err(err(
+ "Deutsche Bank requires MultiAuthKey auth type \
+ (customer_identifier / key_id / signing_private_key / client_certificate_bundle)",
+ )),
+ },
Connector::Imerchantsolutions => match auth {
ConnectorAuthType::HeaderKey { api_key } => Ok(Self::Imerchantsolutions {
api_key: api_key.clone(),
diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rs
index 39f48e20e2..e866de9aac 100644
--- a/crates/router/src/core/unified_connector_service/transformers.rs
+++ b/crates/router/src/core/unified_connector_service/transformers.rs
@@ -7130,6 +7130,80 @@ impl
}
}
+#[cfg(feature = "payouts")]
+impl
+ transformers::ForeignTryFrom<
+ &RouterData<
+ hyperswitch_domain_models::router_flow_types::payouts::PoEligibility,
+ router_request_types::PayoutsData,
+ PayoutsResponseData,
+ >,
+ > for payments_grpc::PayoutMethodEligibilityRequest
+{
+ type Error = error_stack::Report<UnifiedConnectorServiceError>;
+
+ fn foreign_try_from(
+ router_data: &RouterData<
+ hyperswitch_domain_models::router_flow_types::payouts::PoEligibility,
+ router_request_types::PayoutsData,
+ PayoutsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ let address = payments_grpc::PayoutAddress::foreign_try_from(router_data.address.clone())?;
+ let source_currency =
+ payments_grpc::Currency::foreign_try_from(router_data.request.source_currency)?;
+ let destination_currency =
+ payments_grpc::Currency::foreign_try_from(router_data.request.destination_currency)?;
+ let money = payments_grpc::Money {
+ minor_amount: router_data.request.amount,
+ currency: source_currency.into(),
+ };
+ let customer = router_data
+ .request
+ .customer_details
+ .as_ref()
+ .map(payments_grpc::Customer::foreign_from)
+ .ok_or(
+ error_stack::Report::new(UnifiedConnectorServiceError::MissingRequiredField {
+ field_name: "customer",
+ })
+ .attach_printable("Missing customer details in Payout Eligibility Request"),
+ )?;
+ let payout_method_data = router_data
+ .payout_method_data
+ .as_ref()
+ .map(|payout_method_data| {
+ payments_grpc::PayoutMethod::foreign_try_from(payout_method_data)
+ })
+ .transpose()?;
+ let source_bank_data = router_data
+ .request
+ .source_bank_data
+ .as_ref()
+ .map(payments_grpc::SourceBankData::foreign_try_from)
+ .transpose()?;
+
+ let connector_feature_data = router_data
+ .request
+ .payout_connector_metadata
+ .clone()
+ .map(|metadata| Secret::new(metadata.expose().to_string()));
+
+ Ok(Self {
+ merchant_payout_id: router_data.payout_id.clone(),
+ connector_feature_data,
+ payout_method_data,
+ amount: Some(money),
+ connector_payout_id: None,
+ destination_currency: destination_currency.into(),
+ access_token: router_data.access_token.clone().map(|at| at.token),
+ address: Some(address),
+ customer: Some(customer),
+ source_bank_data,
+ })
+ }
+}
+
#[cfg(feature = "payouts")]
impl
transformers::ForeignTryFrom<
@@ -7416,7 +7490,13 @@ impl
merchant_payout_id: router_data.payout_id.clone(),
connector_payout_id: router_data.request.connector_payout_id.clone(),
access_token: router_data.access_token.clone().map(|at| at.token),
- source_bank_data: None,
+ // Debtor account for connectors that need it to perform a status enquiry
+ source_bank_data: router_data
+ .request
+ .source_bank_data
+ .as_ref()
+ .map(payments_grpc::SourceBankData::foreign_try_from)
+ .transpose()?,
})
}
}
@@ -7508,6 +7588,88 @@ impl_ucs_payout_response_transformation!(
payments_grpc::PayoutServiceCreateResponse,
merchant_payout_id
);
+
+#[cfg(feature = "payouts")]
+impl
+ transformers::ForeignTryFrom<(
+ payments_grpc::PayoutMethodEligibilityResponse,
+ common_enums::PayoutStatus,
+ )> for Result<PayoutsResponseData, ErrorResponse>
+{
+ type Error = error_stack::Report<UnifiedConnectorServiceError>;
+
+ fn foreign_try_from(
+ (response, prev_status): (
+ payments_grpc::PayoutMethodEligibilityResponse,
+ common_enums::PayoutStatus,
+ ),
+ ) -> Result<Self, Self::Error> {
+ let status_code = convert_connector_service_status_code(response.status_code)?;
+ let status = common_enums::PayoutStatus::foreign_try_from(response.payout_status())
+ .unwrap_or(prev_status);
+
+ let router_response = if let Some(error_info) = response.error {
+ Err(ErrorResponse {
+ code: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.code.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error code in UCS response ErrorInfo"),
+ )?,
+ message: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.message.clone())
+ .ok_or(
+ error_stack::Report::new(
+ UnifiedConnectorServiceError::ResponseDeserializationFailed,
+ )
+ .attach_printable("Missing error message in UCS response ErrorInfo"),
+ )?,
+ reason: error_info
+ .connector_details
+ .as_ref()
+ .and_then(|cd| cd.reason.clone()),
+ status_code,
+ attempt_status: None,
+ connector_transaction_id: response.connector_payout_id.clone(),
+ connector_response_reference_id: response.merchant_payout_id.clone(),
+ network_decline_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.decline_code.clone())
+ }),
+ network_advice_code: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.advice_code.clone())
+ }),
+ network_error_message: error_info.issuer_details.as_ref().and_then(|id| {
+ id.network_details
+ .as_ref()
+ .and_then(|nd| nd.error_message.clone())
+ }),
+ connector_metadata: None,
+ })
+ } else {
+ Ok(PayoutsResponseData {
+ status: Some(status),
+ connector_payout_id: response.connector_payout_id,
+ payout_eligible: response.payout_eligible,
+ should_add_next_step_to_process_tracker: false,
+ error_code: None,
+ error_message: None,
+ payout_connector_metadata: None,
+ })
+ };
+
+ Ok(router_response)
+ }
+}
#[cfg(feature = "payouts")]
impl_ucs_payout_response_transformation!(
payments_grpc::PayoutServiceTransferResponse,
@@ -7768,7 +7930,7 @@ impl transformers::ForeignTryFrom<&api_models::payouts::SepaBankTransfer>
bank_city: item.bank_city.clone(),
iban: Some(item.iban.clone()),
bic: item.bic.clone(),
- account_holder_name: None,
+ account_holder_name: item.account_holder_name.clone(),
})
}
}
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 3cec804aaf..5cbc7dadf4 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -829,6 +829,12 @@ pub struct UcsPayoutTransferResponseData {
pub status_code: u16,
}
+#[cfg(feature = "payouts")]
+pub struct UcsPayoutEligibilityResponseData {
+ pub router_data_response: Result<PayoutsResponseData, ErrorResponse>,
+ pub status_code: u16,
+}
+
#[cfg(feature = "payouts")]
pub struct UcsPayoutGetResponseData {
pub router_data_response: Result<PayoutsResponseData, ErrorResponse>,