From 7b22ebf8a8ee49907b8affe4b443782b98b7bc4d Mon Sep 17 00:00:00 2001 From: Jacek Czaja Date: Thu, 4 Apr 2024 08:22:19 +0200 Subject: [PATCH 1/2] - support for english statement of revolut savings account added --- Cargo.lock | 2 +- Cargo.toml | 2 +- revolut_data/revolut-savings-eng.csv | 48 ++++++++++++++++++++++++++++ src/csvparser.rs | 33 ++++++++++++++++++- src/main.rs | 1 + 5 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 revolut_data/revolut-savings-eng.csv diff --git a/Cargo.lock b/Cargo.lock index 9925bd4..fa752e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -571,7 +571,7 @@ checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" [[package]] name = "etradeTaxReturnHelper" -version = "0.5.1" +version = "0.5.2" dependencies = [ "calamine", "chrono", diff --git a/Cargo.toml b/Cargo.toml index b41f752..97623ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "etradeTaxReturnHelper" -version = "0.5.1" +version = "0.5.2" edition = "2021" description = "Parses etrade financial documents for transaction details (income, tax paid, cost basis) and compute total income and total tax paid according to chosen tax residency (currency)" license = "BSD-3-Clause" diff --git a/revolut_data/revolut-savings-eng.csv b/revolut_data/revolut-savings-eng.csv new file mode 100644 index 0000000..bcb7a2f --- /dev/null +++ b/revolut_data/revolut-savings-eng.csv @@ -0,0 +1,48 @@ +Completed Date,Product name,Description,Interest rate (p.a.),Money out,Money in,Balance +"1 Jan 2023","","Money brought forward","","","","0 PLN" +"11 Dec 2023","Instant Access - Aion Bank","Deposit","","","+2,500 PLN","2,500 PLN" +"11 Dec 2023","Instant Access - Aion Bank","Deposit","","","+10 PLN","2,510 PLN" +"11 Dec 2023","Instant Access - Aion Bank","Deposit","","","+10 PLN","2,520 PLN" +"12 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/12","3.05%","","+0.21 PLN","2,520.21 PLN" +"13 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/13","3.05%","","+0.20 PLN","2,520.41 PLN" +"14 Dec 2023","Instant Access - Aion Bank","Deposit","","","+10 PLN","2,530.41 PLN" +"15 Dec 2023","Instant Access - Aion Bank","Deposit","","","+8.22 PLN","2,538.63 PLN" +"15 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/15","3.05%","","+0.21 PLN","2,538.84 PLN" +"16 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/16","3.05%","","+0.21 PLN","2,539.05 PLN" +"17 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/17","3.05%","","+0.21 PLN","2,539.26 PLN" +"18 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/18","3.05%","","+0.21 PLN","2,539.47 PLN" +"19 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/19","3.05%","","+0.41 PLN","2,539.88 PLN" +"20 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/20","3.05%","","+0.21 PLN","2,540.09 PLN" +"21 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/21","3.05%","","+0.21 PLN","2,540.30 PLN" +"21 Dec 2023","Instant Access - Aion Bank","Deposit","","","+10 PLN","2,550.30 PLN" +"22 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/22","3.05%","","+0.21 PLN","2,550.51 PLN" +"23 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/23","3.05%","","+0.21 PLN","2,550.72 PLN" +"24 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/24","3.05%","","+0.21 PLN","2,550.93 PLN" +"25 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/25","3.05%","","+0.21 PLN","2,551.14 PLN" +"26 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/26","3.05%","","+0.21 PLN","2,551.35 PLN" +"27 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/27","3.05%","","+0.21 PLN","2,551.56 PLN" +"28 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/28","3.05%","","+0.21 PLN","2,551.77 PLN" +"28 Dec 2023","Instant Access - Aion Bank","Deposit","","","+10 PLN","2,561.77 PLN" +"29 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/29","3.05%","","+0.21 PLN","2,561.98 PLN" +"30 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/30","3.05%","","+0.21 PLN","2,562.19 PLN" +"31 Dec 2023","Instant Access - Aion Bank","Gross interest +Earned on 2023/12/31","3.05%","","+0.21 PLN","2,562.40 PLN" +"31 Dec 2023","","Money carried forward","","","","2,562.40 PLN" diff --git a/src/csvparser.rs b/src/csvparser.rs index b4d2d61..3075e8d 100644 --- a/src/csvparser.rs +++ b/src/csvparser.rs @@ -76,7 +76,7 @@ fn extract_intrest_rate_transactions(df: &DataFrame) -> Result { - if x.contains("Odsetki brutto") { + if x.contains("Odsetki brutto") || x.contains("Gross interest") { Some("odsetki") } else { None @@ -535,6 +535,37 @@ mod tests { Ok(()) } + #[test] + fn test_parse_revolut_transactions_english_statement_pln() -> Result<(), String> { + let expected_result = Ok(vec![ + ("12/12/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/13/23".to_owned(), crate::Currency::PLN(0.20)), + ("12/15/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/16/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/17/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/18/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/19/23".to_owned(), crate::Currency::PLN(0.41)), + ("12/20/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/21/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/22/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/23/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/24/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/25/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/26/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/27/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/28/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/29/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/30/23".to_owned(), crate::Currency::PLN(0.21)), + ("12/31/23".to_owned(), crate::Currency::PLN(0.21)), + ]); + assert_eq!( + parse_revolut_transactions("revolut_data/revolut-savings-eng.csv"), + expected_result + ); + + Ok(()) + } + #[test] fn test_parse_revolut_investment_transactions_usd() -> Result<(), String> { let expected_result = Ok(vec![ diff --git a/src/main.rs b/src/main.rs index d52b73d..d3d2e7f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,6 +11,7 @@ mod gui; use etradeTaxReturnHelper::run_taxation; use logging::ResultExt; +// TODO: make a support for english revolut // TODO: When there is no proxy (on intel account) there are problems (UT do not work // getting_Exchange_rate) // TODO: Make a parsing of incomplete date From 6a9bbe1d8da4840b5d1b477970fa9e300054ff1c Mon Sep 17 00:00:00 2001 From: Jacek Czaja Date: Thu, 4 Apr 2024 08:26:58 +0200 Subject: [PATCH 2/2] - cosmetic fixes --- src/main.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index d3d2e7f..101f1c2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,6 @@ mod gui; use etradeTaxReturnHelper::run_taxation; use logging::ResultExt; -// TODO: make a support for english revolut // TODO: When there is no proxy (on intel account) there are problems (UT do not work // getting_Exchange_rate) // TODO: Make a parsing of incomplete date @@ -21,7 +20,6 @@ use logging::ResultExt; // TODO: parse_gain_and_losses expect -> ? // TODO: GUI : choosing residency // TODO: Drag&Drop to work on MultiBrowser field -// TODO: Change run_taxation for_Each into try_for_Ech if possible // TODO: taxation of EUR instruments in US fn create_cmd_line_pattern<'a, 'b>(myapp: App<'a, 'b>) -> App<'a, 'b> {