use super::profile::{BankProfile, BookingIdSource, InitMode, ProfileId, UserIdRule};
pub(super) type Entry = (&'static [&'static str], fn() -> BankProfile);
pub(super) const PROFILES: &[Entry] = &[
(&["12030000"], dkb),
(
&[
"20041111", "20041133", "20041144", "20041155", "20041166", "20041177", "20041188",
"20041199",
],
comdirect,
),
(&["76030080", "70120400"], consorsbank),
(&["50010517"], ing),
];
fn dkb() -> BankProfile {
BankProfile {
id: ProfileId::Dkb,
booking_id: BookingIdSource::CamtEntryAcctSvcrRef,
..BankProfile::generic()
}
}
fn comdirect() -> BankProfile {
BankProfile {
id: ProfileId::Comdirect,
..BankProfile::generic()
}
}
fn consorsbank() -> BankProfile {
BankProfile {
id: ProfileId::Consorsbank,
user_id: Some(UserIdRule {
min_digits: 9,
max_digits: 10,
suffix: "001".into(),
}),
..BankProfile::generic()
}
}
fn ing() -> BankProfile {
BankProfile {
id: ProfileId::Ing,
init: InitMode::Direct {
security_function: "900".into(),
},
..BankProfile::generic()
}
}
pub(super) fn profile_for(blz: &str) -> BankProfile {
PROFILES
.iter()
.find(|(codes, _)| codes.contains(&blz))
.map_or_else(BankProfile::generic, |(_, make)| make())
}