merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit aefaa46df3e5ee4fca6adf8ed84a6d0a78533bdb
parent 6ce847234912a312a5c2dab5ee1d8adddcde45d1
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 26 Dec 2025 18:25:59 +0100

implement select_money_pot

Diffstat:
Msrc/backenddb/pg_select_money_pot.c | 34++++++++++++++++++++++++++++++++++
Msrc/backenddb/pg_select_report.c | 2+-
2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/backenddb/pg_select_money_pot.c b/src/backenddb/pg_select_money_pot.c @@ -25,6 +25,7 @@ #include "pg_select_money_pot.h" #include "pg_helper.h" + enum GNUNET_DB_QueryStatus TMH_PG_select_money_pot (void *cls, const char *instance_id, @@ -33,4 +34,37 @@ TMH_PG_select_money_pot (void *cls, char **description, struct TALER_Amount *pot_total) { + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_string (instance_id), + GNUNET_PQ_query_param_uint64 (&money_pot_id), + GNUNET_PQ_query_param_end + }; + struct GNUNET_PQ_ResultSpec rs[] = { + GNUNET_PQ_result_spec_string ("money_pot_name", + name), + GNUNET_PQ_result_spec_string ("money_pot_description", + description), + TALER_PQ_result_spec_amount_with_currency ("pot_total", + pot_total), + GNUNET_PQ_result_spec_end + }; + + check_connection (pg); + PREPARE (pg, + "select_money_pot", + "SELECT" + " mp.money_pot_name" + " ,mp.money_pot_description" + " ,mp.pot_total" + " FROM merchant_money_pots mp" + " JOIN merchant_instances mi" + " USING (merchant_serial)" + " WHERE merchant_id=$1" + " AND report_serial=$2;"); + return GNUNET_PQ_eval_prepared_singleton_select ( + pg->conn, + "select_money_pot", + params, + rs); } diff --git a/src/backenddb/pg_select_report.c b/src/backenddb/pg_select_report.c @@ -80,7 +80,7 @@ TMH_PG_select_report (void *cls, code = TALER_EC_NONE; check_connection (pg); PREPARE (pg, - "lookup_reports_pending", + "select_reports", "SELECT" " mr.report_program_section" " ,mr.report_description"