use anyhow::Context; use schist_models::{account::Account, account_transfer::AccountTransfer}; use super::ACCOUNT_NAMES_DICT; pub fn get_account_transfer_matchers( ) -> Vec bool>> { vec![ Box::new(|at, a| matches_cash_withdrawal_10_sept_2024(at, a)), ] } fn matches_cash_withdrawal_10_sept_2024( account_transfer: &AccountTransfer, accounts: &[Account], ) -> bool { let bank_account = accounts .iter() .filter(|a| a.name == ACCOUNT_NAMES_DICT.bank_account) .next() .with_context(|| "failed to find bank account") .unwrap(); let cash_account = accounts .iter() .filter(|a| a.name == ACCOUNT_NAMES_DICT.cash_account) .next() .with_context(|| "failed to find cash account") .unwrap(); match account_transfer { AccountTransfer { id: _id, date, description, quantity: 80_00, from_account_id, to_account_id, } => *date == "2024-09-10".parse().unwrap() && *description == "" && *from_account_id == bank_account.id && *to_account_id == cash_account.id, _ => false, } }