diff options
Diffstat (limited to 'src/exchangedb/pg_get_wire_accounts.c')
-rw-r--r-- | src/exchangedb/pg_get_wire_accounts.c | 66 |
1 files changed, 53 insertions, 13 deletions
diff --git a/src/exchangedb/pg_get_wire_accounts.c b/src/exchangedb/pg_get_wire_accounts.c index 6986eaef2..9770be719 100644 --- a/src/exchangedb/pg_get_wire_accounts.c +++ b/src/exchangedb/pg_get_wire_accounts.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2022 Taler Systems SA + Copyright (C) 2022, 2024 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -66,10 +66,33 @@ get_wire_accounts_cb (void *cls, for (unsigned int i = 0; i < num_results; i++) { char *payto_uri; + char *conversion_url = NULL; + json_t *debit_restrictions = NULL; + json_t *credit_restrictions = NULL; struct TALER_MasterSignatureP master_sig; + char *bank_label = NULL; + int64_t priority; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_string ("payto_uri", &payto_uri), + GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_string ("conversion_url", + &conversion_url), + NULL), + GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_string ("bank_label", + &bank_label), + NULL), + GNUNET_PQ_result_spec_int64 ("priority", + &priority), + GNUNET_PQ_result_spec_allow_null ( + TALER_PQ_result_spec_json ("debit_restrictions", + &debit_restrictions), + NULL), + GNUNET_PQ_result_spec_allow_null ( + TALER_PQ_result_spec_json ("credit_restrictions", + &credit_restrictions), + NULL), GNUNET_PQ_result_spec_auto_from_type ("master_sig", &master_sig), GNUNET_PQ_result_spec_end @@ -84,20 +107,33 @@ get_wire_accounts_cb (void *cls, ctx->status = GNUNET_SYSERR; return; } + if (NULL == debit_restrictions) + { + debit_restrictions = json_array (); + GNUNET_assert (NULL != debit_restrictions); + } + if (NULL == credit_restrictions) + { + credit_restrictions = json_array (); + GNUNET_assert (NULL != credit_restrictions); + } ctx->cb (ctx->cb_cls, payto_uri, - &master_sig); + conversion_url, + debit_restrictions, + credit_restrictions, + &master_sig, + bank_label, + priority); GNUNET_PQ_cleanup_result (rs); } } - - enum GNUNET_DB_QueryStatus TEH_PG_get_wire_accounts (void *cls, - TALER_EXCHANGEDB_WireAccountCallback cb, - void *cb_cls) + TALER_EXCHANGEDB_WireAccountCallback cb, + void *cb_cls) { struct PostgresClosure *pg = cls; struct GetWireAccountsContext ctx = { @@ -111,12 +147,17 @@ TEH_PG_get_wire_accounts (void *cls, enum GNUNET_DB_QueryStatus qs; PREPARE (pg, - "get_wire_accounts", - "SELECT" - " payto_uri" - ",master_sig" - " FROM wire_accounts" - " WHERE is_active"); + "get_wire_accounts", + "SELECT" + " payto_uri" + ",conversion_url" + ",debit_restrictions" + ",credit_restrictions" + ",master_sig" + ",bank_label" + ",priority" + " FROM wire_accounts" + " WHERE is_active"); qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, "get_wire_accounts", params, @@ -125,5 +166,4 @@ TEH_PG_get_wire_accounts (void *cls, if (GNUNET_OK != ctx.status) return GNUNET_DB_STATUS_HARD_ERROR; return qs; - } |