Hi everyone,

Short version: How does one handle reverted transactions?  They have their 
own line in my CSV, listing -2 CHF, but the status is REVERTED.

Longer version, to potentially avoid an XY problem:

I'm very new to beancount and set about writing an importer for Revolut 
based on beangulp's csvbase (which IIUC is the newer way to do it).  I 
found an older thread 
<https://groups.google.com/g/beancount/c/NnRK0Pow31Y/m/vKp108RxBQAJ> on the 
list, but it seems that the csv header has changed since then, and it uses 
the older beancount.ingest.  I also like building things on my own, I 
suppose that's no surprise around here :)

I got the basics working, but I wonder how to handle reverted 
transactions.  Google is not super helpful, so maybe Revolut is using the 
wrong word for this, but AFAICT it's tiny transactions that merchants do to 
figure out the card is legit:

Type,Product,Started Date,Completed 
Date,Description,Amount,Fee,Currency,State,Balance
CARD_PAYMENT,Current,2023-09-09 20:35:29,,Google,-2.00,0.00,CHF,REVERTED,

I have a few ideas, but I wonder if this isn't already a solved problem:

1. Use `grep -v` (or awk, if we're being extra careful) to filter out these 
lines prior to importing.  But I'd like to see if I can do this entirely 
with beancount

2. Override `finalize`, check the `State` column, and add a posting of 
(-value) to reverted transactions.  This works, but I don't like that it 
pollutes the ledger.  I also don't like that these reverted lines have an 
empty `Balance` cell, which means I can't use csvbase's nifty automatic 
balance handling.

3. Is it possible to add a `skip_line` customization point to the csvbase 
importer?  This would allow configuring my importer to skip reverted lines, 
while keeping the balance handling (because lines will be skipped before 
attempting to fetch the balance column).  If you think that's a sensible 
approach I'm happy to take a stab at contributing a patch.

Thanks in advance,
Vlad

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/3e8a1f74-9eec-4e58-895d-e1ac3ae92316n%40googlegroups.com.

Reply via email to