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): [Truelayer] Add connector template code (#11228)

Vani Gupta10e90da48eee
diff --git a/config/config.example.toml b/config/config.example.toml
index a54b06c47a..2e69610310 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -330,6 +330,7 @@ threedsecureio.base_url = "https://service.sandbox.3dsecure.io"
thunes.base_url = "https://api.limonetikqualif.com/"
tokenex.base_url = "https://test-api.tokenex.com"
tokenio.base_url = "https://api.sandbox.token.io"
+truelayer.base_url = "https://api.truelayer-sandbox.com"
stripe.base_url_file_upload = "https://files.stripe.com/"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
trustpayments.base_url = "https://webservices.securetrading.net/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 69f22fd601..6cbf58386f 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -154,6 +154,7 @@ tesouro.base_url = "https://api.sandbox.tesouro.com"
thunes.base_url = "https://api.limonetikqualif.com/"
tokenex.base_url = "https://test-api.tokenex.com"
tokenio.base_url = "https://api.sandbox.token.io"
+truelayer.base_url = "https://api.truelayer-sandbox.com"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
trustpayments.base_url = "https://webservices.securetrading.net/"
trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 51399c395b..47c2d39c46 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -157,6 +157,7 @@ tesouro.base_url = "https://api.tesouro.com"
thunes.base_url = "https://api.limonetik.com/"
tokenex.base_url = "https://api.tokenex.com"
tokenio.base_url = "https://api.token.io"
+truelayer.base_url = "https://auth.truelayer.com"
trustpay.base_url = "https://tpgw.trustpay.eu/"
trustpayments.base_url = "https://webservices.securetrading.net/"
trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 2d53f8718b..88969af134 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -157,6 +157,7 @@ tesouro.base_url = "https://api.sandbox.tesouro.com"
thunes.base_url = "https://api.limonetikqualif.com/"
tokenex.base_url = "https://test-api.tokenex.com"
tokenio.base_url = "https://api.sandbox.token.io"
+truelayer.base_url = "https://api.truelayer-sandbox.com"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
trustpayments.base_url = "https://webservices.securetrading.net/"
trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
diff --git a/config/development.toml b/config/development.toml
index ad93619a6e..c0bce35dd6 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -360,6 +360,7 @@ threedsecureio.base_url = "https://service.sandbox.3dsecure.io"
thunes.base_url = "https://api.limonetikqualif.com/"
tokenex.base_url = "https://test-api.tokenex.com"
tokenio.base_url = "https://api.sandbox.token.io"
+truelayer.base_url = "https://api.truelayer-sandbox.com"
stripe.base_url_file_upload = "https://files.stripe.com/"
wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 1b0a04f9d4..e071c5b14b 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -261,6 +261,7 @@ threedsecureio.base_url = "https://service.sandbox.3dsecure.io"
thunes.base_url = "https://api.limonetikqualif.com/"
tokenex.base_url = "https://test-api.tokenex.com"
tokenio.base_url = "https://api.sandbox.token.io"
+truelayer.base_url = "https://api.truelayer-sandbox.com"
stripe.base_url_file_upload = "https://files.stripe.com/"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
trustpayments.base_url = "https://webservices.securetrading.net/"
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index 80ef5f695e..e78eb586bd 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -178,6 +178,7 @@ pub enum Connector {
Tesouro,
Tokenex,
Tokenio,
+ // Truelayer,
Trustpay,
Trustpayments,
Tsys,
@@ -379,6 +380,7 @@ impl Connector {
| Self::Taxjar
| Self::Tesouro
// | Self::Thunes
+ // | Self::Truelayer
| Self::Trustpay
| Self::Trustpayments
// | Self::Tokenio
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index fadb9f830b..2d1f9bd931 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -364,6 +364,7 @@ pub struct ConnectorConfig {
pub tersouro: Option<ConnectorTomlConfig>,
pub tokenex: Option<ConnectorTomlConfig>,
pub tokenio: Option<ConnectorTomlConfig>,
+ pub truelayer: Option<ConnectorTomlConfig>,
pub trustpay: Option<ConnectorTomlConfig>,
pub trustpayments: Option<ConnectorTomlConfig>,
pub threedsecureio: Option<ConnectorTomlConfig>,
@@ -601,6 +602,7 @@ impl ConnectorConfig {
Connector::Tesouro => Ok(connector_data.tesouro),
Connector::Tokenex => Ok(connector_data.tokenex),
Connector::Tokenio => Ok(connector_data.tokenio),
+ // Connector::Truelayer => Ok(connector_data.truelayer),
Connector::Trustpay => Ok(connector_data.trustpay),
Connector::Trustpayments => Ok(connector_data.trustpayments),
Connector::Threedsecureio => Ok(connector_data.threedsecureio),
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index cf93481226..64765907eb 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -8133,3 +8133,8 @@ options=["Connector"]
key1 = "Merchant Terminal Id"
[[payjustnowinstore.pay_later]]
payment_method_type = "payjustnow"
+
+[truelayer]
+[truelayer.connector_auth.BodyKey]
+ api_key = "Client ID"
+ key1 = "Client Secret"
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 7189d34b5b..8e4b6af283 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -7013,3 +7013,8 @@ options=["Connector"]
key1 = "Merchant Terminal Id"
[[payjustnowinstore.pay_later]]
payment_method_type = "payjustnow"
+
+[truelayer]
+[truelayer.connector_auth.BodyKey]
+ api_key = "Client ID"
+ key1 = "Client Secret"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index a9dbf6648c..58abb05aac 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -8104,3 +8104,8 @@ options=["Connector"]
key1 = "Merchant Terminal Id"
[[payjustnowinstore.pay_later]]
payment_method_type = "payjustnow"
+
+[truelayer]
+[truelayer.connector_auth.BodyKey]
+ api_key = "Client ID"
+ key1 = "Client Secret"
diff --git a/crates/euclid/src/enums.rs b/crates/euclid/src/enums.rs
index e733c9409b..c15c84c862 100644
--- a/crates/euclid/src/enums.rs
+++ b/crates/euclid/src/enums.rs
@@ -330,6 +330,7 @@ pub enum RoutableConnectors {
Stripebilling,
Tesouro,
// Taxjar,
+ // Truelayer,
Trustpay,
Trustpayments,
// Thunes
@@ -475,6 +476,7 @@ impl TryFrom<Connector> for RoutableConnectors {
Connector::Stripebilling => Ok(Self::Stripebilling),
Connector::Tokenio => Ok(Self::Tokenio),
Connector::Tesouro => Ok(Self::Tesouro),
+ // Connector::Truelayer => Ok(Self::Truelayer),
Connector::Trustpay => Ok(Self::Trustpay),
Connector::Trustpayments => Ok(Self::Trustpayments),
Connector::Tsys => Ok(Self::Tsys),
@@ -634,6 +636,7 @@ impl From<RoutableConnectors> for Connector {
RoutableConnectors::Stripebilling => Self::Stripebilling,
RoutableConnectors::Tesouro => Self::Tesouro,
RoutableConnectors::Tokenio => Self::Tokenio,
+ // RoutableConnectors::Truelayer => Self::Truelayer,
RoutableConnectors::Trustpay => Self::Trustpay,
RoutableConnectors::Trustpayments => Self::Trustpayments,
// RoutableConnectors::Tokenio => Self::Tokenio,
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index 8eab5e15e5..c4164099c5 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -121,6 +121,7 @@ pub mod threedsecureio;
pub mod thunes;
pub mod tokenex;
pub mod tokenio;
+pub mod truelayer;
pub mod trustpay;
pub mod trustpayments;
pub mod tsys;
@@ -171,8 +172,8 @@ pub use self::{
santander::Santander, shift4::Shift4, sift::Sift, signifyd::Signifyd, silverflow::Silverflow,
square::Square, stax::Stax, stripe::Stripe, stripebilling::Stripebilling, taxjar::Taxjar,
tesouro::Tesouro, threedsecureio::Threedsecureio, thunes::Thunes, tokenex::Tokenex,
- tokenio::Tokenio, trustpay::Trustpay, trustpayments::Trustpayments, tsys::Tsys,
- unified_authentication_service::UnifiedAuthenticationService, vgs::Vgs, volt::Volt,
+ tokenio::Tokenio, truelayer::Truelayer, trustpay::Trustpay, trustpayments::Trustpayments,
+ tsys::Tsys, unified_authentication_service::UnifiedAuthenticationService, vgs::Vgs, volt::Volt,
wellsfargo::Wellsfargo, wellsfargopayout::Wellsfargopayout, wise::Wise, worldline::Worldline,
worldpay::Worldpay, worldpaymodular::Worldpaymodular, worldpayvantiv::Worldpayvantiv,
worldpayxml::Worldpayxml, xendit::Xendit, zen::Zen, zift::Zift, zsl::Zsl,
diff --git a/crates/hyperswitch_connectors/src/connectors/truelayer.rs b/crates/hyperswitch_connectors/src/connectors/truelayer.rs
new file mode 100644
index 0000000000..319f170111
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/truelayer.rs
@@ -0,0 +1,626 @@
+pub mod transformers;
+
+use std::sync::LazyLock;
+
+use common_enums::enums;
+use common_utils::{
+ errors::CustomResult,
+ ext_traits::BytesExt,
+ request::{Method, Request, RequestBuilder, RequestContent},
+ types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
+};
+use error_stack::{report, ResultExt};
+use hyperswitch_domain_models::{
+ payment_method_data::PaymentMethodData,
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+ router_flow_types::{
+ access_token_auth::AccessTokenAuth,
+ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+ refunds::{Execute, RSync},
+ },
+ router_request_types::{
+ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+ RefundsData, SetupMandateRequestData,
+ },
+ router_response_types::{
+ ConnectorInfo, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods,
+ },
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
+ RefundSyncRouterData, RefundsRouterData,
+ },
+};
+use hyperswitch_interfaces::{
+ api::{
+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
+ ConnectorValidation,
+ },
+ configs::Connectors,
+ errors,
+ events::connector_api_logs::ConnectorEvent,
+ types::{self, Response},
+ webhooks,
+};
+use masking::{ExposeInterface, Mask};
+use transformers as truelayer;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Truelayer {
+ amount_converter: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync),
+}
+
+impl Truelayer {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &MinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Truelayer {}
+impl api::PaymentSession for Truelayer {}
+impl api::ConnectorAccessToken for Truelayer {}
+impl api::MandateSetup for Truelayer {}
+impl api::PaymentAuthorize for Truelayer {}
+impl api::PaymentSync for Truelayer {}
+impl api::PaymentCapture for Truelayer {}
+impl api::PaymentVoid for Truelayer {}
+impl api::Refund for Truelayer {}
+impl api::RefundExecute for Truelayer {}
+impl api::RefundSync for Truelayer {}
+impl api::PaymentToken for Truelayer {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Truelayer
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Truelayer
+where
+ Self: ConnectorIntegration<Flow, Request, Response>,
+{
+ fn build_headers(
+ &self,
+ req: &RouterData<Flow, Request, Response>,
+ _connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let mut header = vec![(
+ headers::CONTENT_TYPE.to_string(),
+ self.get_content_type().to_string().into(),
+ )];
+ let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
+ header.append(&mut api_key);
+ Ok(header)
+ }
+}
+
+impl ConnectorCommon for Truelayer {
+ fn id(&self) -> &'static str {
+ "truelayer"
+ }
+
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Minor
+ }
+
+ fn common_get_content_type(&self) -> &'static str {
+ "application/json"
+ }
+
+ fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
+ connectors.truelayer.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = truelayer::TruelayerAuthType::try_from(auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ Ok(vec![(
+ headers::AUTHORIZATION.to_string(),
+ auth.api_key.expose().into_masked(),
+ )])
+ }
+
+ fn build_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ let response: truelayer::TruelayerErrorResponse = res
+ .response
+ .parse_struct("TruelayerErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: response.code,
+ message: response.message,
+ reason: response.reason,
+ attempt_status: None,
+ connector_transaction_id: None,
+ connector_response_reference_id: None,
+ network_advice_code: None,
+ network_decline_code: None,
+ network_error_message: None,
+ connector_metadata: None,
+ })
+ }
+}
+
+impl ConnectorValidation for Truelayer {
+ fn validate_mandate_payment(
+ &self,
+ _pm_type: Option<enums::PaymentMethodType>,
+ pm_data: PaymentMethodData,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ match pm_data {
+ PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
+ "validate_mandate_payment does not support cards".to_string(),
+ )
+ .into()),
+ _ => Ok(()),
+ }
+ }
+
+ fn validate_psync_reference_id(
+ &self,
+ _data: &PaymentsSyncData,
+ _is_three_ds: bool,
+ _status: enums::AttemptStatus,
+ _connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,
+ ) -> CustomResult<(), errors::ConnectorError> {
+ Ok(())
+ }
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Truelayer {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Truelayer {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
+ for Truelayer
+{
+}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Truelayer {
+ fn get_headers(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = truelayer::TruelayerRouterData::from((amount, req));
+ let connector_req = truelayer::TruelayerPaymentsRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
+ .attach_default_headers()
+ .headers(types::PaymentsAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsAuthorizeType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsAuthorizeRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
+ let response: truelayer::TruelayerPaymentsResponse = res
+ .response
+ .parse_struct("Truelayer PaymentsAuthorizeResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Truelayer {
+ fn get_headers(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
+ let response: truelayer::TruelayerPaymentsResponse = res
+ .response
+ .parse_struct("truelayer PaymentsSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Truelayer {
+ fn get_headers(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ _req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsCaptureType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsCaptureType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsCaptureRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
+ let response: truelayer::TruelayerPaymentsResponse = res
+ .response
+ .parse_struct("Truelayer PaymentsCaptureResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Truelayer {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Truelayer {
+ fn get_headers(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let refund_amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_refund_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = truelayer::TruelayerRouterData::from((refund_amount, req));
+ let connector_req = truelayer::TruelayerRefundRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ let request = RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundExecuteType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::RefundExecuteType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build();
+ Ok(Some(request))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundsRouterData<Execute>,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
+ let response: truelayer::RefundResponse = res
+ .response
+ .parse_struct("truelayer RefundResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Truelayer {
+ fn get_headers(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefundSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
+ .set_body(types::RefundSyncType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
+ let response: truelayer::RefundResponse = res
+ .response
+ .parse_struct("truelayer RefundSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+#[async_trait::async_trait]
+impl webhooks::IncomingWebhook for Truelayer {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
+ ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
+
+static TRUELAYER_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
+ LazyLock::new(SupportedPaymentMethods::new);
+
+static TRUELAYER_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
+ display_name: "Truelayer",
+ description: "Truelayer connector",
+ connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,
+ integration_status: enums::ConnectorIntegrationStatus::Live,
+};
+
+static TRUELAYER_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 0] = [];
+
+impl ConnectorSpecifications for Truelayer {
+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
+ Some(&TRUELAYER_CONNECTOR_INFO)
+ }
+
+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
+ Some(&*TRUELAYER_SUPPORTED_PAYMENT_METHODS)
+ }
+
+ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
+ Some(&TRUELAYER_SUPPORTED_WEBHOOK_FLOWS)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/truelayer/transformers.rs b/crates/hyperswitch_connectors/src/connectors/truelayer/transformers.rs
new file mode 100644
index 0000000000..4715d2a48e
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/truelayer/transformers.rs
@@ -0,0 +1,220 @@
+use common_enums::enums;
+use common_utils::types::MinorUnit;
+use hyperswitch_domain_models::{
+ payment_method_data::PaymentMethodData,
+ router_data::{ConnectorAuthType, RouterData},
+ router_flow_types::refunds::{Execute, RSync},
+ router_request_types::ResponseId,
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+};
+use hyperswitch_interfaces::errors;
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use crate::types::{RefundsResponseRouterData, ResponseRouterData};
+
+//TODO: Fill the struct with respective fields
+pub struct TruelayerRouterData<T> {
+ pub amount: MinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub router_data: T,
+}
+
+impl<T> From<(MinorUnit, T)> for TruelayerRouterData<T> {
+ fn from((amount, item): (MinorUnit, T)) -> Self {
+ //Todo : use utils to convert the amount to the type of amount that a connector accepts
+ Self {
+ amount,
+ router_data: item,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct TruelayerPaymentsRequest {
+ amount: MinorUnit,
+ card: TruelayerCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct TruelayerCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&TruelayerRouterData<&PaymentsAuthorizeRouterData>> for TruelayerPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &TruelayerRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
+ "Card payment method not implemented".to_string(),
+ )
+ .into()),
+ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct TruelayerAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for TruelayerAuthType {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+ match auth_type {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
+ api_key: api_key.to_owned(),
+ }),
+ _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+ }
+ }
+}
+// PaymentsResponse
+//TODO: Append the remaining status flags
+#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum TruelayerPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<TruelayerPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: TruelayerPaymentStatus) -> Self {
+ match item {
+ TruelayerPaymentStatus::Succeeded => Self::Charged,
+ TruelayerPaymentStatus::Failed => Self::Failure,
+ TruelayerPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct TruelayerPaymentsResponse {
+ status: TruelayerPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, TruelayerPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, TruelayerPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: common_enums::AttemptStatus::from(item.response.status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ authentication_data: None,
+ charges: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// REFUND :
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct TruelayerRefundRequest {
+ pub amount: MinorUnit,
+}
+
+impl<F> TryFrom<&TruelayerRouterData<&RefundsRouterData<F>>> for TruelayerRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &TruelayerRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ Ok(Self {
+ amount: item.amount.to_owned(),
+ })
+ }
+}
+
+// Type definition for Refund Response
+
+#[allow(dead_code)]
+#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]
+pub enum RefundStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<RefundStatus> for enums::RefundStatus {
+ fn from(item: RefundStatus) -> Self {
+ match item {
+ RefundStatus::Succeeded => Self::Success,
+ RefundStatus::Failed => Self::Failure,
+ RefundStatus::Processing => Self::Pending,
+ //TODO: Review mapping
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct RefundResponse {
+ id: String,
+ status: RefundStatus,
+}
+
+impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<Execute, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<RSync, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+pub struct TruelayerErrorResponse {
+ pub status_code: u16,
+ pub code: String,
+ pub message: String,
+ pub reason: Option<String>,
+ pub network_advice_code: Option<String>,
+ pub network_decline_code: Option<String>,
+ pub network_error_message: Option<String>,
+}
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 53c05da94a..6f3ce2f4ba 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -300,6 +300,7 @@ default_imp_for_authorize_session_token!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -454,6 +455,7 @@ default_imp_for_payment_settlement_split_create!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -608,6 +610,7 @@ default_imp_for_calculate_tax!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -775,6 +778,7 @@ default_imp_for_session_update!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -927,6 +931,7 @@ default_imp_for_post_session_tokens!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1078,6 +1083,7 @@ default_imp_for_create_order!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
@@ -1231,6 +1237,7 @@ default_imp_for_update_metadata!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1385,6 +1392,7 @@ default_imp_for_cancel_post_capture!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1512,6 +1520,7 @@ default_imp_for_complete_authorize!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1662,6 +1671,7 @@ default_imp_for_incremental_authorization!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1823,6 +1833,7 @@ default_imp_for_extend_authorization!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1959,6 +1970,7 @@ default_imp_for_create_customer!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -2102,6 +2114,7 @@ default_imp_for_connector_redirect_response!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
connectors::Wise,
@@ -2245,6 +2258,7 @@ default_imp_for_pre_authenticate_steps!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -2399,6 +2413,7 @@ default_imp_for_authenticate_steps!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -2552,6 +2567,7 @@ default_imp_for_post_authenticate_steps!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -2697,6 +2713,7 @@ default_imp_for_pre_processing_steps!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
connectors::Wise,
@@ -2849,6 +2866,7 @@ default_imp_for_post_processing_steps!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3006,6 +3024,7 @@ default_imp_for_approve!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3163,6 +3182,7 @@ default_imp_for_reject!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3319,6 +3339,7 @@ default_imp_for_webhook_source_verification!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3475,6 +3496,7 @@ default_imp_for_accept_dispute!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3628,6 +3650,7 @@ default_imp_for_submit_evidence!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3782,6 +3805,7 @@ default_imp_for_defend_dispute!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3939,6 +3963,7 @@ default_imp_for_fetch_disputes!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -4095,6 +4120,7 @@ default_imp_for_dispute_sync!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -4257,6 +4283,7 @@ default_imp_for_file_upload!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -4395,6 +4422,7 @@ default_imp_for_payouts!(
connectors::Threedsecureio,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -4544,6 +4572,7 @@ default_imp_for_payouts_create!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -4698,6 +4727,7 @@ default_imp_for_payouts_retrieve!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -4852,6 +4882,7 @@ default_imp_for_payouts_eligibility!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -5000,6 +5031,7 @@ default_imp_for_payouts_fulfill!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -5151,6 +5183,7 @@ default_imp_for_payouts_cancel!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -5305,6 +5338,7 @@ default_imp_for_payouts_quote!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -5460,6 +5494,7 @@ default_imp_for_payouts_recipient!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -5616,6 +5651,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -5773,6 +5809,7 @@ default_imp_for_frm_sale!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -5929,6 +5966,7 @@ default_imp_for_frm_checkout!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -6085,6 +6123,7 @@ default_imp_for_frm_transaction!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -6242,6 +6281,7 @@ default_imp_for_frm_fulfillment!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -6399,6 +6439,7 @@ default_imp_for_frm_record_return!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -6552,6 +6593,7 @@ default_imp_for_revoking_mandates!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -6707,6 +6749,7 @@ default_imp_for_uas_pre_authentication!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -6861,6 +6904,7 @@ default_imp_for_uas_webhook!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -7015,6 +7059,7 @@ default_imp_for_uas_post_authentication!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -7170,6 +7215,7 @@ default_imp_for_uas_authentication_confirmation!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -7316,6 +7362,7 @@ default_imp_for_connector_request_id!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -7464,6 +7511,7 @@ default_imp_for_fraud_check!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -7642,6 +7690,7 @@ default_imp_for_connector_authentication!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -7796,6 +7845,7 @@ default_imp_for_uas_authentication!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -7944,6 +7994,7 @@ default_imp_for_revenue_recovery!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -8150,6 +8201,7 @@ default_imp_for_subscriptions!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -8307,6 +8359,7 @@ default_imp_for_billing_connector_payment_sync!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -8456,6 +8509,7 @@ default_imp_for_revenue_recovery_record_back!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -8613,6 +8667,7 @@ default_imp_for_billing_connector_invoice_sync!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -8762,6 +8817,7 @@ default_imp_for_external_vault!(
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -8917,6 +8973,7 @@ default_imp_for_external_vault_insert!(
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -9070,6 +9127,7 @@ default_imp_for_gift_card_balance_check!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -9226,6 +9284,7 @@ default_imp_for_external_vault_retrieve!(
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -9382,6 +9441,7 @@ default_imp_for_external_vault_delete!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -9538,6 +9598,7 @@ default_imp_for_external_vault_create!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -9694,6 +9755,7 @@ default_imp_for_connector_authentication_token!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -9849,6 +9911,7 @@ default_imp_for_external_vault_proxy_payments_create!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -10007,6 +10070,7 @@ default_imp_for_connector_webhook_register!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -10858,6 +10922,7 @@ default_impl_connector_access_token!(
connectors::Tesouro,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index 9c727d3832..4e5215d11c 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -440,6 +440,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -597,6 +598,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -743,6 +745,7 @@ default_imp_for_new_connector_integration_connector_authentication_token!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
@@ -894,6 +897,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1051,6 +1055,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1208,6 +1213,7 @@ default_imp_for_new_connector_integration_fetch_disputes!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1366,6 +1372,7 @@ default_imp_for_new_connector_integration_dispute_sync!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1524,6 +1531,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1680,6 +1688,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -1847,6 +1856,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -2006,6 +2016,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -2165,6 +2176,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -2324,6 +2336,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -2483,6 +2496,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -2642,6 +2656,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -2801,6 +2816,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -2960,6 +2976,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3119,6 +3136,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3276,6 +3294,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3435,6 +3454,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3594,6 +3614,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3753,6 +3774,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -3912,6 +3934,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -4071,6 +4094,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -4226,6 +4250,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -4351,6 +4376,7 @@ default_imp_for_new_connector_integration_frm!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
@@ -4505,6 +4531,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
@@ -4651,6 +4678,7 @@ default_imp_for_new_connector_integration_revenue_recovery!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
@@ -4833,6 +4861,7 @@ default_imp_for_new_connector_integration_external_vault!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
@@ -4989,6 +5018,7 @@ default_imp_for_new_connector_integration_external_vault_proxy!(
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
+ connectors::Truelayer,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
diff --git a/crates/hyperswitch_domain_models/src/connector_endpoints.rs b/crates/hyperswitch_domain_models/src/connector_endpoints.rs
index 82acbf9d76..162785f1df 100644
--- a/crates/hyperswitch_domain_models/src/connector_endpoints.rs
+++ b/crates/hyperswitch_domain_models/src/connector_endpoints.rs
@@ -136,6 +136,7 @@ pub struct Connectors {
pub thunes: ConnectorParams,
pub tokenex: ConnectorParams,
pub tokenio: ConnectorParams,
+ pub truelayer: ConnectorParams,
pub trustpay: ConnectorParamsWithMoreUrls,
pub trustpayments: ConnectorParams,
pub tsys: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index c90866ea52..50dbcb4c5a 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -46,12 +46,12 @@ pub use hyperswitch_connectors::connectors::{
silverflow::Silverflow, square, square::Square, stax, stax::Stax, stripe, stripe::Stripe,
stripebilling, stripebilling::Stripebilling, taxjar, taxjar::Taxjar, tesouro, tesouro::Tesouro,
threedsecureio, threedsecureio::Threedsecureio, thunes, thunes::Thunes, tokenex,
- tokenex::Tokenex, tokenio, tokenio::Tokenio, trustpay, trustpay::Trustpay, trustpayments,
- trustpayments::Trustpayments, tsys, tsys::Tsys, unified_authentication_service,
- unified_authentication_service::UnifiedAuthenticationService, vgs, vgs::Vgs, volt, volt::Volt,
- wellsfargo, wellsfargo::Wellsfargo, wellsfargopayout, wellsfargopayout::Wellsfargopayout, wise,
- wise::Wise, worldline, worldline::Worldline, worldpay, worldpay::Worldpay, worldpaymodular,
- worldpaymodular::Worldpaymodular, worldpayvantiv, worldpayvantiv::Worldpayvantiv, worldpayxml,
- worldpayxml::Worldpayxml, xendit, xendit::Xendit, zen, zen::Zen, zift, zift::Zift, zsl,
- zsl::Zsl,
+ tokenex::Tokenex, tokenio, tokenio::Tokenio, truelayer, truelayer::Truelayer, trustpay,
+ trustpay::Trustpay, trustpayments, trustpayments::Trustpayments, tsys, tsys::Tsys,
+ unified_authentication_service, unified_authentication_service::UnifiedAuthenticationService,
+ vgs, vgs::Vgs, volt, volt::Volt, wellsfargo, wellsfargo::Wellsfargo, wellsfargopayout,
+ wellsfargopayout::Wellsfargopayout, wise, wise::Wise, worldline, worldline::Worldline,
+ worldpay, worldpay::Worldpay, worldpaymodular, worldpaymodular::Worldpaymodular,
+ worldpayvantiv, worldpayvantiv::Worldpayvantiv, worldpayxml, worldpayxml::Worldpayxml, xendit,
+ xendit::Xendit, zen, zen::Zen, zift, zift::Zift, zsl, zsl::Zsl,
};
diff --git a/crates/router/src/core/connector_validation.rs b/crates/router/src/core/connector_validation.rs
index de44e1761b..ed16436dc6 100644
--- a/crates/router/src/core/connector_validation.rs
+++ b/crates/router/src/core/connector_validation.rs
@@ -518,6 +518,10 @@ impl ConnectorAuthTypeAndMetadataValidation<'_> {
tesouro::transformers::TesouroAuthType::try_from(self.auth_type)?;
Ok(())
}
+ // api_enums::Connector::Truelayer => {
+ // truelayer::transformers::TruelayerAuthType::try_from(self.auth_type)?;
+ // Ok(())
+ // }
api_enums::Connector::Trustpay => {
trustpay::transformers::TrustpayAuthType::try_from(self.auth_type)?;
Ok(())
diff --git a/crates/router/src/types/api/connector_mapping.rs b/crates/router/src/types/api/connector_mapping.rs
index e5736351a6..1020149496 100644
--- a/crates/router/src/types/api/connector_mapping.rs
+++ b/crates/router/src/types/api/connector_mapping.rs
@@ -461,6 +461,9 @@ impl ConnectorData {
enums::Connector::Tokenio => {
Ok(ConnectorEnum::Old(Box::new(connector::Tokenio::new())))
}
+ // enums::Connector::Truelayer => {
+ // Ok(ConnectorEnum::Old(Box::new(connector::Truelayer::new())))
+ // }
enums::Connector::Trustpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Trustpay::new())))
}
diff --git a/crates/router/src/types/api/feature_matrix.rs b/crates/router/src/types/api/feature_matrix.rs
index 830394994c..dc18796f48 100644
--- a/crates/router/src/types/api/feature_matrix.rs
+++ b/crates/router/src/types/api/feature_matrix.rs
@@ -378,6 +378,9 @@ impl FeatureMatrixConnectorData {
enums::Connector::Tokenio => {
Ok(ConnectorEnum::Old(Box::new(connector::Tokenio::new())))
}
+ // enums::Connector::Truelayer => {
+ // Ok(ConnectorEnum::Old(Box::new(connector::Truelayer::new())))
+ // }
enums::Connector::Trustpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Trustpay::new())))
}
diff --git a/crates/router/src/types/connector_transformers.rs b/crates/router/src/types/connector_transformers.rs
index 48fb90ddba..becc99aa3c 100644
--- a/crates/router/src/types/connector_transformers.rs
+++ b/crates/router/src/types/connector_transformers.rs
@@ -164,6 +164,7 @@ impl ForeignTryFrom<api_enums::Connector> for euclid::enums::RoutableConnectors
})?
}
api_enums::Connector::Tokenio => Self::Tokenio,
+ // api_enums::Connector::Truelayer => Self::Truelayer,
api_enums::Connector::Trustpay => Self::Trustpay,
api_enums::Connector::Trustpayments => Self::Trustpayments,
api_enums::Connector::Tsys => Self::Tsys,
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index f5126afa59..af5d354724 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -121,6 +121,7 @@ mod taxjar;
mod tesouro;
mod tokenex;
mod tokenio;
+mod truelayer;
mod trustpay;
mod trustpayments;
mod tsys;
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index adf7fe3626..470d3774e2 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -386,4 +386,8 @@ api_secret = "Password"
[payjustnowinstore]
api_key = "Merchant API Key"
-key1 = "Merchant Terminal Id"
\ No newline at end of file
+key1 = "Merchant Terminal Id"
+
+[truelayer]
+api_key = "Client ID"
+key1 = "Client Secret"
\ No newline at end of file
diff --git a/crates/router/tests/connectors/truelayer.rs b/crates/router/tests/connectors/truelayer.rs
new file mode 100644
index 0000000000..3ecea97af5
--- /dev/null
+++ b/crates/router/tests/connectors/truelayer.rs
@@ -0,0 +1,421 @@
+use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};
+use masking::Secret;
+use router::types::{self, api, storage::enums};
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct TruelayerTest;
+impl ConnectorActions for TruelayerTest {}
+impl utils::Connector for TruelayerTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Truelayer;
+ utils::construct_connector_data_old(
+ Box::new(Truelayer::new()),
+ types::Connector::Plaid,
+ api::GetToken::Connector,
+ None,
+ )
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .truelayer
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "truelayer".to_string()
+ }
+}
+
+static CONNECTOR: TruelayerTest = TruelayerTest {};
+
+fn get_default_payment_info() -> Option<utils::PaymentInfo> {
+ None
+}
+
+fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
+ None
+}
+
+// Cards Positive Tests
+// Creates a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_only_authorize_payment() {
+ let response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized);
+}
+
+// Captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Partially captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(
+ payment_method_details(),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 50,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_authorized_payment() {
+ let authorize_response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("PSync response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized,);
+}
+
+// Voids a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_void_payment(
+ payment_method_details(),
+ Some(types::PaymentsCancelData {
+ connector_transaction_id: String::from(""),
+ cancellation_reason: Some("requested_by_customer".to_string()),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Void payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Voided);
+}
+
+// Refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Synchronizes a refund using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_manually_captured_refund() {
+ let refund_response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_make_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_auto_captured_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Charged,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ capture_method: Some(enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
+// Refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+ let response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ refund_response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+ CONNECTOR
+ .make_payment_and_multiple_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await;
+}
+
+// Synchronizes a refund using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_refund() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Cards Negative scenarios
+// Creates a payment with incorrect CVC.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_cvc() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_cvc: Secret::new("12345".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's security code is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry month.
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_month: Secret::new("20".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration month is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry year.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_expiry_year() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_year: Secret::new("2000".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration year is invalid.".to_string(),
+ );
+}
+
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let void_response = CONNECTOR
+ .void_payment(txn_id.unwrap(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ void_response.response.unwrap_err().message,
+ "You cannot cancel this PaymentIntent because it has a status of succeeded."
+ );
+}
+
+// Captures a payment using invalid connector payment id.
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ let capture_response = CONNECTOR
+ .capture_payment("123456789".to_string(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.response.unwrap_err().message,
+ String::from("No such payment_intent: '123456789'")
+ );
+}
+
+// Refunds a payment with refund amount higher than payment amount.
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+ let response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 150,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Refund amount (₹1.50) is greater than charge amount (₹1.00)",
+ );
+}
+
+// Connector dependent test cases goes here
+
+// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index 4fc74dfce4..677674afa7 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -131,6 +131,7 @@ pub struct ConnectorAuthentication {
pub thunes: Option<HeaderKey>,
pub tokenex: Option<BodyKey>,
pub tokenio: Option<HeaderKey>,
+ pub truelayer: Option<BodyKey>,
pub stripe_au: Option<HeaderKey>,
pub stripe_uk: Option<HeaderKey>,
pub trustpay: Option<SignatureKey>,
diff --git a/crates/test_utils/tests/sample_auth.toml b/crates/test_utils/tests/sample_auth.toml
index 865e91345f..b4dc017424 100644
--- a/crates/test_utils/tests/sample_auth.toml
+++ b/crates/test_utils/tests/sample_auth.toml
@@ -176,4 +176,8 @@ key1="Tenant ID"
[payjustnowinstore]
api_key="Merchant API Key"
-key1 = "Merchant Terminal Id"
\ No newline at end of file
+key1 = "Merchant Terminal Id"
+
+[truelayer]
+api_key="Client ID"
+key1="Client Secret"
\ No newline at end of file
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index bda33a0579..87dfe1f293 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -221,6 +221,7 @@ threedsecureio.base_url = "https://service.sandbox.3dsecure.io"
thunes.base_url = "https://api.limonetikqualif.com/"
tokenex.base_url = "https://test-api.tokenex.com"
tokenio.base_url = "https://api.sandbox.token.io"
+truelayer.base_url = "https://api.truelayer-sandbox.com"
stripe.base_url_file_upload = "https://files.stripe.com/"
trustpay.base_url = "https://test-tpgw.trustpay.eu/"
trustpayments.base_url = "https://webservices.securetrading.net/"
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 8acdeea9c2..8049b2b51e 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen adyenplatform affirm airwallex amazonpay applepay archipel authipay authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay blackhawknetwork bluesnap boku braintree breadpay calida cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource cybersourcedecisionmanager datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon envoy facilitapay finix fiserv fiservemea fiuu flexiti forte getnet gigadat globalpay globepay gocardless gpayments helcim hipay hyperpg hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna loonio mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payjustnow payjustnowinstore payload payme payone paypal paysafe paystack paytm payu peachpayments phonepe placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 sift silverflow square stax stripe stripebilling taxjar tesouro threedsecureio thunes tokenex tokenio trustpay trustpayments tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpaymodular worldpayvantiv worldpayxml xendit zift zsl "$1")
+ connectors=(aci adyen adyenplatform affirm airwallex amazonpay applepay archipel authipay authorizedotnet bambora bamboraapac bankofamerica barclaycard billwerk bitpay blackhawknetwork bluesnap boku braintree breadpay calida cashtocode celero chargebee checkbook checkout coinbase cryptopay ctp_visa custombilling cybersource cybersourcedecisionmanager datatrans deutschebank digitalvirgo dlocal dummyconnector dwolla ebanx elavon envoy facilitapay finix fiserv fiservemea fiuu flexiti forte getnet gigadat globalpay globepay gocardless gpayments helcim hipay hyperpg hyperswitch_vault hyperwallet hyperwallet iatapay inespay itaubank jpmorgan juspaythreedsserver katapult klarna loonio mifinity mollie moneris mpgs multisafepay netcetera nexinets nexixpay nomupay noon nordea novalnet nuvei opayo opennode paybox payeezy payjustnow payjustnowinstore payload payme payone paypal paysafe paystack paytm payu peachpayments phonepe placetopay plaid powertranz prophetpay rapyd razorpay recurly redsys santander shift4 sift silverflow square stax stripe stripebilling taxjar tesouro threedsecureio thunes tokenex tokenio truelayer trustpay trustpayments tsys unified_authentication_service vgs volt wellsfargo wellsfargopayout wise worldline worldpay worldpaymodular worldpayvantiv worldpayxml xendit zift zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS