commit c5e2ef6ab27d0d6ffc30108cb767f0d8f8dc10c8
parent e3b4798afb7bbfe69b24f2378e68596cd6be3bb6
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 5 Dec 2025 22:19:54 +0100
largely finish #9917, needs more testing
Diffstat:
6 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/contrib/typst/_cover_.typ b/contrib/typst/_cover_.typ
@@ -227,7 +227,7 @@
if rules.len() > 0 {
block(breakable: true)[
#table(
- columns: (14%, 13%, 13%, 20%, 20%, 10%, 10%),
+ columns: (17%, 13%, 13%, 20%, 17%, 10%, 10%),
stroke: 0.5pt + black,
inset: 4pt,
align: (left, left, left, left, left, center, center),
diff --git a/src/exchange/taler-exchange-httpd_aml-attributes-get.c b/src/exchange/taler-exchange-httpd_aml-attributes-get.c
@@ -25,6 +25,7 @@
#include <pthread.h>
#include "taler/taler_json_lib.h"
#include "taler/taler_mhd_lib.h"
+#include "taler/taler_kyclogic_lib.h"
#include "taler/taler_signatures.h"
#include "taler-exchange-httpd.h"
#include "taler/taler_exchangedb_plugin.h"
@@ -82,6 +83,11 @@ struct ResponseContext
unsigned int http_status;
/**
+ * True if this is for a wallet.
+ */
+ bool is_wallet;
+
+ /**
* Where we store the response data.
*/
union
@@ -431,7 +437,13 @@ build_cover_page (
{
struct ResponseContext *rc = cls;
json_t *cover;
+ json_t *defr = NULL;
+ if (NULL == jnew_rules)
+ {
+ defr = TALER_KYCLOGIC_get_default_legi_rules (rc->is_wallet);
+ jnew_rules = defr;
+ }
cover = GNUNET_JSON_PACK (
GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_object_incref ("properties",
@@ -446,16 +458,14 @@ build_cover_page (
is_active),
GNUNET_JSON_pack_bool ("to_investigate",
to_investigate));
+ if (NULL != defr)
+ json_decref (defr);
/* first page, so we really cannot have hit the maximum yet */
GNUNET_assert (rc->details.pdf.off < MAX_RECORDS);
- {
- GNUNET_break (0);
- return;
- }
rc->details.pdf.jdata[rc->details.pdf.off]
= cover;
rc->details.pdf.docs[rc->details.pdf.off].form_name
- = "_cover_.typst";
+ = "_cover_";
rc->details.pdf.docs[rc->details.pdf.off].data
= rc->details.pdf.jdata[rc->details.pdf.off];
rc->details.pdf.off++;
@@ -532,7 +542,8 @@ TEH_handler_aml_attributes_get (
qs = TEH_plugin->lookup_aml_file_number (TEH_plugin->cls,
&h_payto,
- &file_number);
+ &file_number,
+ &rctx->is_wallet);
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR:
@@ -606,6 +617,8 @@ TEH_handler_aml_attributes_get (
"select_aml_attributes");
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
/* no decision was ever taken, build empty cover page */
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "No decisions taken, creating empty cover page\n");
build_cover_page (rctx,
0,
GNUNET_TIME_UNIT_ZERO_TS,
@@ -676,17 +689,8 @@ TEH_handler_aml_attributes_get (
GNUNET_JSON_pack_array_incref ("details",
rctx->details.json));
case RCF_PDF:
- if (0 == rctx->details.pdf.off)
- {
- /* Note: this case goes away if/when we generate a
- title page about the account in the future */
- return TALER_MHD_reply_static (
- rc->connection,
- MHD_HTTP_NO_CONTENT,
- NULL,
- NULL,
- 0);
- }
+ /* Cover page: off of 0 is impossible */
+ GNUNET_assert (0 != rctx->details.pdf.off);
for (unsigned int i = 0; i<rctx->details.pdf.off; i++)
{
GNUNET_assert (0 ==
diff --git a/src/exchangedb/pg_lookup_aml_file_number.c b/src/exchangedb/pg_lookup_aml_file_number.c
@@ -30,7 +30,8 @@ enum GNUNET_DB_QueryStatus
TEH_PG_lookup_aml_file_number (
void *cls,
const struct TALER_NormalizedPaytoHashP *h_payto,
- uint64_t *kyc_target_row)
+ uint64_t *kyc_target_row,
+ bool *is_wallet)
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
@@ -41,6 +42,9 @@ TEH_PG_lookup_aml_file_number (
GNUNET_PQ_result_spec_uint64 (
"kyc_target_serial_id",
kyc_target_row),
+ GNUNET_PQ_result_spec_bool (
+ "is_wallet",
+ is_wallet),
GNUNET_PQ_result_spec_end
};
@@ -48,6 +52,7 @@ TEH_PG_lookup_aml_file_number (
"lookup_aml_file_number",
"SELECT "
" kyc_target_serial_id"
+ ",is_wallet"
" FROM kyc_targets"
" WHERE h_normalized_payto=$1");
return GNUNET_PQ_eval_prepared_singleton_select (
diff --git a/src/exchangedb/pg_lookup_aml_file_number.h b/src/exchangedb/pg_lookup_aml_file_number.h
@@ -32,13 +32,15 @@
* @param cls closure
* @param h_payto account for which to find the row ID
* @param[out] kyc_target_row set to row in the kyc_targets table for @a h_payto
+ * @param[out] is_wallet set to true if this account is for a wallet
* @return database transaction status
*/
enum GNUNET_DB_QueryStatus
TEH_PG_lookup_aml_file_number (
void *cls,
const struct TALER_NormalizedPaytoHashP *h_payto,
- uint64_t *kyc_target_row);
+ uint64_t *kyc_target_row,
+ bool *is_wallet);
#endif
diff --git a/src/exchangedb/pg_lookup_aml_history.c b/src/exchangedb/pg_lookup_aml_history.c
@@ -168,7 +168,7 @@ TEH_PG_lookup_aml_history (
" ORDER BY outcome_serial_id DESC"
" LIMIT $3;");
PREPARE (pg,
- "lookup_aml_history_desc",
+ "lookup_aml_history_asc",
"SELECT"
" lo.decision_time"
",lo.outcome_serial_id"
diff --git a/src/include/taler/taler_exchangedb_plugin.h b/src/include/taler/taler_exchangedb_plugin.h
@@ -8197,13 +8197,15 @@ struct TALER_EXCHANGEDB_Plugin
* @param cls closure
* @param h_payto account for which to find the row ID
* @param[out] kyw_target_row set to row in the kyc_targets table for @a h_payto
+ * @param[out] is_wallet set to true if this account is for a wallet
* @return database transaction status
*/
enum GNUNET_DB_QueryStatus
(*lookup_aml_file_number) (
void *cls,
const struct TALER_NormalizedPaytoHashP *h_payto,
- uint64_t *kyc_target_row);
+ uint64_t *kyc_target_row,
+ bool *is_wallet);
};