feat(connector): add payouts integration for AdyenPlatform (#4874)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Kashif
2024-06-05 17:12:50 +05:30
committed by GitHub
parent 7ab65ac883
commit 32cf06c736
47 changed files with 896 additions and 51 deletions

View File

@ -44,6 +44,7 @@ pub enum RoutingAlgorithm {
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum Connector {
Adyenplatform,
#[cfg(feature = "dummy_connector")]
#[serde(rename = "phonypay")]
#[strum(serialize = "phonypay")]
@ -142,7 +143,7 @@ impl Connector {
pub fn supports_instant_payout(&self, payout_method: PayoutType) -> bool {
matches!(
(self, payout_method),
(Self::Paypal, PayoutType::Wallet) | (_, PayoutType::Card)
(Self::Paypal, PayoutType::Wallet) | (_, PayoutType::Card) | (Self::Adyenplatform, _)
)
}
#[cfg(feature = "payouts")]
@ -191,6 +192,7 @@ impl Connector {
| Self::DummyConnector7 => false,
Self::Aci
| Self::Adyen
| Self::Adyenplatform
| Self::Airwallex
| Self::Authorizedotnet
| Self::Bambora
@ -302,11 +304,12 @@ impl AuthenticationConnectors {
#[strum(serialize_all = "snake_case")]
pub enum PayoutConnectors {
Adyen,
Stripe,
Adyenplatform,
Cybersource,
Ebanx,
Payone,
Paypal,
Ebanx,
Cybersource,
Stripe,
Wise,
}
@ -315,11 +318,12 @@ impl From<PayoutConnectors> for RoutableConnectors {
fn from(value: PayoutConnectors) -> Self {
match value {
PayoutConnectors::Adyen => Self::Adyen,
PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Adyenplatform => Self::Adyenplatform,
PayoutConnectors::Cybersource => Self::Cybersource,
PayoutConnectors::Ebanx => Self::Ebanx,
PayoutConnectors::Payone => Self::Payone,
PayoutConnectors::Paypal => Self::Paypal,
PayoutConnectors::Ebanx => Self::Ebanx,
PayoutConnectors::Cybersource => Self::Cybersource,
PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Wise => Self::Wise,
}
}
@ -330,11 +334,12 @@ impl From<PayoutConnectors> for Connector {
fn from(value: PayoutConnectors) -> Self {
match value {
PayoutConnectors::Adyen => Self::Adyen,
PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Adyenplatform => Self::Adyenplatform,
PayoutConnectors::Cybersource => Self::Cybersource,
PayoutConnectors::Ebanx => Self::Ebanx,
PayoutConnectors::Payone => Self::Payone,
PayoutConnectors::Paypal => Self::Paypal,
PayoutConnectors::Ebanx => Self::Ebanx,
PayoutConnectors::Cybersource => Self::Cybersource,
PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Wise => Self::Wise,
}
}
@ -346,12 +351,13 @@ impl TryFrom<Connector> for PayoutConnectors {
fn try_from(value: Connector) -> Result<Self, Self::Error> {
match value {
Connector::Adyen => Ok(Self::Adyen),
Connector::Adyenplatform => Ok(Self::Adyenplatform),
Connector::Cybersource => Ok(Self::Cybersource),
Connector::Ebanx => Ok(Self::Ebanx),
Connector::Payone => Ok(Self::Payone),
Connector::Paypal => Ok(Self::Paypal),
Connector::Stripe => Ok(Self::Stripe),
Connector::Wise => Ok(Self::Wise),
Connector::Paypal => Ok(Self::Paypal),
Connector::Ebanx => Ok(Self::Ebanx),
Connector::Cybersource => Ok(Self::Cybersource),
Connector::Payone => Ok(Self::Payone),
_ => Err(format!("Invalid payout connector {}", value)),
}
}

View File

@ -148,6 +148,10 @@ pub struct PayoutCreateRequest {
/// The business profile to use for this payment, if not passed the default business profile
/// associated with the merchant account will be used.
pub profile_id: Option<String>,
/// The send method for processing payouts
#[schema(value_type = PayoutSendPriority, example = "instant")]
pub priority: Option<api_enums::PayoutSendPriority>,
}
#[derive(Debug, Clone, Deserialize, Serialize, ToSchema)]
@ -441,6 +445,14 @@ pub struct PayoutCreateResponse {
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub created: Option<PrimitiveDateTime>,
/// Underlying processor's payout resource ID
#[schema(value_type = Option<String>, example = "S3FC9G9M2MVFDXT5")]
pub connector_transaction_id: Option<String>,
/// Payout's send priority (if applicable)
#[schema(value_type = Option<PayoutSendPriority>, example = "instant")]
pub priority: Option<api_enums::PayoutSendPriority>,
/// List of attempts
#[schema(value_type = Option<Vec<PayoutAttemptResponse>>)]
#[serde(skip_serializing_if = "Option::is_none")]