mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
feat(payouts): add payout currency in wasm crate (#9626)
This commit is contained in:
@ -836,6 +836,14 @@ pub enum PayoutDirKeyKind {
|
|||||||
#[serde(rename = "amount")]
|
#[serde(rename = "amount")]
|
||||||
PayoutAmount,
|
PayoutAmount,
|
||||||
|
|
||||||
|
#[strum(
|
||||||
|
serialize = "currency",
|
||||||
|
detailed_message = "Currency used for the payout",
|
||||||
|
props(Category = "Order details")
|
||||||
|
)]
|
||||||
|
#[serde(rename = "currency")]
|
||||||
|
PayoutCurrency,
|
||||||
|
|
||||||
#[strum(
|
#[strum(
|
||||||
serialize = "payment_method",
|
serialize = "payment_method",
|
||||||
detailed_message = "Different modes of payout - eg. cards, wallets, banks",
|
detailed_message = "Different modes of payout - eg. cards, wallets, banks",
|
||||||
@ -874,6 +882,8 @@ pub enum PayoutDirValue {
|
|||||||
BusinessLabel(types::StrValue),
|
BusinessLabel(types::StrValue),
|
||||||
#[serde(rename = "amount")]
|
#[serde(rename = "amount")]
|
||||||
PayoutAmount(types::NumValue),
|
PayoutAmount(types::NumValue),
|
||||||
|
#[serde(rename = "currency")]
|
||||||
|
PayoutCurrency(enums::PaymentCurrency),
|
||||||
#[serde(rename = "payment_method")]
|
#[serde(rename = "payment_method")]
|
||||||
PayoutType(common_enums::PayoutType),
|
PayoutType(common_enums::PayoutType),
|
||||||
#[serde(rename = "wallet")]
|
#[serde(rename = "wallet")]
|
||||||
|
|||||||
@ -55,6 +55,9 @@ pub enum EuclidKey {
|
|||||||
PaymentAmount,
|
PaymentAmount,
|
||||||
#[strum(serialize = "currency")]
|
#[strum(serialize = "currency")]
|
||||||
PaymentCurrency,
|
PaymentCurrency,
|
||||||
|
#[cfg(feature = "payouts")]
|
||||||
|
#[strum(serialize = "payout_currency")]
|
||||||
|
PayoutCurrency,
|
||||||
#[strum(serialize = "country", to_string = "business_country")]
|
#[strum(serialize = "country", to_string = "business_country")]
|
||||||
BusinessCountry,
|
BusinessCountry,
|
||||||
#[strum(serialize = "billing_country")]
|
#[strum(serialize = "billing_country")]
|
||||||
@ -149,6 +152,8 @@ impl EuclidKey {
|
|||||||
Self::CaptureMethod => DataType::EnumVariant,
|
Self::CaptureMethod => DataType::EnumVariant,
|
||||||
Self::PaymentAmount => DataType::Number,
|
Self::PaymentAmount => DataType::Number,
|
||||||
Self::PaymentCurrency => DataType::EnumVariant,
|
Self::PaymentCurrency => DataType::EnumVariant,
|
||||||
|
#[cfg(feature = "payouts")]
|
||||||
|
Self::PayoutCurrency => DataType::EnumVariant,
|
||||||
Self::BusinessCountry => DataType::EnumVariant,
|
Self::BusinessCountry => DataType::EnumVariant,
|
||||||
Self::BillingCountry => DataType::EnumVariant,
|
Self::BillingCountry => DataType::EnumVariant,
|
||||||
Self::MandateType => DataType::EnumVariant,
|
Self::MandateType => DataType::EnumVariant,
|
||||||
@ -274,6 +279,8 @@ pub enum EuclidValue {
|
|||||||
MandateType(enums::MandateType),
|
MandateType(enums::MandateType),
|
||||||
PaymentAmount(NumValue),
|
PaymentAmount(NumValue),
|
||||||
PaymentCurrency(enums::Currency),
|
PaymentCurrency(enums::Currency),
|
||||||
|
#[cfg(feature = "payouts")]
|
||||||
|
PayoutCurrency(enums::Currency),
|
||||||
BusinessCountry(enums::Country),
|
BusinessCountry(enums::Country),
|
||||||
BillingCountry(enums::Country),
|
BillingCountry(enums::Country),
|
||||||
BusinessLabel(StrValue),
|
BusinessLabel(StrValue),
|
||||||
@ -309,6 +316,8 @@ impl EuclidValue {
|
|||||||
Self::CaptureMethod(_) => EuclidKey::CaptureMethod,
|
Self::CaptureMethod(_) => EuclidKey::CaptureMethod,
|
||||||
Self::PaymentAmount(_) => EuclidKey::PaymentAmount,
|
Self::PaymentAmount(_) => EuclidKey::PaymentAmount,
|
||||||
Self::PaymentCurrency(_) => EuclidKey::PaymentCurrency,
|
Self::PaymentCurrency(_) => EuclidKey::PaymentCurrency,
|
||||||
|
#[cfg(feature = "payouts")]
|
||||||
|
Self::PayoutCurrency(_) => EuclidKey::PayoutCurrency,
|
||||||
Self::BusinessCountry(_) => EuclidKey::BusinessCountry,
|
Self::BusinessCountry(_) => EuclidKey::BusinessCountry,
|
||||||
Self::BillingCountry(_) => EuclidKey::BillingCountry,
|
Self::BillingCountry(_) => EuclidKey::BillingCountry,
|
||||||
Self::BusinessLabel(_) => EuclidKey::BusinessLabel,
|
Self::BusinessLabel(_) => EuclidKey::BusinessLabel,
|
||||||
|
|||||||
@ -445,6 +445,7 @@ pub fn get_payout_variant_values(key: &str) -> Result<JsValue, JsValue> {
|
|||||||
let variants: &[&str] = match key {
|
let variants: &[&str] = match key {
|
||||||
dir::PayoutDirKeyKind::BusinessCountry => dir_enums::BusinessCountry::VARIANTS,
|
dir::PayoutDirKeyKind::BusinessCountry => dir_enums::BusinessCountry::VARIANTS,
|
||||||
dir::PayoutDirKeyKind::BillingCountry => dir_enums::BillingCountry::VARIANTS,
|
dir::PayoutDirKeyKind::BillingCountry => dir_enums::BillingCountry::VARIANTS,
|
||||||
|
dir::PayoutDirKeyKind::PayoutCurrency => dir_enums::PaymentCurrency::VARIANTS,
|
||||||
dir::PayoutDirKeyKind::PayoutType => dir_enums::PayoutType::VARIANTS,
|
dir::PayoutDirKeyKind::PayoutType => dir_enums::PayoutType::VARIANTS,
|
||||||
dir::PayoutDirKeyKind::WalletType => dir_enums::PayoutWalletType::VARIANTS,
|
dir::PayoutDirKeyKind::WalletType => dir_enums::PayoutWalletType::VARIANTS,
|
||||||
dir::PayoutDirKeyKind::BankTransferType => dir_enums::PayoutBankTransferType::VARIANTS,
|
dir::PayoutDirKeyKind::BankTransferType => dir_enums::PayoutBankTransferType::VARIANTS,
|
||||||
|
|||||||
@ -38,7 +38,7 @@ impl Default for PayoutRequiredFields {
|
|||||||
// Adyen
|
// Adyen
|
||||||
get_connector_payment_method_type_fields(
|
get_connector_payment_method_type_fields(
|
||||||
PayoutConnectors::Adyenplatform,
|
PayoutConnectors::Adyenplatform,
|
||||||
PaymentMethodType::Sepa,
|
PaymentMethodType::SepaBankTransfer,
|
||||||
),
|
),
|
||||||
// Ebanx
|
// Ebanx
|
||||||
get_connector_payment_method_type_fields(
|
get_connector_payment_method_type_fields(
|
||||||
@ -117,7 +117,7 @@ fn get_billing_details_for_payment_method(
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Add first_name for bank payouts only
|
// Add first_name for bank payouts only
|
||||||
if payment_method_type == PaymentMethodType::Sepa {
|
if payment_method_type == PaymentMethodType::SepaBankTransfer {
|
||||||
fields.insert(
|
fields.insert(
|
||||||
"billing.address.first_name".to_string(),
|
"billing.address.first_name".to_string(),
|
||||||
RequiredFieldInfo {
|
RequiredFieldInfo {
|
||||||
@ -209,7 +209,7 @@ fn get_connector_payment_method_type_fields(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
PaymentMethodType::Sepa => {
|
PaymentMethodType::SepaBankTransfer => {
|
||||||
common_fields.extend(get_sepa_fields());
|
common_fields.extend(get_sepa_fields());
|
||||||
(
|
(
|
||||||
payment_method_type,
|
payment_method_type,
|
||||||
|
|||||||
Reference in New Issue
Block a user