Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
98f6725
refactor(payouts): remove redundant params from core payout functions
kashif-m Apr 5, 2024
e2664b3
chore(payouts): add missing migration scripts
kashif-m Apr 9, 2024
f83b2b4
feat(users): Implemented cookie parsing for auth (#4298)
racnan Apr 5, 2024
713c18a
fix(redis_interface): remove mget function from redis interface (#4303)
apoorvdixit88 Apr 5, 2024
f859b8e
refactor(payment_methods): add PayLater payment method data to new do…
swangi-kumari Apr 5, 2024
773a832
fix(mandates): store network transaction id only when `pg_agnostic` c…
ShankarSinghC Apr 5, 2024
f45ca06
chore(version): 2024.04.08.0
github-actions[bot] Apr 8, 2024
e0d4a14
feat(connector): [Ebanx] Template for ebanx payout (#4141)
Sakilmostak Apr 8, 2024
ddb7694
fix(psync): log the error if payment method retrieve fails in the `ps…
ShankarSinghC Apr 8, 2024
c9e55f0
refactor(payment_methods): add BankRedirect payment method data to ne…
swangi-kumari Apr 8, 2024
52066ad
feat(router): add local bank transfer payment method (#4294)
AkshayaFoiger Apr 8, 2024
3567c1b
feat(payouts): add support for vendor account creation
kashif-m Apr 10, 2024
71b8bdb
Merge remote-tracking branch 'origin/main'
kashif-m Apr 10, 2024
f0d5138
refactor(payouts): revert test changes
kashif-m Apr 10, 2024
63c6599
refactor(payouts): revert diff
kashif-m Apr 10, 2024
1117318
refactor(payouts): resolve comments
kashif-m Apr 10, 2024
3ed9f58
Merge remote-tracking branch 'origin/main' into payout_stripe_connect
kashif-m Apr 10, 2024
5f3c820
Merge remote-tracking branch 'origin/main' into payout_stripe_connect
kashif-m Apr 15, 2024
42cabfb
refactor: resolve comments
kashif-m Apr 16, 2024
18b2da8
refactor(payouts): revert tracing in handle_response for stripe conne…
kashif-m Apr 16, 2024
f811905
Merge remote-tracking branch 'origin/main' into payout_stripe_connect
kashif-m Apr 16, 2024
19e73fc
refactor(payouts): resolve comments
kashif-m Apr 22, 2024
838438f
refactor(payouts): resolve comments
kashif-m Apr 22, 2024
102337f
Merge remote-tracking branch 'origin/main' into payout_stripe_connect
kashif-m Apr 22, 2024
b2e81fa
chore(payouts): resolve after merging w latest main
kashif-m Apr 22, 2024
d9f898d
Merge remote-tracking branch 'origin/main' into payout_stripe_connect
kashif-m Apr 23, 2024
fda9959
refactor: resolve comments
kashif-m Apr 24, 2024
01d4e48
Merge remote-tracking branch 'origin/main' into payout_stripe_connect
kashif-m Apr 25, 2024
b866cfa
refactor(payouts): resolve comments
kashif-m Apr 26, 2024
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: 1 addition & 1 deletion config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ debit = { currency = "USD" }

[connector_customer]
connector_list = "gocardless,stax,stripe"
payout_connector_list = "wise"
payout_connector_list = "stripe,wise"

[bank_config.online_banking_fpx]
adyen.banks = "affin_bank,agro_bank,alliance_bank,am_bank,bank_islam,bank_muamalat,bank_rakyat,bank_simpanan_nasional,cimb_bank,hong_leong_bank,hsbc_bank,kuwait_finance_house,maybank,ocbc_bank,public_bank,rhb_bank,standard_chartered_bank,uob_bank"
Expand Down
2 changes: 1 addition & 1 deletion config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ payme = { payment_method = "card" }

[connector_customer]
connector_list = "gocardless,stax,stripe"
payout_connector_list = "wise"
payout_connector_list = "stripe,wise"

[dummy_connector]
enabled = true
Expand Down
2 changes: 1 addition & 1 deletion config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ connector_list = "stripe,adyen,cybersource"

[connector_customer]
connector_list = "gocardless,stax,stripe"
payout_connector_list = "wise"
payout_connector_list = "stripe,wise"

[multiple_api_version_supported_connectors]
supported_connectors = "braintree"
Expand Down
8 changes: 8 additions & 0 deletions crates/api_models/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ impl Connector {
pub fn supports_access_token_for_payout(&self, payout_method: PayoutType) -> bool {
matches!((self, payout_method), (Self::Paypal, _))
}
#[cfg(feature = "payouts")]
pub fn supports_vendor_disburse_account_create_for_payout(&self) -> bool {
matches!(self, Self::Stripe)
}
pub fn supports_access_token(&self, payment_method: PaymentMethod) -> bool {
matches!(
(self, payment_method),
Expand Down Expand Up @@ -338,6 +342,7 @@ pub enum AuthenticationConnectors {
#[strum(serialize_all = "snake_case")]
pub enum PayoutConnectors {
Adyen,
Stripe,
Wise,
Paypal,
}
Expand All @@ -347,6 +352,7 @@ impl From<PayoutConnectors> for RoutableConnectors {
fn from(value: PayoutConnectors) -> Self {
match value {
PayoutConnectors::Adyen => Self::Adyen,
PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Wise => Self::Wise,
PayoutConnectors::Paypal => Self::Paypal,
}
Expand All @@ -358,6 +364,7 @@ impl From<PayoutConnectors> for Connector {
fn from(value: PayoutConnectors) -> Self {
match value {
PayoutConnectors::Adyen => Self::Adyen,
PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Wise => Self::Wise,
PayoutConnectors::Paypal => Self::Paypal,
}
Expand All @@ -370,6 +377,7 @@ 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),
_ => Err(format!("Invalid payout connector {}", value)),
Expand Down
41 changes: 41 additions & 0 deletions crates/api_models/src/payouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ pub struct PayoutAttemptResponse {
#[derive(Default, Debug, Clone, Deserialize, ToSchema)]
pub struct PayoutRetrieveBody {
pub force_sync: Option<bool>,
pub merchant_id: Option<String>,
}

#[derive(Default, Debug, Serialize, ToSchema, Clone, Deserialize)]
Expand All @@ -464,6 +465,9 @@ pub struct PayoutRetrieveRequest {
/// (defaults to false)
#[schema(value_type = Option<bool>, default = false, example = true)]
pub force_sync: Option<bool>,

/// The identifier for the Merchant Account.
pub merchant_id: Option<String>,
}

#[derive(Default, Debug, Serialize, ToSchema, Clone, Deserialize)]
Expand All @@ -479,6 +483,43 @@ pub struct PayoutActionRequest {
pub payout_id: String,
}

#[derive(Default, Debug, ToSchema, Clone, Deserialize)]
pub struct PayoutVendorAccountDetails {
pub vendor_details: PayoutVendorDetails,
pub individual_details: PayoutIndividualDetails,
}

#[derive(Default, Debug, Serialize, ToSchema, Clone, Deserialize)]
pub struct PayoutVendorDetails {
pub account_type: String,
pub business_type: String,
pub business_profile_mcc: Option<i32>,
pub business_profile_url: Option<String>,
pub business_profile_name: Option<Secret<String>>,
pub company_address_line1: Option<Secret<String>>,
pub company_address_line2: Option<Secret<String>>,
pub company_address_postal_code: Option<Secret<String>>,
pub company_address_city: Option<Secret<String>>,
pub company_address_state: Option<Secret<String>>,
pub company_phone: Option<Secret<String>>,
pub company_tax_id: Option<Secret<String>>,
pub company_owners_provided: Option<bool>,
pub capabilities_card_payments: Option<bool>,
pub capabilities_transfers: Option<bool>,
}

#[derive(Default, Debug, Serialize, ToSchema, Clone, Deserialize)]
pub struct PayoutIndividualDetails {
pub tos_acceptance_date: Option<i64>,
pub tos_acceptance_ip: Option<Secret<String>>,
pub individual_dob_day: Option<Secret<String>>,
pub individual_dob_month: Option<Secret<String>>,
pub individual_dob_year: Option<Secret<String>>,
pub individual_id_number: Option<Secret<String>>,
pub individual_ssn_last_4: Option<Secret<String>>,
pub external_account_account_holder_type: Option<String>,
}

#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]
#[serde(deny_unknown_fields)]
pub struct PayoutListConstraints {
Expand Down
1 change: 1 addition & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,7 @@ pub enum PayoutStatus {
RequiresCreation,
RequiresPayoutMethodData,
RequiresFulfillment,
RequiresVendorAccountCreation,
}

#[derive(
Expand Down
3 changes: 3 additions & 0 deletions crates/common_utils/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ pub fn default_payments_list_limit() -> u32 {
10
}

/// Average delay (in seconds) between account onboarding's API response and the changes to actually reflect at Stripe's end
pub const STRIPE_ACCOUNT_ONBOARDING_DELAY_IN_SECONDS: i64 = 15;

/// Maximum limit for payment link list get api
pub const PAYMENTS_LINK_LIST_LIMIT: u32 = 100;

Expand Down
3 changes: 3 additions & 0 deletions crates/connector_configs/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ pub struct ConnectorConfig {
pub rapyd: Option<ConnectorTomlConfig>,
pub shift4: Option<ConnectorTomlConfig>,
pub stripe: Option<ConnectorTomlConfig>,
#[cfg(feature = "payouts")]
pub stripe_payout: Option<ConnectorTomlConfig>,
pub signifyd: Option<ConnectorTomlConfig>,
pub trustpay: Option<ConnectorTomlConfig>,
pub threedsecureio: Option<ConnectorTomlConfig>,
Expand Down Expand Up @@ -214,6 +216,7 @@ 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),
}
Expand Down
6 changes: 6 additions & 0 deletions crates/connector_configs/toml/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2580,6 +2580,12 @@ api_key = "Adyen API Key (Payout creation)"
api_secret = "Adyen Key (Payout submission)"
key1 = "Adyen Account Id"

[stripe_payout]
[[stripe_payout.bank_transfer]]
payment_method_type = "ach"
[stripe_payout.connector_auth.HeaderKey]
api_key = "Stripe API Key"

[wise_payout]
[[wise_payout.bank_transfer]]
payment_method_type = "ach"
Expand Down
6 changes: 6 additions & 0 deletions crates/connector_configs/toml/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2582,6 +2582,12 @@ api_key = "Adyen API Key (Payout creation)"
api_secret = "Adyen Key (Payout submission)"
key1 = "Adyen Account Id"

[stripe_payout]
[[stripe_payout.bank_transfer]]
payment_method_type = "ach"
[stripe_payout.connector_auth.HeaderKey]
api_key = "Stripe API Key"

[wise_payout]
[[wise_payout.bank_transfer]]
payment_method_type = "ach"
Expand Down
11 changes: 9 additions & 2 deletions crates/data_models/src/payouts/payouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ pub struct Payouts {
pub attempt_count: i16,
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
}

#[derive(Clone, Debug, Eq, PartialEq)]
Expand All @@ -110,9 +111,10 @@ pub struct PayoutsNew {
pub metadata: Option<pii::SecretSerdeValue>,
pub created_at: Option<PrimitiveDateTime>,
pub last_modified_at: Option<PrimitiveDateTime>,
pub attempt_count: i16,
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub attempt_count: i16,
pub confirm: Option<bool>,
}

impl Default for PayoutsNew {
Expand All @@ -137,9 +139,10 @@ impl Default for PayoutsNew {
metadata: Option::default(),
created_at: Some(now),
last_modified_at: Some(now),
attempt_count: 1,
profile_id: String::default(),
status: storage_enums::PayoutStatus::default(),
attempt_count: 1,
confirm: None,
}
}
}
Expand All @@ -158,6 +161,7 @@ pub enum PayoutsUpdate {
metadata: Option<pii::SecretSerdeValue>,
profile_id: Option<String>,
status: Option<storage_enums::PayoutStatus>,
confirm: Option<bool>,
},
PayoutMethodIdUpdate {
payout_method_id: String,
Expand Down Expand Up @@ -188,6 +192,7 @@ pub struct PayoutsUpdateInternal {
pub profile_id: Option<String>,
pub status: Option<storage_enums::PayoutStatus>,
pub attempt_count: Option<i16>,
pub confirm: Option<bool>,
}

impl From<PayoutsUpdate> for PayoutsUpdateInternal {
Expand All @@ -205,6 +210,7 @@ impl From<PayoutsUpdate> for PayoutsUpdateInternal {
metadata,
profile_id,
status,
confirm,
} => Self {
amount: Some(amount),
destination_currency: Some(destination_currency),
Expand All @@ -217,6 +223,7 @@ impl From<PayoutsUpdate> for PayoutsUpdateInternal {
metadata,
profile_id,
status,
confirm,
..Default::default()
},
PayoutsUpdate::PayoutMethodIdUpdate { payout_method_id } => Self {
Expand Down
11 changes: 10 additions & 1 deletion crates/diesel_models/src/payouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub struct Payouts {
pub attempt_count: i16,
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
}

#[derive(
Expand Down Expand Up @@ -67,9 +68,10 @@ pub struct PayoutsNew {
pub created_at: Option<PrimitiveDateTime>,
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub last_modified_at: Option<PrimitiveDateTime>,
pub attempt_count: i16,
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub attempt_count: i16,
pub confirm: Option<bool>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand All @@ -86,6 +88,7 @@ pub enum PayoutsUpdate {
metadata: Option<pii::SecretSerdeValue>,
profile_id: Option<String>,
status: Option<storage_enums::PayoutStatus>,
confirm: Option<bool>,
},
PayoutMethodIdUpdate {
payout_method_id: String,
Expand Down Expand Up @@ -118,6 +121,7 @@ pub struct PayoutsUpdateInternal {
pub status: Option<storage_enums::PayoutStatus>,
pub last_modified_at: PrimitiveDateTime,
pub attempt_count: Option<i16>,
pub confirm: Option<bool>,
}

impl Default for PayoutsUpdateInternal {
Expand All @@ -137,6 +141,7 @@ impl Default for PayoutsUpdateInternal {
status: None,
last_modified_at: common_utils::date_time::now(),
attempt_count: None,
confirm: None,
}
}
}
Expand All @@ -156,6 +161,7 @@ impl From<PayoutsUpdate> for PayoutsUpdateInternal {
metadata,
profile_id,
status,
confirm,
} => Self {
amount: Some(amount),
destination_currency: Some(destination_currency),
Expand All @@ -168,6 +174,7 @@ impl From<PayoutsUpdate> for PayoutsUpdateInternal {
metadata,
profile_id,
status,
confirm,
..Default::default()
},
PayoutsUpdate::PayoutMethodIdUpdate { payout_method_id } => Self {
Expand Down Expand Up @@ -207,6 +214,7 @@ impl PayoutsUpdate {
status,
last_modified_at,
attempt_count,
confirm,
} = self.into();
Payouts {
amount: amount.unwrap_or(source.amount),
Expand All @@ -223,6 +231,7 @@ impl PayoutsUpdate {
status: status.unwrap_or(source.status),
last_modified_at,
attempt_count: attempt_count.unwrap_or(source.attempt_count),
confirm: confirm.or(source.confirm),
..source
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/diesel_models/src/process_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ pub enum ProcessTrackerRunner {
DeleteTokenizeDataWorkflow,
ApiKeyExpiryWorkflow,
OutgoingWebhookRetryWorkflow,
AttachPayoutAccountWorkflow,
}

#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions crates/diesel_models/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ diesel::table! {
#[max_length = 64]
profile_id -> Varchar,
status -> PayoutStatus,
confirm -> Nullable<Bool>,
}
}

Expand Down
17 changes: 17 additions & 0 deletions crates/router/src/bin/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,23 @@ impl ProcessTrackerWorkflows<routes::AppState> for WorkflowRunner {
storage::ProcessTrackerRunner::OutgoingWebhookRetryWorkflow => Ok(Box::new(
workflows::outgoing_webhook_retry::OutgoingWebhookRetryWorkflow,
)),
storage::ProcessTrackerRunner::AttachPayoutAccountWorkflow => {
#[cfg(feature = "payouts")]
{
Ok(Box::new(
workflows::attach_payout_account_workflow::AttachPayoutAccountWorkflow,
))
}
#[cfg(not(feature = "payouts"))]
{
Err(
error_stack::report!(ProcessTrackerError::UnexpectedFlow),
)
.attach_printable(
"Cannot run Stripe external account workflow when payouts feature is disabled",
)
}
}
}
};

Expand Down
Loading