Bug: [FEATURE] Add support for payout connector integrations for connectors crate



### Feature Description

To be able to support connector integrations in router and the new hyperswitch_connectors crate.

### Possible Implementation

Move payout API traits to a common place - in hyperswitch_interfaces crate.

### Have you spent some time checking if this feature request has been raised before?

- [X] I checked and didn't find a similar issue

### Have you read the Contributing Guidelines?

- [X] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)

### Are you willing to submit a PR?

Yes, I am willing to submit a PR!
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 418d58eb54b..81c079d5d52 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -1049,6 +1049,56 @@ default_imp_for_file_upload!(
     connectors::Zsl
 );
 
+macro_rules! default_imp_for_payouts {
+    ($($path:ident::$connector:ident),*) => {
+        $(
+            impl api::Payouts for $path::$connector {}
+    )*
+    };
+}
+
+default_imp_for_payouts!(
+    connectors::Airwallex,
+    connectors::Amazonpay,
+    connectors::Bambora,
+    connectors::Billwerk,
+    connectors::Bitpay,
+    connectors::Cashtocode,
+    connectors::Cryptopay,
+    connectors::Coinbase,
+    connectors::Deutschebank,
+    connectors::Digitalvirgo,
+    connectors::Dlocal,
+    connectors::Elavon,
+    connectors::Fiserv,
+    connectors::Fiservemea,
+    connectors::Fiuu,
+    connectors::Forte,
+    connectors::Globepay,
+    connectors::Helcim,
+    connectors::Jpmorgan,
+    connectors::Mollie,
+    connectors::Multisafepay,
+    connectors::Nexinets,
+    connectors::Nexixpay,
+    connectors::Nomupay,
+    connectors::Novalnet,
+    connectors::Payeezy,
+    connectors::Payu,
+    connectors::Powertranz,
+    connectors::Razorpay,
+    connectors::Shift4,
+    connectors::Square,
+    connectors::Stax,
+    connectors::Taxjar,
+    connectors::Tsys,
+    connectors::Volt,
+    connectors::Worldline,
+    connectors::Worldpay,
+    connectors::Zen,
+    connectors::Zsl
+);
+
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_payouts_create {
     ($($path:ident::$connector:ident),*) => {
diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rs
index 7205865f24a..0ea8996cb4c 100644
--- a/crates/hyperswitch_interfaces/src/api.rs
+++ b/crates/hyperswitch_interfaces/src/api.rs
@@ -38,6 +38,8 @@ use masking::Maskable;
 use router_env::metrics::add_attributes;
 use serde_json::json;
 
+#[cfg(feature = "payouts")]
+pub use self::payouts::*;
 pub use self::{payments::*, refunds::*};
 use crate::{
     configs::Connectors, connector_integration_v2::ConnectorIntegrationV2, consts, errors,
@@ -410,3 +412,7 @@ pub trait ConnectorRedirectResponse {
         Ok(CallConnectorAction::Avoid)
     }
 }
+
+/// Empty trait for when payouts feature is disabled
+#[cfg(not(feature = "payouts"))]
+pub trait Payouts {}
diff --git a/crates/hyperswitch_interfaces/src/api/payouts.rs b/crates/hyperswitch_interfaces/src/api/payouts.rs
index 894f636707a..5fc0280f19c 100644
--- a/crates/hyperswitch_interfaces/src/api/payouts.rs
+++ b/crates/hyperswitch_interfaces/src/api/payouts.rs
@@ -1,13 +1,15 @@
 //! Payouts interface
 
-use hyperswitch_domain_models::router_flow_types::payouts::{
-    PoCancel, PoCreate, PoEligibility, PoFulfill, PoQuote, PoRecipient, PoRecipientAccount, PoSync,
-};
-#[cfg(feature = "payouts")]
 use hyperswitch_domain_models::{
-    router_request_types::PayoutsData, router_response_types::PayoutsResponseData,
+    router_flow_types::payouts::{
+        PoCancel, PoCreate, PoEligibility, PoFulfill, PoQuote, PoRecipient, PoRecipientAccount,
+        PoSync,
+    },
+    router_request_types::PayoutsData,
+    router_response_types::PayoutsResponseData,
 };
 
+use super::ConnectorCommon;
 use crate::api::ConnectorIntegration;
 
 /// trait PayoutCancel
@@ -42,3 +44,17 @@ pub trait PayoutRecipientAccount:
 
 /// trait PayoutSync
 pub trait PayoutSync: ConnectorIntegration<PoSync, PayoutsData, PayoutsResponseData> {}
+
+/// trait Payouts
+pub trait Payouts:
+    ConnectorCommon
+    + PayoutCancel
+    + PayoutCreate
+    + PayoutEligibility
+    + PayoutFulfill
+    + PayoutQuote
+    + PayoutRecipient
+    + PayoutRecipientAccount
+    + PayoutSync
+{
+}
diff --git a/crates/hyperswitch_interfaces/src/api/payouts_v2.rs b/crates/hyperswitch_interfaces/src/api/payouts_v2.rs
index 40e0726ce80..9027152f02d 100644
--- a/crates/hyperswitch_interfaces/src/api/payouts_v2.rs
+++ b/crates/hyperswitch_interfaces/src/api/payouts_v2.rs
@@ -1,13 +1,15 @@
 //! Payouts V2 interface
-use hyperswitch_domain_models::router_flow_types::payouts::{
-    PoCancel, PoCreate, PoEligibility, PoFulfill, PoQuote, PoRecipient, PoRecipientAccount, PoSync,
-};
-#[cfg(feature = "payouts")]
 use hyperswitch_domain_models::{
-    router_data_v2::flow_common_types::PayoutFlowData, router_request_types::PayoutsData,
+    router_data_v2::flow_common_types::PayoutFlowData,
+    router_flow_types::payouts::{
+        PoCancel, PoCreate, PoEligibility, PoFulfill, PoQuote, PoRecipient, PoRecipientAccount,
+        PoSync,
+    },
+    router_request_types::PayoutsData,
     router_response_types::PayoutsResponseData,
 };
 
+use super::ConnectorCommon;
 use crate::api::ConnectorIntegrationV2;
 
 /// trait PayoutCancelV2
@@ -57,3 +59,21 @@ pub trait PayoutSyncV2:
     ConnectorIntegrationV2<PoSync, PayoutFlowData, PayoutsData, PayoutsResponseData>
 {
 }
+
+/// trait Payouts
+pub trait PayoutsV2:
+    ConnectorCommon
+    + PayoutCancelV2
+    + PayoutCreateV2
+    + PayoutEligibilityV2
+    + PayoutFulfillV2
+    + PayoutQuoteV2
+    + PayoutRecipientV2
+    + PayoutRecipientAccountV2
+    + PayoutSyncV2
+{
+}
+
+/// Empty trait for when payouts feature is disabled
+#[cfg(not(feature = "payouts"))]
+pub trait PayoutsV2 {}
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index a6894502996..1358bcedba1 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -12,6 +12,7 @@ pub mod session_update_flow;
 pub mod setup_mandate_flow;
 
 use async_trait::async_trait;
+use hyperswitch_interfaces::api::payouts::Payouts;
 
 #[cfg(feature = "frm")]
 use crate::types::fraud_check as frm_types;
@@ -969,88 +970,49 @@ default_imp_for_post_processing_steps!(
 macro_rules! default_imp_for_payouts {
     ($($path:ident::$connector:ident),*) => {
         $(
-            impl api::Payouts for $path::$connector {}
+            impl Payouts for $path::$connector {}
     )*
     };
 }
 
 #[cfg(feature = "dummy_connector")]
-impl<const T: u8> api::Payouts for connector::DummyConnector<T> {}
+impl<const T: u8> Payouts for connector::DummyConnector<T> {}
 
 default_imp_for_payouts!(
     connector::Aci,
-    connector::Airwallex,
-    connector::Amazonpay,
     connector::Authorizedotnet,
-    connector::Bambora,
     connector::Bamboraapac,
     connector::Bankofamerica,
-    connector::Billwerk,
-    connector::Bitpay,
     connector::Bluesnap,
     connector::Boku,
     connector::Braintree,
-    connector::Cashtocode,
     connector::Checkout,
-    connector::Cryptopay,
-    connector::Coinbase,
     connector::Datatrans,
-    connector::Deutschebank,
-    connector::Digitalvirgo,
-    connector::Dlocal,
-    connector::Elavon,
-    connector::Fiserv,
-    connector::Fiservemea,
-    connector::Fiuu,
-    connector::Forte,
     connector::Globalpay,
-    connector::Globepay,
     connector::Gocardless,
     connector::Gpayments,
-    connector::Helcim,
     connector::Iatapay,
     connector::Itaubank,
-    connector::Jpmorgan,
     connector::Klarna,
     connector::Mifinity,
-    connector::Mollie,
-    connector::Multisafepay,
     connector::Netcetera,
-    connector::Nexinets,
-    connector::Nexixpay,
     connector::Nmi,
-    connector::Nomupay,
     connector::Noon,
-    connector::Novalnet,
     connector::Nuvei,
     connector::Opayo,
     connector::Opennode,
     connector::Paybox,
-    connector::Payeezy,
     connector::Payme,
-    connector::Payu,
     connector::Placetopay,
     connector::Plaid,
-    connector::Powertranz,
     connector::Prophetpay,
     connector::Rapyd,
-    connector::Razorpay,
     connector::Riskified,
-    connector::Shift4,
     connector::Signifyd,
-    connector::Square,
-    connector::Stax,
-    connector::Taxjar,
     connector::Threedsecureio,
     connector::Trustpay,
-    connector::Tsys,
-    connector::Volt,
     connector::Wellsfargo,
-    connector::Wellsfargopayout,
-    connector::Worldline,
-    connector::Worldpay,
-    connector::Zen,
-    connector::Zsl
+    connector::Wellsfargopayout
 );
 
 #[cfg(feature = "payouts")]
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index e3c311710d5..985a6644524 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -568,25 +568,6 @@ pub trait FraudCheck {}
 #[cfg(not(feature = "frm"))]
 pub trait FraudCheckV2 {}
 
-#[cfg(feature = "payouts")]
-pub trait Payouts:
-    ConnectorCommon
-    + PayoutCancel
-    + PayoutCreate
-    + PayoutEligibility
-    + PayoutFulfill
-    + PayoutQuote
-    + PayoutRecipient
-    + PayoutRecipientAccount
-    + PayoutSync
-{
-}
-#[cfg(not(feature = "payouts"))]
-pub trait Payouts {}
-
-#[cfg(not(feature = "payouts"))]
-pub trait PayoutsV2 {}
-
 #[cfg(test)]
 mod test {
     #![allow(clippy::unwrap_used)]
diff --git a/crates/router/src/types/api/payouts.rs b/crates/router/src/types/api/payouts.rs
index a9630beb25a..b5a6ac24ca9 100644
--- a/crates/router/src/types/api/payouts.rs
+++ b/crates/router/src/types/api/payouts.rs
@@ -11,7 +11,7 @@ pub use hyperswitch_domain_models::router_flow_types::payouts::{
 };
 pub use hyperswitch_interfaces::api::payouts::{
     PayoutCancel, PayoutCreate, PayoutEligibility, PayoutFulfill, PayoutQuote, PayoutRecipient,
-    PayoutRecipientAccount, PayoutSync,
+    PayoutRecipientAccount, PayoutSync, Payouts,
 };
 
 pub use super::payouts_v2::{

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
Described in #6508

### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
This helps us implement new payout connector integrations in `hyperswitch_connectors` crate


## How did you test it?
Not needed as it's only a refactor. New connectors being added in `hyperswitch_connectors` crate can be tested


## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
