Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(payouts): add payout currency in wasm crate (#9626)

Kashif51c8d16dc5f4
diff --git a/crates/euclid/src/frontend/dir.rs b/crates/euclid/src/frontend/dir.rs
index 7df086fdbc..62dbefab3f 100644
--- a/crates/euclid/src/frontend/dir.rs
+++ b/crates/euclid/src/frontend/dir.rs
@@ -836,6 +836,14 @@ pub enum PayoutDirKeyKind {
#[serde(rename = "amount")]
PayoutAmount,
+ #[strum(
+ serialize = "currency",
+ detailed_message = "Currency used for the payout",
+ props(Category = "Order details")
+ )]
+ #[serde(rename = "currency")]
+ PayoutCurrency,
+
#[strum(
serialize = "payment_method",
detailed_message = "Different modes of payout - eg. cards, wallets, banks",
@@ -874,6 +882,8 @@ pub enum PayoutDirValue {
BusinessLabel(types::StrValue),
#[serde(rename = "amount")]
PayoutAmount(types::NumValue),
+ #[serde(rename = "currency")]
+ PayoutCurrency(enums::PaymentCurrency),
#[serde(rename = "payment_method")]
PayoutType(common_enums::PayoutType),
#[serde(rename = "wallet")]
diff --git a/crates/euclid/src/types.rs b/crates/euclid/src/types.rs
index 99b94f2a67..44d0816be2 100644
--- a/crates/euclid/src/types.rs
+++ b/crates/euclid/src/types.rs
@@ -55,6 +55,9 @@ pub enum EuclidKey {
PaymentAmount,
#[strum(serialize = "currency")]
PaymentCurrency,
+ #[cfg(feature = "payouts")]
+ #[strum(serialize = "payout_currency")]
+ PayoutCurrency,
#[strum(serialize = "country", to_string = "business_country")]
BusinessCountry,
#[strum(serialize = "billing_country")]
@@ -149,6 +152,8 @@ impl EuclidKey {
Self::CaptureMethod => DataType::EnumVariant,
Self::PaymentAmount => DataType::Number,
Self::PaymentCurrency => DataType::EnumVariant,
+ #[cfg(feature = "payouts")]
+ Self::PayoutCurrency => DataType::EnumVariant,
Self::BusinessCountry => DataType::EnumVariant,
Self::BillingCountry => DataType::EnumVariant,
Self::MandateType => DataType::EnumVariant,
@@ -274,6 +279,8 @@ pub enum EuclidValue {
MandateType(enums::MandateType),
PaymentAmount(NumValue),
PaymentCurrency(enums::Currency),
+ #[cfg(feature = "payouts")]
+ PayoutCurrency(enums::Currency),
BusinessCountry(enums::Country),
BillingCountry(enums::Country),
BusinessLabel(StrValue),
@@ -309,6 +316,8 @@ impl EuclidValue {
Self::CaptureMethod(_) => EuclidKey::CaptureMethod,
Self::PaymentAmount(_) => EuclidKey::PaymentAmount,
Self::PaymentCurrency(_) => EuclidKey::PaymentCurrency,
+ #[cfg(feature = "payouts")]
+ Self::PayoutCurrency(_) => EuclidKey::PayoutCurrency,
Self::BusinessCountry(_) => EuclidKey::BusinessCountry,
Self::BillingCountry(_) => EuclidKey::BillingCountry,
Self::BusinessLabel(_) => EuclidKey::BusinessLabel,
diff --git a/crates/euclid_wasm/src/lib.rs b/crates/euclid_wasm/src/lib.rs
index c0e58520c7..2aaee43f7e 100644
--- a/crates/euclid_wasm/src/lib.rs
+++ b/crates/euclid_wasm/src/lib.rs
@@ -445,6 +445,7 @@ pub fn get_payout_variant_values(key: &str) -> Result<JsValue, JsValue> {
let variants: &[&str] = match key {
dir::PayoutDirKeyKind::BusinessCountry => dir_enums::BusinessCountry::VARIANTS,
dir::PayoutDirKeyKind::BillingCountry => dir_enums::BillingCountry::VARIANTS,
+ dir::PayoutDirKeyKind::PayoutCurrency => dir_enums::PaymentCurrency::VARIANTS,
dir::PayoutDirKeyKind::PayoutType => dir_enums::PayoutType::VARIANTS,
dir::PayoutDirKeyKind::WalletType => dir_enums::PayoutWalletType::VARIANTS,
dir::PayoutDirKeyKind::BankTransferType => dir_enums::PayoutBankTransferType::VARIANTS,
diff --git a/crates/router/src/configs/defaults/payout_required_fields.rs b/crates/router/src/configs/defaults/payout_required_fields.rs
index d6b316c42b..24c13ec539 100644
--- a/crates/router/src/configs/defaults/payout_required_fields.rs
+++ b/crates/router/src/configs/defaults/payout_required_fields.rs
@@ -38,7 +38,7 @@ impl Default for PayoutRequiredFields {
// Adyen
get_connector_payment_method_type_fields(
PayoutConnectors::Adyenplatform,
- PaymentMethodType::Sepa,
+ PaymentMethodType::SepaBankTransfer,
),
// Ebanx
get_connector_payment_method_type_fields(
@@ -117,7 +117,7 @@ fn get_billing_details_for_payment_method(
]);
// Add first_name for bank payouts only
- if payment_method_type == PaymentMethodType::Sepa {
+ if payment_method_type == PaymentMethodType::SepaBankTransfer {
fields.insert(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
@@ -209,7 +209,7 @@ fn get_connector_payment_method_type_fields(
},
)
}
- PaymentMethodType::Sepa => {
+ PaymentMethodType::SepaBankTransfer => {
common_fields.extend(get_sepa_fields());
(
payment_method_type,