Repository: juspay/hyperswitch
File: crates/common_enums/src/enums.rs (Rust)

Code before:
            Self::Twint => "TWINT",
            Self::UpiCollect => "UPI Collect",
            Self::UpiIntent => "UPI Intent",
            Self::UpiQr => "UPI QR",
            Self::Vipps => "Vipps",
            Self::VietQr => "VietQR",
            Self::Venmo => "Venmo",
            Self::Walley => "Walley",
            Self::WeChatPay => "WeChat Pay",
            Self::SevenEleven => "7-Eleven",
            Self::Lawson => "Lawson",
            Self::MiniStop => "Mini Stop",
            Self::FamilyMart => "FamilyMart",
            Self::Seicomart => "Seicomart",
            Self::PayEasy => "PayEasy",
            Self::LocalBankTransfer => "Local Bank Transfer",
            Self::Mifinity => "MiFinity",
            Self::OpenBankingPIS => "Open Banking PIS",
            Self::DirectCarrierBilling => "Direct Carrier Billing",
            Self::RevolutPay => "RevolutPay",
            Self::IndonesianBankTransfer => "Indonesian Bank Transfer",
        };
        display_name.to_string()
    }

    pub fn to_payment_method(self) -> PaymentMethod {
        match self {
            Self::Ach | Self::Bacs | Self::Becs | Self::Sepa | Self::SepaGuarenteedDebit => {
                PaymentMethod::BankDebit
            }
            Self::BancontactCard
            | Self::Bizum
            | Self::Blik
            | Self::Eft
            | Self::Eps
            | Self::Giropay
            | Self::Ideal
            | Self::Interac
            | Self::OnlineBankingCzechRepublic
            | Self::OnlineBankingFinland
            | Self::OnlineBankingPoland
            | Self::OnlineBankingSlovakia
            | Self::OpenBankingUk
            | Self::Przelewy24
            | Self::Sofort
            | Self::Trustly
            | Self::OnlineBankingFpx
            | Self::OnlineBankingThailand
            | Self::LocalBankRedirect => PaymentMethod::BankRedirect,
            Self::Alfamart
            | Self::Boleto

Review comment (suggestion):
We can re-use `PaymentMethod` impl from `PaymentMethodType`

`PaymentMethod::from(pm_type)`

Code after:
            Self::OpenBankingUk => "Open Banking UK",
            Self::PayBright => "PayBright",
            Self::Payjustnow => "Payjustnow",
            Self::Paypal => "PayPal",
            Self::Paze => "Paze",
            Self::Pix => "Pix",
            Self::PaySafeCard => "PaySafeCard",
            Self::Przelewy24 => "Przelewy24",
            Self::PromptPay => "PromptPay",
            Self::Pse => "PSE",
            Self::RedCompra => "RedCompra",
            Self::RedPagos => "RedPagos",
            Self::SamsungPay => "Samsung Pay",
            Self::Sepa => "SEPA Direct Debit",
            Self::SepaGuarenteedDebit => "SEPA Guarenteed Direct Debit",
            Self::SepaBankTransfer => "SEPA Bank Transfer",
            Self::Sofort => "Sofort",
            Self::Skrill => "Skrill",
            Self::Swish => "Swish",
            Self::TouchNGo => "Touch 'n Go",
            Self::Trustly => "Trustly",
            Self::Twint => "TWINT",
            Self::UpiCollect => "UPI Collect",
            Self::UpiIntent => "UPI Intent",
            Self::UpiQr => "UPI QR",
            Self::Vipps => "Vipps",
            Self::VietQr => "VietQR",
            Self::Venmo => "Venmo",
            Self::Walley => "Walley",
            Self::WeChatPay => "WeChat Pay",
            Self::SevenEleven => "7-Eleven",
            Self::Lawson => "Lawson",
            Self::MiniStop => "Mini Stop",
            Self::FamilyMart => "FamilyMart",
            Self::Seicomart => "Seicomart",
            Self::PayEasy => "PayEasy",
            Self::LocalBankTransfer => "Local Bank Transfer",
            Self::Mifinity => "MiFinity",
            Self::OpenBankingPIS => "Open Banking PIS",
            Self::DirectCarrierBilling => "Direct Carrier Billing",
            Self::RevolutPay => "RevolutPay",
            Self::IndonesianBankTransfer => "Indonesian Bank Transfer",
            Self::OpenBanking => "Open Banking",
        };
        display_name.to_string()
    }
}

impl masking::SerializableSecret for PaymentMethodType {}

/// Indicates the type of payment method. Eg: 'card', 'wallet', etc.