mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
refactor(core): introduce an interface to switch between old and new connector integration implementations on the connectors (#5013)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -27,9 +27,12 @@ use crate::{
|
||||
app::{ReqState, SessionStateInfo},
|
||||
lock_utils, SessionState,
|
||||
},
|
||||
services::{self, authentication as auth},
|
||||
services::{
|
||||
self, authentication as auth, connector_integration_interface::ConnectorEnum,
|
||||
ConnectorValidation,
|
||||
},
|
||||
types::{
|
||||
api::{self, mandates::MandateResponseExt},
|
||||
api::{self, mandates::MandateResponseExt, ConnectorCommon, IncomingWebhook},
|
||||
domain,
|
||||
storage::{self, enums},
|
||||
transformers::{ForeignFrom, ForeignInto, ForeignTryFrom},
|
||||
@ -374,7 +377,7 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
|
||||
key_store,
|
||||
webhook_details,
|
||||
source_verified,
|
||||
connector,
|
||||
&connector,
|
||||
&request_details,
|
||||
event_type,
|
||||
))
|
||||
@ -416,7 +419,7 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
|
||||
source_verified,
|
||||
event_type,
|
||||
&request_details,
|
||||
connector,
|
||||
&connector,
|
||||
object_ref_id,
|
||||
business_profile,
|
||||
merchant_connector_account,
|
||||
@ -968,7 +971,7 @@ async fn external_authentication_incoming_webhook_flow(
|
||||
source_verified: bool,
|
||||
event_type: webhooks::IncomingWebhookEvent,
|
||||
request_details: &api::IncomingWebhookRequestDetails<'_>,
|
||||
connector: &(dyn api::Connector + Sync),
|
||||
connector: &ConnectorEnum,
|
||||
object_ref_id: api::ObjectReferenceId,
|
||||
business_profile: diesel_models::business_profile::BusinessProfile,
|
||||
merchant_connector_account: domain::MerchantConnectorAccount,
|
||||
@ -1342,7 +1345,7 @@ async fn disputes_incoming_webhook_flow(
|
||||
key_store: domain::MerchantKeyStore,
|
||||
webhook_details: api::IncomingWebhookDetails,
|
||||
source_verified: bool,
|
||||
connector: &(dyn api::Connector + Sync),
|
||||
connector: &ConnectorEnum,
|
||||
request_details: &api::IncomingWebhookRequestDetails<'_>,
|
||||
event_type: webhooks::IncomingWebhookEvent,
|
||||
) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
|
||||
@ -1535,7 +1538,7 @@ fn get_connector_by_connector_name(
|
||||
state: &SessionState,
|
||||
connector_name: &str,
|
||||
merchant_connector_id: Option<String>,
|
||||
) -> CustomResult<(&'static (dyn api::Connector + Sync), String), errors::ApiErrorResponse> {
|
||||
) -> CustomResult<(ConnectorEnum, String), errors::ApiErrorResponse> {
|
||||
let authentication_connector =
|
||||
api_models::enums::convert_authentication_connector(connector_name);
|
||||
#[cfg(feature = "frm")]
|
||||
@ -1545,7 +1548,7 @@ fn get_connector_by_connector_name(
|
||||
let frm_connector_data =
|
||||
api::FraudCheckConnectorData::get_connector_by_name(connector_name)?;
|
||||
return Ok((
|
||||
*frm_connector_data.connector,
|
||||
frm_connector_data.connector,
|
||||
frm_connector_data.connector_name.to_string(),
|
||||
));
|
||||
}
|
||||
@ -1574,7 +1577,7 @@ fn get_connector_by_connector_name(
|
||||
connector_data.connector_name.to_string(),
|
||||
)
|
||||
};
|
||||
Ok((*connector, connector_name))
|
||||
Ok((connector, connector_name))
|
||||
}
|
||||
|
||||
/// This function fetches the merchant connector account ( if the url used is /{merchant_connector_id})
|
||||
@ -1587,7 +1590,7 @@ async fn fetch_optional_mca_and_connector(
|
||||
) -> CustomResult<
|
||||
(
|
||||
Option<domain::MerchantConnectorAccount>,
|
||||
&'static (dyn api::Connector + Sync),
|
||||
ConnectorEnum,
|
||||
String,
|
||||
),
|
||||
errors::ApiErrorResponse,
|
||||
|
||||
Reference in New Issue
Block a user