mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +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")]
|
||||
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")]
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user