kedder / ofxstatement-transferwise

Transferwise plugin for ofxstatement
2 stars 0 forks source link

[bug] decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>] #3

Closed dev590t closed 1 year ago

dev590t commented 1 year ago

description

ofxstatement-transferwise doesn't run:

$ ofxstatement convert -t transferwise dir_csv/transaction-history.csv 2023-07-06.wise.ofx
Traceback (most recent call last):
  File "/home/compta/.venv/bin/ofxstatement", line 8, in <module>
    sys.exit(run())
  File "/home/compta/.venv/lib/python3.9/site-packages/ofxstatement/tool.py", line 205, in run
    return args.func(args)
  File "/home/compta/.venv/lib/python3.9/site-packages/ofxstatement/tool.py", line 176, in convert
    statement = parser.parse()
  File "/home/compta/.venv/lib/python3.9/site-packages/ofxstatement/plugins/transferwise.py", line 42, in parse
    stmt = super().parse()
  File "/home/compta/.venv/lib/python3.9/site-packages/ofxstatement/parser.py", line 46, in parse
    stmt_line = self.parse_record(line)
  File "/home/compta/.venv/lib/python3.9/site-packages/ofxstatement/plugins/transferwise.py", line 54, in parse_record
    sl = super().parse_record(line)
  File "/home/compta/.venv/lib/python3.9/site-packages/ofxstatement/parser.py", line 107, in parse_record
    value = self.parse_value(rawvalue, field)
  File "/home/compta/.venv/lib/python3.9/site-packages/ofxstatement/parser.py", line 68, in parse_value
    return self.parse_decimal(value)
  File "/home/compta/.venv/lib/python3.9/site-packages/ofxstatement/parser.py", line 81, in parse_decimal
    return D(value.replace(",", ".").replace(" ", ""))
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]

reproduce bug

  1. download csv file from wise in dir_csv/transaction-history.csv
  2. configure ofxstatement with:
    [transferwise]
    plugin = transferwise
    currency = EUR
    account = Wise
  3. run:
    ofxstatement convert -t transferwise dir_csv/transaction-history.csv 2023-07-06.wise.ofx
kedder commented 1 year ago

Can you show the first line of the input file? It is expected to be csv in this format:

"TransferWise ID",Date,Amount,Currency,Description,"Payment Reference","Running Balance","Exchange From","Exchange To","Exchange Rate","Payer Name","Payee Name","Payee Account Number",Merchant,"Card Last Four Digits","Card Holder Full Name",Attachment,Note,"Total fees"
dev590t commented 1 year ago

This is the header of the csv:

ID,Status,Direction,"Created on","Finished on","Source fee amount","Source fee currency","Target fee amount","Target fee currency","Source name","Source amount (after fees)","Source currency","Target name","Target amount (after fees)","Target currency","Exchange rate",Reference,Batch

Why we have different csv header? I have downloaded the csv there is few day ago. I thing this csv schema should be updated.

kedder commented 1 year ago

Do you use "Accounting" type of csv export? (the one with fees as separate transactions). If not, could you try that one?

dev590t commented 1 year ago

Thank you, that runs.

I have downloaded the csv of transaction history of the account.

The csv compatible with ofxstatement-transferwise is the one of this page https://wise.com/help/articles/2736049/how-do-i-download-a-statement.