nielsmaerten/ynab-buddy

Inflow inverses when Outflow/Inflow used

Closed this issue · 1 comments

if (outflow !== undefined || in_out_flag?.startsWith(outflow_indicator)) {
value = -value; // 420.69 ==> -420.69
}

Config:

import_from: "/home/iofjuupasli/Downloads"
search_subfolders: false

bank_transaction_files:
  # Repeat the following block for every account:
  - account_name: USD
    pattern: Transactions_*.csv
    parser: payoneer-parser
    ynab_account_id: 00000000-0000-0000-0000-000000000000
    ynab_budget_id: 00000000-0000-0000-0000-000000000000
    # ynab_flag_color: purple
    upload: false
    save_parsed_file: true
    delete_original_file: false

parsers:
  - name: payoneer-parser
    header_rows: 1
    footer_rows: 0
    delimiter: ","
    columns: [date, skip, skip, skip, payee, inflow, outflow]
    date_format: M/d/yyyy

upload_to_ynab:
  # This is the default. If you've set the 'upload' option on
  # a bank_transaction_file, that one will take precedence.
  upload_transactions: false
  ynab_token: ABC12345

# When you're done configuring, delete the next line:
configuration_done: true

Transaction file:

Transaction Date,Transaction Time,Time Zone,Transaction ID,Description,Credit Amount,Debit Amount,Currency,Transfer Amount,Transfer Amount Currency,Status,Running Balance,Additional Description,Store Name,Source,Target,Reference ID
12/09/2021,18:17:43,UTC,353553541,GBP to EUR - transfer between balances,582.27,,EUR,,,Completed,598.91,,,GBP balance,EUR balance,

Result:

amount,date,memo,payee_name
-582.27,2021-12-09T00:00:00.000Z,,GBP to EUR - transfer between balances

Expected result:

amount,date,memo,payee_name
- -582.27,2021-12-09T00:00:00.000Z,,GBP to EUR - transfer between balances
+ 582.27,2021-12-09T00:00:00.000Z,,GBP to EUR - transfer between balances

Thanks for the bugreport and the PR :)
I'm adding a unit test and a couple changes to #34. Can you check if those fix your problem?