Skip to content

Commit

Permalink
- Moved revolut interests rate transaction to be combined with divide…
Browse files Browse the repository at this point in the history
…nds (#100)
  • Loading branch information
jczaja authored Mar 3, 2024
1 parent b1761e0 commit 247f885
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "etradeTaxReturnHelper"
version = "0.4.3"
version = "0.4.4"
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"
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ pub fn run_taxation(
let (gross_interests, _) = compute_div_taxation(&interests);
let (gross_div, tax_div) = compute_div_taxation(&transactions);
let (gross_sold, cost_sold) = compute_sold_taxation(&sold_transactions);
let (gross_revolut, cost_revolut) = compute_div_taxation(&revolut_transactions);
let (gross_revolut, _) = compute_div_taxation(&revolut_transactions);
Ok((
gross_interests + gross_div,
gross_interests + gross_div + gross_revolut,
tax_div,
gross_sold + gross_revolut, // We put sold and savings income into the same column
cost_sold + cost_revolut,
gross_sold, // We put sold and savings income into the same column
cost_sold,
interests,
transactions,
revolut_transactions,
Expand Down
27 changes: 27 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,33 @@ mod tests {
}
}

#[test]
fn test_revolut_interests_taxation_pln() -> Result<(), clap::Error> {
// Get all brokerage with dividends only
let myapp = App::new("E-trade tax helper").setting(AppSettings::ArgRequiredElseHelp);
let rd: Box<dyn etradeTaxReturnHelper::Residency> = Box::new(pl::PL {});

let matches = create_cmd_line_pattern(myapp).get_matches_from_safe(vec![
"mytest",
"revolut_data/Revolut_30cze2023_27lis2023.csv",
])?;
let pdfnames = matches
.values_of("financial documents")
.expect_and_log("error getting brokarage statements pdfs names");
let pdfnames: Vec<String> = pdfnames.map(|x| x.to_string()).collect();

match etradeTaxReturnHelper::run_taxation(&rd, pdfnames) {
Ok((gross_div, tax_div, gross_sold, cost_sold, _, _, _, _)) => {
assert_eq!(
(gross_div, tax_div, gross_sold, cost_sold),
(86.93008, 0.0, 0.0, 0.0),
);
Ok(())
}
Err(x) => panic!("Error in taxation process"),
}
}

#[test]
#[ignore]
fn test_sold_dividends_only_taxation() -> Result<(), clap::Error> {
Expand Down

0 comments on commit 247f885

Please sign in to comment.