diff options
author | Rutger Broekhoff | 2025-08-26 00:35:27 +0200 |
---|---|---|
committer | Rutger Broekhoff | 2025-08-26 00:35:27 +0200 |
commit | e6873458facadea0dfb228bb33291d6baf68c427 (patch) | |
tree | 9ca19e2bbb12d92447f654a92280a6048383ebba /lib/convert.ml | |
parent | b8fbaa53b912347b3b50cac3e913a142db460b0a (diff) | |
download | rdcapsis-e6873458facadea0dfb228bb33291d6baf68c427.tar.gz rdcapsis-e6873458facadea0dfb228bb33291d6baf68c427.zip |
Basic import seems to be working
Diffstat (limited to 'lib/convert.ml')
-rw-r--r-- | lib/convert.ml | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/convert.ml b/lib/convert.ml index cbdb90f..fb41020 100644 --- a/lib/convert.ml +++ b/lib/convert.ml | |||
@@ -1,5 +1,6 @@ | |||
1 | open Core | 1 | open Core |
2 | open Ledger | 2 | open Ledger |
3 | open Result.Let_syntax | ||
3 | 4 | ||
4 | let virt_checking_acc = [ "Unfiled"; "Checking" ] | 5 | let virt_checking_acc = [ "Unfiled"; "Checking" ] |
5 | let virt_savings_acc = [ "Unfiled"; "Savings" ] | 6 | let virt_savings_acc = [ "Unfiled"; "Savings" ] |
@@ -162,3 +163,15 @@ let tx_from_current_acc euc_id (Ingcsv.Tx (base, spec)) = | |||
162 | details.counterparty_name | 163 | details.counterparty_name |
163 | |> add (String_label Desc_tag) details.description | 164 | |> add (String_label Desc_tag) details.description |
164 | |> add (String_label Reference_tag) details.reference) | 165 | |> add (String_label Reference_tag) details.reference) |
166 | |||
167 | let ba_from_current_acc (Ingcsv.Tx (base, _)) = | ||
168 | { | ||
169 | account = virt_checking_acc; | ||
170 | amount = Money.of_z base.resulting_balance; | ||
171 | labels = Labels.(empty |> add (Iban_label Account_tag) base.account); | ||
172 | } | ||
173 | |||
174 | let les_from_current_acc euc_id tx = | ||
175 | let%map tx' = tx_from_current_acc euc_id tx in | ||
176 | let ba = ba_from_current_acc tx in | ||
177 | [ Bal_assert_item ba; Tx_item tx' ] | ||