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

fix(connector): [Truelayer] Pass reference id in payout request (#12402)

Vani Gupta0dcb5f3636af
diff --git a/crates/hyperswitch_connectors/src/connectors/truelayer.rs b/crates/hyperswitch_connectors/src/connectors/truelayer.rs
index a8ab106f4d..a5b4c2da44 100644
--- a/crates/hyperswitch_connectors/src/connectors/truelayer.rs
+++ b/crates/hyperswitch_connectors/src/connectors/truelayer.rs
@@ -197,8 +197,8 @@ impl ConnectorCommon for Truelayer {
Ok(ErrorResponse {
status_code: res.status_code,
code: response.title.clone(),
- message: response.title.clone(),
- reason: Some(response.detail),
+ message: response.detail.clone(),
+ reason: Some(response.title),
attempt_status: None,
connector_transaction_id: Some(response.trace_id),
connector_response_reference_id: None,
diff --git a/crates/hyperswitch_connectors/src/connectors/truelayer/transformers.rs b/crates/hyperswitch_connectors/src/connectors/truelayer/transformers.rs
index 61d80ae2d4..f14388f19b 100644
--- a/crates/hyperswitch_connectors/src/connectors/truelayer/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/truelayer/transformers.rs
@@ -385,8 +385,8 @@ impl TryFrom<&TruelayerRouterData<&PayoutsRouterData<PoFulfill>>> for TruelayerP
currency: item.router_data.request.destination_currency,
beneficiary: TruelayerBeneficiary {
_type: TruelayerBeneficiaryType::ExternalAccount,
- reference: normalize_payment_id(
- item.router_data.request.payout_id.get_string_repr(),
+ reference: normalize_connector_request_reference_id(
+ &item.router_data.connector_request_reference_id.clone(),
),
account_holder_name: Some(open_banking_data.account_holder_name),
account_identifier: Some(TruelayerAccountIdentifier {
@@ -406,8 +406,8 @@ impl TryFrom<&TruelayerRouterData<&PayoutsRouterData<PoFulfill>>> for TruelayerP
currency: item.router_data.request.destination_currency,
beneficiary: TruelayerBeneficiary {
_type: TruelayerBeneficiaryType::PaymentSource,
- reference: normalize_payment_id(
- item.router_data.request.payout_id.get_string_repr(),
+ reference: normalize_connector_request_reference_id(
+ &item.router_data.connector_request_reference_id.clone(),
),
account_holder_name: None,
account_identifier: None,
@@ -661,10 +661,10 @@ pub fn generate_tl_signature(
}
}
-pub fn normalize_payment_id(payment_id: &str) -> String {
- payment_id
+fn normalize_connector_request_reference_id(reference_id: &str) -> String {
+ reference_id
.chars()
- .filter(|c| c.is_ascii_alphanumeric())
+ .map(|c| if c == '_' { '-' } else { c })
.collect()
}