This commit is contained in:
swrup 2025-12-11 09:20:32 +01:00
parent 201382ee88
commit b9f9547316
4 changed files with 64 additions and 2 deletions

View file

@ -5,7 +5,9 @@
need to add boilerplate in each query for amounts
GNU Taler db-events?
it seems caqti/pgx does not support it *)
it seems caqti/pgx does not support it
transaction *)
module type CONN = Caqti_miou.CONNECTION
@ -406,3 +408,24 @@ let disable_wire =
in
fun (module Conn : CONN) ~payto_uri ~validity_end ->
Conn.exec disable_wire (payto_uri, validity_end)
let insert_drain_profit =
let insert_drain_profit =
let master_sig = Bin_sig.MasterDrainProfit.caqti in
Caqti_type.(t6 string string payto_uri time amount master_sig ->. unit)
"INSERT INTO profit_drains (wtid, account_section, payto_uri, \
trigger_date, amount, master_sig) VALUES ($1, $2, $3, $4, ($5,$6), $7)"
in
fun (module Conn : CONN)
Api.DrainProfitsMessage.
{
debit_account_section;
credit_payto_uri;
wtid;
master_sig;
date;
amount;
}
->
Conn.exec insert_drain_profit
(wtid, debit_account_section, credit_payto_uri, date, amount, master_sig)