mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 05:17:02 +08:00
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:
@ -1049,6 +1049,56 @@ default_imp_for_file_upload!(
|
|||||||
connectors::Zsl
|
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")]
|
#[cfg(feature = "payouts")]
|
||||||
macro_rules! default_imp_for_payouts_create {
|
macro_rules! default_imp_for_payouts_create {
|
||||||
($($path:ident::$connector:ident),*) => {
|
($($path:ident::$connector:ident),*) => {
|
||||||
|
|||||||
@ -38,6 +38,8 @@ use masking::Maskable;
|
|||||||
use router_env::metrics::add_attributes;
|
use router_env::metrics::add_attributes;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
|
#[cfg(feature = "payouts")]
|
||||||
|
pub use self::payouts::*;
|
||||||
pub use self::{payments::*, refunds::*};
|
pub use self::{payments::*, refunds::*};
|
||||||
use crate::{
|
use crate::{
|
||||||
configs::Connectors, connector_integration_v2::ConnectorIntegrationV2, consts, errors,
|
configs::Connectors, connector_integration_v2::ConnectorIntegrationV2, consts, errors,
|
||||||
@ -410,3 +412,7 @@ pub trait ConnectorRedirectResponse {
|
|||||||
Ok(CallConnectorAction::Avoid)
|
Ok(CallConnectorAction::Avoid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Empty trait for when payouts feature is disabled
|
||||||
|
#[cfg(not(feature = "payouts"))]
|
||||||
|
pub trait Payouts {}
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
//! Payouts interface
|
//! 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::{
|
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;
|
use crate::api::ConnectorIntegration;
|
||||||
|
|
||||||
/// trait PayoutCancel
|
/// trait PayoutCancel
|
||||||
@ -42,3 +44,17 @@ pub trait PayoutRecipientAccount:
|
|||||||
|
|
||||||
/// trait PayoutSync
|
/// trait PayoutSync
|
||||||
pub trait PayoutSync: ConnectorIntegration<PoSync, PayoutsData, PayoutsResponseData> {}
|
pub trait PayoutSync: ConnectorIntegration<PoSync, PayoutsData, PayoutsResponseData> {}
|
||||||
|
|
||||||
|
/// trait Payouts
|
||||||
|
pub trait Payouts:
|
||||||
|
ConnectorCommon
|
||||||
|
+ PayoutCancel
|
||||||
|
+ PayoutCreate
|
||||||
|
+ PayoutEligibility
|
||||||
|
+ PayoutFulfill
|
||||||
|
+ PayoutQuote
|
||||||
|
+ PayoutRecipient
|
||||||
|
+ PayoutRecipientAccount
|
||||||
|
+ PayoutSync
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
//! Payouts V2 interface
|
//! 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::{
|
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,
|
router_response_types::PayoutsResponseData,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use super::ConnectorCommon;
|
||||||
use crate::api::ConnectorIntegrationV2;
|
use crate::api::ConnectorIntegrationV2;
|
||||||
|
|
||||||
/// trait PayoutCancelV2
|
/// trait PayoutCancelV2
|
||||||
@ -57,3 +59,21 @@ pub trait PayoutSyncV2:
|
|||||||
ConnectorIntegrationV2<PoSync, PayoutFlowData, PayoutsData, PayoutsResponseData>
|
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 {}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ pub mod session_update_flow;
|
|||||||
pub mod setup_mandate_flow;
|
pub mod setup_mandate_flow;
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
use hyperswitch_interfaces::api::payouts::Payouts;
|
||||||
|
|
||||||
#[cfg(feature = "frm")]
|
#[cfg(feature = "frm")]
|
||||||
use crate::types::fraud_check as frm_types;
|
use crate::types::fraud_check as frm_types;
|
||||||
@ -969,88 +970,49 @@ default_imp_for_post_processing_steps!(
|
|||||||
macro_rules! default_imp_for_payouts {
|
macro_rules! default_imp_for_payouts {
|
||||||
($($path:ident::$connector:ident),*) => {
|
($($path:ident::$connector:ident),*) => {
|
||||||
$(
|
$(
|
||||||
impl api::Payouts for $path::$connector {}
|
impl Payouts for $path::$connector {}
|
||||||
)*
|
)*
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "dummy_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!(
|
default_imp_for_payouts!(
|
||||||
connector::Aci,
|
connector::Aci,
|
||||||
connector::Airwallex,
|
|
||||||
connector::Amazonpay,
|
|
||||||
connector::Authorizedotnet,
|
connector::Authorizedotnet,
|
||||||
connector::Bambora,
|
|
||||||
connector::Bamboraapac,
|
connector::Bamboraapac,
|
||||||
connector::Bankofamerica,
|
connector::Bankofamerica,
|
||||||
connector::Billwerk,
|
|
||||||
connector::Bitpay,
|
|
||||||
connector::Bluesnap,
|
connector::Bluesnap,
|
||||||
connector::Boku,
|
connector::Boku,
|
||||||
connector::Braintree,
|
connector::Braintree,
|
||||||
connector::Cashtocode,
|
|
||||||
connector::Checkout,
|
connector::Checkout,
|
||||||
connector::Cryptopay,
|
|
||||||
connector::Coinbase,
|
|
||||||
connector::Datatrans,
|
connector::Datatrans,
|
||||||
connector::Deutschebank,
|
|
||||||
connector::Digitalvirgo,
|
|
||||||
connector::Dlocal,
|
|
||||||
connector::Elavon,
|
|
||||||
connector::Fiserv,
|
|
||||||
connector::Fiservemea,
|
|
||||||
connector::Fiuu,
|
|
||||||
connector::Forte,
|
|
||||||
connector::Globalpay,
|
connector::Globalpay,
|
||||||
connector::Globepay,
|
|
||||||
connector::Gocardless,
|
connector::Gocardless,
|
||||||
connector::Gpayments,
|
connector::Gpayments,
|
||||||
connector::Helcim,
|
|
||||||
connector::Iatapay,
|
connector::Iatapay,
|
||||||
connector::Itaubank,
|
connector::Itaubank,
|
||||||
connector::Jpmorgan,
|
|
||||||
connector::Klarna,
|
connector::Klarna,
|
||||||
connector::Mifinity,
|
connector::Mifinity,
|
||||||
connector::Mollie,
|
|
||||||
connector::Multisafepay,
|
|
||||||
connector::Netcetera,
|
connector::Netcetera,
|
||||||
connector::Nexinets,
|
|
||||||
connector::Nexixpay,
|
|
||||||
connector::Nmi,
|
connector::Nmi,
|
||||||
connector::Nomupay,
|
|
||||||
connector::Noon,
|
connector::Noon,
|
||||||
connector::Novalnet,
|
|
||||||
connector::Nuvei,
|
connector::Nuvei,
|
||||||
connector::Opayo,
|
connector::Opayo,
|
||||||
connector::Opennode,
|
connector::Opennode,
|
||||||
connector::Paybox,
|
connector::Paybox,
|
||||||
connector::Payeezy,
|
|
||||||
connector::Payme,
|
connector::Payme,
|
||||||
connector::Payu,
|
|
||||||
connector::Placetopay,
|
connector::Placetopay,
|
||||||
connector::Plaid,
|
connector::Plaid,
|
||||||
connector::Powertranz,
|
|
||||||
connector::Prophetpay,
|
connector::Prophetpay,
|
||||||
connector::Rapyd,
|
connector::Rapyd,
|
||||||
connector::Razorpay,
|
|
||||||
connector::Riskified,
|
connector::Riskified,
|
||||||
connector::Shift4,
|
|
||||||
connector::Signifyd,
|
connector::Signifyd,
|
||||||
connector::Square,
|
|
||||||
connector::Stax,
|
|
||||||
connector::Taxjar,
|
|
||||||
connector::Threedsecureio,
|
connector::Threedsecureio,
|
||||||
connector::Trustpay,
|
connector::Trustpay,
|
||||||
connector::Tsys,
|
|
||||||
connector::Volt,
|
|
||||||
connector::Wellsfargo,
|
connector::Wellsfargo,
|
||||||
connector::Wellsfargopayout,
|
connector::Wellsfargopayout
|
||||||
connector::Worldline,
|
|
||||||
connector::Worldpay,
|
|
||||||
connector::Zen,
|
|
||||||
connector::Zsl
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(feature = "payouts")]
|
#[cfg(feature = "payouts")]
|
||||||
|
|||||||
@ -568,25 +568,6 @@ pub trait FraudCheck {}
|
|||||||
#[cfg(not(feature = "frm"))]
|
#[cfg(not(feature = "frm"))]
|
||||||
pub trait FraudCheckV2 {}
|
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)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|||||||
@ -11,7 +11,7 @@ pub use hyperswitch_domain_models::router_flow_types::payouts::{
|
|||||||
};
|
};
|
||||||
pub use hyperswitch_interfaces::api::payouts::{
|
pub use hyperswitch_interfaces::api::payouts::{
|
||||||
PayoutCancel, PayoutCreate, PayoutEligibility, PayoutFulfill, PayoutQuote, PayoutRecipient,
|
PayoutCancel, PayoutCreate, PayoutEligibility, PayoutFulfill, PayoutQuote, PayoutRecipient,
|
||||||
PayoutRecipientAccount, PayoutSync,
|
PayoutRecipientAccount, PayoutSync, Payouts,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use super::payouts_v2::{
|
pub use super::payouts_v2::{
|
||||||
|
|||||||
Reference in New Issue
Block a user