commit a1e12a191ce5327b6e317889a1cd1087fcc772ca
parent c64322d5f5bcede4997787a5d1cb0aabd3053f39
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 21 Apr 2025 21:16:24 +0200
implement spec change from taler-docs.git::bb475832..352c11eb aadding an 'is_wallet' to the AML /decisions response
Diffstat:
5 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_aml-decisions-get.c b/src/exchange/taler-exchange-httpd_aml-decisions-get.c
@@ -49,6 +49,7 @@
* NULL if no properties were set
* @param to_investigate true if AML staff should look at the account
* @param is_active true if this is the currently active decision about the account
+ * @param is_wallet true if the @a h_payto is for a wallet
* @param account_rules current active rules for the account
*/
static void
@@ -62,6 +63,7 @@ record_cb (
const json_t *jproperties,
bool to_investigate,
bool is_active,
+ bool is_wallet,
const json_t *account_rules)
{
json_t *records = cls;
@@ -73,6 +75,8 @@ record_cb (
GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("h_payto",
h_payto),
+ GNUNET_JSON_pack_bool ("is_wallet",
+ is_wallet),
GNUNET_JSON_pack_int64 ("rowid",
row_id),
GNUNET_JSON_pack_allow_null (
diff --git a/src/exchangedb/pg_select_aml_decisions.c b/src/exchangedb/pg_select_aml_decisions.c
@@ -77,6 +77,7 @@ handle_aml_result (void *cls,
struct GNUNET_TIME_Timestamp decision_time;
struct GNUNET_TIME_Absolute expiration_time;
json_t *jproperties = NULL;
+ char *payto;
bool to_investigate;
bool is_active;
json_t *account_rules;
@@ -85,6 +86,8 @@ handle_aml_result (void *cls,
&rowid),
GNUNET_PQ_result_spec_auto_from_type ("h_payto",
&h_payto),
+ GNUNET_PQ_result_spec_string ("payto",
+ &payto),
GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_string ("justification",
&justification),
@@ -117,6 +120,7 @@ handle_aml_result (void *cls,
}
if (GNUNET_TIME_absolute_is_past (expiration_time))
is_active = false;
+
ctx->cb (ctx->cb_cls,
rowid,
justification,
@@ -126,6 +130,7 @@ handle_aml_result (void *cls,
jproperties,
to_investigate,
is_active,
+ TALER_payto_is_wallet (payto),
account_rules);
GNUNET_PQ_cleanup_result (rs);
}
@@ -185,7 +190,10 @@ TEH_PG_select_aml_decisions (
",lo.to_investigate"
",lo.is_active"
",lo.jnew_rules"
+ ",wt.payto_uri"
" FROM legitimization_outcomes lo"
+ " JOIN wire_targets wt"
+ " ON (lo.h_payto = wt.h_normalized_payto)"
" LEFT JOIN aml_history ah"
" USING (outcome_serial_id)"
" WHERE (outcome_serial_id > $7)"
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
@@ -3804,6 +3804,7 @@ typedef void
* NULL if no properties were set
* @param to_investigate true if AML staff should look at the account
* @param is_active true if this is the currently active decision about the account
+ * @param is_wallet true if the @a h_payto is for a Taler wallet
* @param account_rules current active rules for the account
*/
typedef void
@@ -3817,6 +3818,7 @@ typedef void
const json_t *jproperties,
bool to_investigate,
bool is_active,
+ bool is_wallet,
const json_t *account_rules);
diff --git a/src/include/taler_util.h b/src/include/taler_util.h
@@ -419,6 +419,16 @@ TALER_normalized_payto_cmp (const struct TALER_NormalizedPayto a,
/**
+ * Check if payto URI identifies a Taler wallet.
+ *
+ * @param payto_uri (full or normalized) to check
+ * @return true if the payto URI is for a wallet
+ */
+bool
+TALER_payto_is_wallet (const char *payto_uri);
+
+
+/**
* Test if the URL is a valid "http" (or "https")
* URL (includes test for #TALER_url_valid_charset()).
*
diff --git a/src/util/payto.c b/src/util/payto.c
@@ -44,6 +44,15 @@ TALER_full_payto_cmp (const struct TALER_FullPayto a,
}
+bool
+TALER_payto_is_wallet (const char *payto_uri)
+{
+ return (0 == strncasecmp (payto_uri,
+ "taler://taler-reserve/",
+ strlen ("taler://taler-reserve/")));
+}
+
+
int
TALER_normalized_payto_cmp (const struct TALER_NormalizedPayto a,
const struct TALER_NormalizedPayto b)