mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
fix(eps_bank_name): send eps supported bank names inside the structs for sdk. (#8779)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -29440,7 +29440,8 @@
|
|||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/components/schemas/BankCodeResponse"
|
"$ref": "#/components/schemas/BankCodeResponse"
|
||||||
},
|
},
|
||||||
"description": "The list of banks enabled, if applicable for a payment method type",
|
"description": "The list of banks enabled, if applicable for a payment method type . To be deprecated soon.",
|
||||||
|
"deprecated": true,
|
||||||
"nullable": true
|
"nullable": true
|
||||||
},
|
},
|
||||||
"bank_debits": {
|
"bank_debits": {
|
||||||
|
|||||||
@ -1442,7 +1442,8 @@ pub struct ResponsePaymentMethodTypes {
|
|||||||
/// The list of card networks enabled, if applicable for a payment method type
|
/// The list of card networks enabled, if applicable for a payment method type
|
||||||
pub card_networks: Option<Vec<CardNetworkTypes>>,
|
pub card_networks: Option<Vec<CardNetworkTypes>>,
|
||||||
|
|
||||||
/// The list of banks enabled, if applicable for a payment method type
|
#[schema(deprecated)]
|
||||||
|
/// The list of banks enabled, if applicable for a payment method type . To be deprecated soon.
|
||||||
pub bank_names: Option<Vec<BankCodeResponse>>,
|
pub bank_names: Option<Vec<BankCodeResponse>>,
|
||||||
|
|
||||||
/// The Bank debit payment method information, if applicable for a payment method type.
|
/// The Bank debit payment method information, if applicable for a payment method type.
|
||||||
|
|||||||
@ -6,8 +6,9 @@ use api_models::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::configs::settings::{
|
use crate::configs::settings::{
|
||||||
ConnectorFields, Mandates, RequiredFieldFinal, SupportedConnectorsForMandate,
|
BankRedirectConfig, ConnectorFields, Mandates, RequiredFieldFinal,
|
||||||
SupportedPaymentMethodTypesForMandate, SupportedPaymentMethodsForMandate, ZeroMandates,
|
SupportedConnectorsForMandate, SupportedPaymentMethodTypesForMandate,
|
||||||
|
SupportedPaymentMethodsForMandate, ZeroMandates,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
use crate::configs::settings::{PaymentMethodType, RequiredFields};
|
use crate::configs::settings::{PaymentMethodType, RequiredFields};
|
||||||
@ -1001,8 +1002,8 @@ pub fn get_shipping_required_fields() -> HashMap<String, RequiredFieldInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
impl Default for RequiredFields {
|
impl RequiredFields {
|
||||||
fn default() -> Self {
|
pub fn new(bank_config: &BankRedirectConfig) -> Self {
|
||||||
let cards_required_fields = get_cards_required_fields();
|
let cards_required_fields = get_cards_required_fields();
|
||||||
let mut debit_required_fields = cards_required_fields.clone();
|
let mut debit_required_fields = cards_required_fields.clone();
|
||||||
debit_required_fields.extend(HashMap::from([
|
debit_required_fields.extend(HashMap::from([
|
||||||
@ -1043,7 +1044,7 @@ impl Default for RequiredFields {
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
enums::PaymentMethod::BankRedirect,
|
enums::PaymentMethod::BankRedirect,
|
||||||
PaymentMethodType(get_bank_redirect_required_fields()),
|
PaymentMethodType(get_bank_redirect_required_fields(bank_config)),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
enums::PaymentMethod::Wallet,
|
enums::PaymentMethod::Wallet,
|
||||||
@ -1229,6 +1230,13 @@ impl Default for RequiredFields {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
|
impl Default for RequiredFields {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new(&BankRedirectConfig::default())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
fn get_cards_required_fields() -> HashMap<Connector, RequiredFieldFinal> {
|
fn get_cards_required_fields() -> HashMap<Connector, RequiredFieldFinal> {
|
||||||
HashMap::from([
|
HashMap::from([
|
||||||
@ -1598,7 +1606,9 @@ fn get_cards_required_fields() -> HashMap<Connector, RequiredFieldFinal> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
fn get_bank_redirect_required_fields() -> HashMap<enums::PaymentMethodType, ConnectorFields> {
|
fn get_bank_redirect_required_fields(
|
||||||
|
bank_config: &BankRedirectConfig,
|
||||||
|
) -> HashMap<enums::PaymentMethodType, ConnectorFields> {
|
||||||
HashMap::from([
|
HashMap::from([
|
||||||
(
|
(
|
||||||
enums::PaymentMethodType::OpenBankingUk,
|
enums::PaymentMethodType::OpenBankingUk,
|
||||||
@ -2077,69 +2087,14 @@ fn get_bank_redirect_required_fields() -> HashMap<enums::PaymentMethodType, Conn
|
|||||||
FieldType::UserFullName,
|
FieldType::UserFullName,
|
||||||
),
|
),
|
||||||
RequiredField::EpsBankOptions(
|
RequiredField::EpsBankOptions(
|
||||||
vec![
|
bank_config
|
||||||
enums::BankNames::AbnAmro,
|
.0
|
||||||
enums::BankNames::ArzteUndApothekerBank,
|
.get(&enums::PaymentMethodType::Eps)
|
||||||
enums::BankNames::AsnBank,
|
.and_then(|connector_bank_names| {
|
||||||
enums::BankNames::AustrianAnadiBankAg,
|
connector_bank_names.0.get("stripe")
|
||||||
enums::BankNames::BankAustria,
|
})
|
||||||
enums::BankNames::BankhausCarlSpangler,
|
.map(|bank_names| bank_names.banks.clone())
|
||||||
enums::BankNames::BankhausSchelhammerUndSchatteraAg,
|
.unwrap_or_default(),
|
||||||
enums::BankNames::BawagPskAg,
|
|
||||||
enums::BankNames::BksBankAg,
|
|
||||||
enums::BankNames::BrullKallmusBankAg,
|
|
||||||
enums::BankNames::BtvVierLanderBank,
|
|
||||||
enums::BankNames::Bunq,
|
|
||||||
enums::BankNames::CapitalBankGraweGruppeAg,
|
|
||||||
enums::BankNames::Citi,
|
|
||||||
enums::BankNames::Dolomitenbank,
|
|
||||||
enums::BankNames::EasybankAg,
|
|
||||||
enums::BankNames::ErsteBankUndSparkassen,
|
|
||||||
enums::BankNames::Handelsbanken,
|
|
||||||
enums::BankNames::HypoAlpeadriabankInternationalAg,
|
|
||||||
enums::BankNames::HypoNoeLbFurNiederosterreichUWien,
|
|
||||||
enums::BankNames::HypoOberosterreichSalzburgSteiermark,
|
|
||||||
enums::BankNames::HypoTirolBankAg,
|
|
||||||
enums::BankNames::HypoVorarlbergBankAg,
|
|
||||||
enums::BankNames::HypoBankBurgenlandAktiengesellschaft,
|
|
||||||
enums::BankNames::Ing,
|
|
||||||
enums::BankNames::Knab,
|
|
||||||
enums::BankNames::MarchfelderBank,
|
|
||||||
enums::BankNames::OberbankAg,
|
|
||||||
enums::BankNames::RaiffeisenBankengruppeOsterreich,
|
|
||||||
enums::BankNames::Rabobank,
|
|
||||||
enums::BankNames::Regiobank,
|
|
||||||
enums::BankNames::Revolut,
|
|
||||||
enums::BankNames::SnsBank,
|
|
||||||
enums::BankNames::TriodosBank,
|
|
||||||
enums::BankNames::VanLanschot,
|
|
||||||
enums::BankNames::Moneyou,
|
|
||||||
enums::BankNames::SchoellerbankAg,
|
|
||||||
enums::BankNames::SpardaBankWien,
|
|
||||||
enums::BankNames::VolksbankGruppe,
|
|
||||||
enums::BankNames::VolkskreditbankAg,
|
|
||||||
enums::BankNames::VrBankBraunau,
|
|
||||||
enums::BankNames::PlusBank,
|
|
||||||
enums::BankNames::EtransferPocztowy24,
|
|
||||||
enums::BankNames::BankiSpbdzielcze,
|
|
||||||
enums::BankNames::BankNowyBfgSa,
|
|
||||||
enums::BankNames::GetinBank,
|
|
||||||
enums::BankNames::Blik,
|
|
||||||
enums::BankNames::NoblePay,
|
|
||||||
enums::BankNames::IdeaBank,
|
|
||||||
enums::BankNames::EnveloBank,
|
|
||||||
enums::BankNames::NestPrzelew,
|
|
||||||
enums::BankNames::MbankMtransfer,
|
|
||||||
enums::BankNames::Inteligo,
|
|
||||||
enums::BankNames::PbacZIpko,
|
|
||||||
enums::BankNames::BnpParibas,
|
|
||||||
enums::BankNames::BankPekaoSa,
|
|
||||||
enums::BankNames::VolkswagenBank,
|
|
||||||
enums::BankNames::AliorBank,
|
|
||||||
enums::BankNames::Boz,
|
|
||||||
]
|
|
||||||
.into_iter()
|
|
||||||
.collect(),
|
|
||||||
),
|
),
|
||||||
RequiredField::BillingLastName("billing_name", FieldType::UserFullName),
|
RequiredField::BillingLastName("billing_name", FieldType::UserFullName),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -22,6 +22,17 @@ pub struct ConnectorFields {
|
|||||||
pub fields: HashMap<enums::Connector, RequiredFieldFinal>,
|
pub fields: HashMap<enums::Connector, RequiredFieldFinal>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Clone, Default)]
|
||||||
|
pub struct BankRedirectConfig(pub HashMap<enums::PaymentMethodType, ConnectorBankNames>);
|
||||||
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
|
pub struct ConnectorBankNames(pub HashMap<String, BanksVector>);
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
|
pub struct BanksVector {
|
||||||
|
#[serde(deserialize_with = "deserialize_hashset")]
|
||||||
|
pub banks: HashSet<common_enums::enums::BankNames>,
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct RequiredFieldFinal {
|
pub struct RequiredFieldFinal {
|
||||||
|
|||||||
@ -30,9 +30,10 @@ use hyperswitch_interfaces::{
|
|||||||
};
|
};
|
||||||
use masking::Secret;
|
use masking::Secret;
|
||||||
pub use payment_methods::configs::settings::{
|
pub use payment_methods::configs::settings::{
|
||||||
ConnectorFields, EligiblePaymentMethods, Mandates, PaymentMethodAuth, PaymentMethodType,
|
BankRedirectConfig, BanksVector, ConnectorBankNames, ConnectorFields, EligiblePaymentMethods,
|
||||||
RequiredFieldFinal, RequiredFields, SupportedConnectorsForMandate,
|
Mandates, PaymentMethodAuth, PaymentMethodType, RequiredFieldFinal, RequiredFields,
|
||||||
SupportedPaymentMethodTypesForMandate, SupportedPaymentMethodsForMandate, ZeroMandates,
|
SupportedConnectorsForMandate, SupportedPaymentMethodTypesForMandate,
|
||||||
|
SupportedPaymentMethodsForMandate, ZeroMandates,
|
||||||
};
|
};
|
||||||
use redis_interface::RedisSettings;
|
use redis_interface::RedisSettings;
|
||||||
pub use router_env::config::{Log, LogConsole, LogFile, LogTelemetry};
|
pub use router_env::config::{Log, LogConsole, LogFile, LogTelemetry};
|
||||||
@ -675,17 +676,6 @@ pub enum PaymentMethodTypeTokenFilter {
|
|||||||
AllAccepted,
|
AllAccepted,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, Default)]
|
|
||||||
pub struct BankRedirectConfig(pub HashMap<enums::PaymentMethodType, ConnectorBankNames>);
|
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
|
||||||
pub struct ConnectorBankNames(pub HashMap<String, BanksVector>);
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
|
||||||
pub struct BanksVector {
|
|
||||||
#[serde(deserialize_with = "deserialize_hashset")]
|
|
||||||
pub banks: HashSet<common_enums::enums::BankNames>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, Default)]
|
#[derive(Debug, Deserialize, Clone, Default)]
|
||||||
#[serde(transparent)]
|
#[serde(transparent)]
|
||||||
pub struct ConnectorFilters(pub HashMap<String, PaymentMethodFilters>);
|
pub struct ConnectorFilters(pub HashMap<String, PaymentMethodFilters>);
|
||||||
@ -1015,9 +1005,14 @@ impl Settings<SecuredSecret> {
|
|||||||
.build()
|
.build()
|
||||||
.change_context(ApplicationError::ConfigurationError)?;
|
.change_context(ApplicationError::ConfigurationError)?;
|
||||||
|
|
||||||
serde_path_to_error::deserialize(config)
|
let mut settings: Self = serde_path_to_error::deserialize(config)
|
||||||
.attach_printable("Unable to deserialize application configuration")
|
.attach_printable("Unable to deserialize application configuration")
|
||||||
.change_context(ApplicationError::ConfigurationError)
|
.change_context(ApplicationError::ConfigurationError)?;
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
|
{
|
||||||
|
settings.required_fields = RequiredFields::new(&settings.bank_config);
|
||||||
|
}
|
||||||
|
Ok(settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn validate(&self) -> ApplicationResult<()> {
|
pub fn validate(&self) -> ApplicationResult<()> {
|
||||||
|
|||||||
Reference in New Issue
Block a user