feat(core): [Payouts] Add access_token flow for Payout Create and Fulfill flow (#4375)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sakil Mostak
2024-04-25 12:02:42 +05:30
committed by GitHub
parent 2dd0ee68bf
commit 7f0d04fe37
6 changed files with 420 additions and 87 deletions

View File

@ -135,6 +135,25 @@ pub enum Connector {
}
impl Connector {
#[cfg(feature = "payouts")]
pub fn supports_instant_payout(&self, payout_method: PayoutType) -> bool {
matches!(
(self, payout_method),
(Self::Paypal, PayoutType::Wallet) | (_, PayoutType::Card)
)
}
#[cfg(feature = "payouts")]
pub fn supports_create_recipient(&self, payout_method: PayoutType) -> bool {
matches!((self, payout_method), (_, PayoutType::Bank))
}
#[cfg(feature = "payouts")]
pub fn supports_payout_eligibility(&self, payout_method: PayoutType) -> bool {
matches!((self, payout_method), (_, PayoutType::Card))
}
#[cfg(feature = "payouts")]
pub fn supports_access_token_for_payout(&self, payout_method: PayoutType) -> bool {
matches!((self, payout_method), (Self::Paypal, _))
}
pub fn supports_access_token(&self, payment_method: PaymentMethod) -> bool {
matches!(
(self, payment_method),
@ -320,6 +339,7 @@ pub enum AuthenticationConnectors {
pub enum PayoutConnectors {
Adyen,
Wise,
Paypal,
}
#[cfg(feature = "payouts")]
@ -328,6 +348,7 @@ impl From<PayoutConnectors> for RoutableConnectors {
match value {
PayoutConnectors::Adyen => Self::Adyen,
PayoutConnectors::Wise => Self::Wise,
PayoutConnectors::Paypal => Self::Paypal,
}
}
}
@ -338,6 +359,7 @@ impl From<PayoutConnectors> for Connector {
match value {
PayoutConnectors::Adyen => Self::Adyen,
PayoutConnectors::Wise => Self::Wise,
PayoutConnectors::Paypal => Self::Paypal,
}
}
}
@ -349,6 +371,7 @@ impl TryFrom<Connector> for PayoutConnectors {
match value {
Connector::Adyen => Ok(Self::Adyen),
Connector::Wise => Ok(Self::Wise),
Connector::Paypal => Ok(Self::Paypal),
_ => Err(format!("Invalid payout connector {}", value)),
}
}