+ //println!("{:?}", record);
+ // Match based on action which account
+ let account_name = match record.typ.as_str() {
+ "Insättning" => "Tillgångar:Likvida Medel:Brukskonto",
+ "Uttag" => "Utgifter:AttSortera:Swish",
+ "Reserverat Belopp" => "Utgifter:AttSortera:Kreditkort:Reserverade",
+ "Korttransaktion" => "Utgifter:AttSortera:Kreditkort",
+ _ => "INVALID",
+ };
+
+ wtr.write_record(&[
+ // Date
+ record.datum,
+ // Transaction ID, let GnuCash generate
+ "".into(),
+ // Number, let GnuCash generate
+ "".into(),
+ // Description
+ record.text,
+ // Notes
+ "".into(),
+ // Currency
+ "CURRENCY::SEK".into(),
+ // Void Reason
+ "".into(),
+ // Action
+ record.typ,
+ // Memo
+ "".into(),
+ // Full Account Name",
+ account_name.into(),
+ // Account Name",
+ "".into(),
+ // Amount With Sym.",
+ "".into(),
+ // Amount Num",
+ record
+ .belopp
+ .replace(" kr", "")
+ .replace(",", ".")
+ .chars()
+ .filter(|c| c.is_ascii())
+ .filter(|c| !c.is_whitespace())
+ .collect::<String>()
+ .parse::<f32>()
+ .unwrap()
+ .to_string(),
+ // Reconcile",
+ "n".into(),
+ // Reconcile Date",
+ "".into(),
+ // Rate/Price",
+ "1".into(),
+ ])?;