refactor: move Payout traits to hyperswitch_interfaces for connectors crate (#6481)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Kashif
2024-11-12 16:23:00 +05:30
committed by GitHub
parent 20a3a1c2d6
commit 6808272de3
7 changed files with 107 additions and 72 deletions

View File

@ -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
{
}

View File

@ -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 {}