Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ hash_key = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://checkout-test.adyen.com/"
adyen.secondary_base_url = "https://pal-test.adyen.com/"
adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
Expand Down Expand Up @@ -268,6 +269,7 @@ wallets = ["klarna",
rewards = ["cashtocode", "zen"]
cards = [
"adyen",
"adyenplatform",
"authorizedotnet",
"coinbase",
"cryptopay",
Expand Down
1 change: 1 addition & 0 deletions config/deployments/integration_test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ przelewy24.stripe.banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_peka
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://checkout-test.adyen.com/"
adyen.secondary_base_url = "https://pal-test.adyen.com/"
adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
Expand Down
1 change: 1 addition & 0 deletions config/deployments/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ payout_connector_list = "stripe,wise"
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://{{merchant_endpoint_prefix}}-checkout-live.adyenpayments.com/checkout/"
adyen.secondary_base_url = "https://{{merchant_endpoint_prefix}}-pal-live.adyenpayments.com/"
adyenplatform.base_url = "https://balanceplatform-api-live.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://api.authorize.net/xml/v1/request.api"
Expand Down
1 change: 1 addition & 0 deletions config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ payout_connector_list = "stripe,wise"
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://checkout-test.adyen.com/"
adyen.secondary_base_url = "https://pal-test.adyen.com/"
adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
Expand Down
2 changes: 2 additions & 0 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ rewards = ["cashtocode", "zen"]
cards = [
"aci",
"adyen",
"adyenplatform",
"airwallex",
"authorizedotnet",
"bambora",
Expand Down Expand Up @@ -167,6 +168,7 @@ hash_key = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
[connectors]
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://checkout-test.adyen.com/"
adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/"
adyen.secondary_base_url = "https://pal-test.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
Expand Down
2 changes: 2 additions & 0 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ hash_key = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
[connectors]
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://checkout-test.adyen.com/"
adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/"
adyen.secondary_base_url = "https://pal-test.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
Expand Down Expand Up @@ -186,6 +187,7 @@ rewards = ["cashtocode", "zen"]
cards = [
"aci",
"adyen",
"adyenplatform",
"airwallex",
"authorizedotnet",
"bambora",
Expand Down
34 changes: 20 additions & 14 deletions crates/api_models/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -191,6 +192,7 @@ impl Connector {
| Self::DummyConnector7 => false,
Self::Aci
| Self::Adyen
| Self::Adyenplatform
| Self::Airwallex
| Self::Authorizedotnet
| Self::Bambora
Expand Down Expand Up @@ -299,11 +301,12 @@ impl AuthenticationConnectors {
#[strum(serialize_all = "snake_case")]
pub enum PayoutConnectors {
Adyen,
Stripe,
Adyenplatform,
Cybersource,
Ebanx,
Payone,
Paypal,
Ebanx,
Cybersource,
Stripe,
Wise,
}

Expand All @@ -312,11 +315,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,
}
}
Expand All @@ -327,11 +331,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,
}
}
Expand All @@ -343,12 +348,13 @@ impl TryFrom<Connector> for PayoutConnectors {
fn try_from(value: Connector) -> Result<Self, Self::Error> {
match value {
Connector::Adyen => Ok(Self::Adyen),
Connector::Stripe => Ok(Self::Stripe),
Connector::Wise => Ok(Self::Wise),
Connector::Paypal => Ok(Self::Paypal),
Connector::Ebanx => Ok(Self::Ebanx),
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),
_ => Err(format!("Invalid payout connector {}", value)),
}
}
Expand Down
12 changes: 12 additions & 0 deletions crates/api_models/src/payouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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")]
Expand Down
26 changes: 26 additions & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pub enum AttemptStatus {
#[strum(serialize_all = "snake_case")]
/// Connectors eligible for payments routing
pub enum RoutableConnectors {
Adyenplatform,
#[cfg(feature = "dummy_connector")]
#[serde(rename = "phonypay")]
#[strum(serialize = "phonypay")]
Expand Down Expand Up @@ -2184,6 +2185,31 @@ pub enum PayoutEntityType {
Personal,
}

#[derive(
Clone,
Copy,
Debug,
Eq,
Hash,
PartialEq,
serde::Deserialize,
serde::Serialize,
strum::Display,
strum::EnumString,
ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "text")]
#[serde(rename_all = "camelCase")]
#[strum(serialize_all = "camelCase")]
pub enum PayoutSendPriority {
Instant,
Fast,
Regular,
Wire,
CrossBorder,
Internal,
}

#[derive(
Clone,
Copy,
Expand Down
2 changes: 2 additions & 0 deletions crates/connector_configs/src/common_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ pub struct ApiModelMetaData {
pub three_ds_requestor_id: Option<String>,
pub pull_mechanism_for_external_3ds_enabled: Option<bool>,
pub klarna_region: Option<KlarnaEndpoint>,
pub source_balance_account: Option<String>,
}

#[serde_with::skip_serializing_none]
Expand Down Expand Up @@ -210,4 +211,5 @@ pub struct DashboardMetaData {
pub three_ds_requestor_id: Option<String>,
pub pull_mechanism_for_external_3ds_enabled: Option<bool>,
pub klarna_region: Option<KlarnaEndpoint>,
pub source_balance_account: Option<String>,
}
13 changes: 9 additions & 4 deletions crates/connector_configs/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pub struct ConfigMetadata {
pub three_ds_requestor_id: Option<String>,
pub pull_mechanism_for_external_3ds_enabled: Option<bool>,
pub klarna_region: Option<Vec<KlarnaEndpoint>>,
pub source_balance_account: Option<String>,
}

#[serde_with::skip_serializing_none]
Expand Down Expand Up @@ -131,6 +132,8 @@ pub struct ConnectorConfig {
pub adyen: Option<ConnectorTomlConfig>,
#[cfg(feature = "payouts")]
pub adyen_payout: Option<ConnectorTomlConfig>,
#[cfg(feature = "payouts")]
pub adyenplatform_payout: Option<ConnectorTomlConfig>,
pub airwallex: Option<ConnectorTomlConfig>,
pub authorizedotnet: Option<ConnectorTomlConfig>,
pub bankofamerica: Option<ConnectorTomlConfig>,
Expand Down Expand Up @@ -235,12 +238,13 @@ impl ConnectorConfig {
let connector_data = Self::new()?;
match connector {
PayoutConnectors::Adyen => Ok(connector_data.adyen_payout),
PayoutConnectors::Stripe => Ok(connector_data.stripe_payout),
PayoutConnectors::Wise => Ok(connector_data.wise_payout),
PayoutConnectors::Paypal => Ok(connector_data.paypal_payout),
PayoutConnectors::Ebanx => Ok(connector_data.ebanx_payout),
PayoutConnectors::Adyenplatform => Ok(connector_data.adyenplatform_payout),
PayoutConnectors::Cybersource => Ok(connector_data.cybersource_payout),
PayoutConnectors::Ebanx => Ok(connector_data.ebanx_payout),
PayoutConnectors::Payone => Ok(connector_data.payone_payout),
PayoutConnectors::Paypal => Ok(connector_data.paypal_payout),
PayoutConnectors::Stripe => Ok(connector_data.stripe_payout),
PayoutConnectors::Wise => Ok(connector_data.wise_payout),
}
}

Expand All @@ -262,6 +266,7 @@ impl ConnectorConfig {
match connector {
Connector::Aci => Ok(connector_data.aci),
Connector::Adyen => Ok(connector_data.adyen),
Connector::Adyenplatform => Err("Use get_payout_connector_config".to_string()),
Connector::Airwallex => Ok(connector_data.airwallex),
Connector::Authorizedotnet => Ok(connector_data.authorizedotnet),
Connector::Bankofamerica => Ok(connector_data.bankofamerica),
Expand Down
1 change: 1 addition & 0 deletions crates/connector_configs/src/response_modifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ impl From<ApiModelMetaData> for DashboardMetaData {
pull_mechanism_for_external_3ds_enabled: api_model
.pull_mechanism_for_external_3ds_enabled,
klarna_region: api_model.klarna_region,
source_balance_account: api_model.source_balance_account,
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/connector_configs/src/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ impl DashboardRequestPayload {
pull_mechanism_for_external_3ds_enabled: None,
paypal_sdk: None,
klarna_region: None,
source_balance_account: None,
};
let meta_data = match request.metadata {
Some(data) => data,
Expand All @@ -223,6 +224,7 @@ impl DashboardRequestPayload {
let pull_mechanism_for_external_3ds_enabled =
meta_data.pull_mechanism_for_external_3ds_enabled;
let klarna_region = meta_data.klarna_region;
let source_balance_account = meta_data.source_balance_account;

Some(ApiModelMetaData {
google_pay,
Expand All @@ -244,6 +246,7 @@ impl DashboardRequestPayload {
three_ds_requestor_id,
pull_mechanism_for_external_3ds_enabled,
klarna_region,
source_balance_account,
})
}

Expand Down
8 changes: 8 additions & 0 deletions crates/connector_configs/toml/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ supported_networks=["visa","masterCard","amex","discover"]
merchant_capabilities=["supports3DS"]
label="apple"

[adyenplatform_payout]
[[adyenplatform_payout.bank_transfer]]
payment_method_type = "sepa"
[adyenplatform_payout.metadata]
source_balance_account="Source balance account ID"
[adyenplatform_payout.connector_auth.HeaderKey]
api_key="Adyen platform's API Key"

[airwallex]
[[airwallex.credit]]
payment_method_type = "Mastercard"
Expand Down
8 changes: 8 additions & 0 deletions crates/connector_configs/toml/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ supported_networks=["visa","masterCard","amex","discover"]
merchant_capabilities=["supports3DS"]
label="apple"

[adyenplatform_payout]
[[adyenplatform_payout.bank_transfer]]
payment_method_type = "sepa"
[adyenplatform_payout.metadata]
source_balance_account = "Source balance account ID"
[adyenplatform_payout.connector_auth.HeaderKey]
api_key = "Adyen platform's API Key"

[airwallex]
[[airwallex.credit]]
payment_method_type = "Mastercard"
Expand Down
2 changes: 2 additions & 0 deletions crates/diesel_models/src/payouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct Payouts {
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
pub priority: Option<storage_enums::PayoutSendPriority>,
}

#[derive(
Expand Down Expand Up @@ -71,6 +72,7 @@ pub struct PayoutsNew {
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
pub priority: Option<storage_enums::PayoutSendPriority>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
2 changes: 2 additions & 0 deletions crates/diesel_models/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,8 @@ diesel::table! {
profile_id -> Varchar,
status -> PayoutStatus,
confirm -> Nullable<Bool>,
#[max_length = 32]
priority -> Nullable<Varchar>,
}
}

Expand Down
3 changes: 3 additions & 0 deletions crates/hyperswitch_domain_models/src/payouts/payouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ pub struct Payouts {
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
pub priority: Option<storage_enums::PayoutSendPriority>,
}

#[derive(Clone, Debug, Eq, PartialEq)]
Expand All @@ -115,6 +116,7 @@ pub struct PayoutsNew {
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
pub priority: Option<storage_enums::PayoutSendPriority>,
}

impl Default for PayoutsNew {
Expand Down Expand Up @@ -143,6 +145,7 @@ impl Default for PayoutsNew {
profile_id: String::default(),
status: storage_enums::PayoutStatus::default(),
confirm: None,
priority: None,
}
}
}
Expand Down
Loading