[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[exchange] branch master updated: implement per account (h_payto) filter
From: |
Admin |
Subject: |
[exchange] branch master updated: implement per account (h_payto) filter for GET /aml/*/transfer-* endpoints (for #10031) |
Date: |
Thu, 12 Jun 2025 09:39:57 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new 1c53b0276 implement per account (h_payto) filter for GET
/aml/*/transfer-* endpoints (for #10031)
1c53b0276 is described below
commit 1c53b027665639f3d6cde4edb0e76472040d1a3c
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Jun 12 09:39:45 2025 +0200
implement per account (h_payto) filter for GET /aml/*/transfer-* endpoints
(for #10031)
---
src/exchange/taler-exchange-httpd_aml-transfer-get.c | 9 +++++++++
src/exchangedb/pg_select_exchange_credit_transfers.c | 6 ++++++
src/exchangedb/pg_select_exchange_credit_transfers.h | 2 ++
src/exchangedb/pg_select_exchange_debit_transfers.c | 6 ++++++
src/exchangedb/pg_select_exchange_debit_transfers.h | 2 ++
src/exchangedb/pg_select_exchange_kycauth_transfers.c | 6 ++++++
src/exchangedb/pg_select_exchange_kycauth_transfers.h | 2 ++
src/include/taler_exchangedb_plugin.h | 6 ++++++
8 files changed, 39 insertions(+)
diff --git a/src/exchange/taler-exchange-httpd_aml-transfer-get.c
b/src/exchange/taler-exchange-httpd_aml-transfer-get.c
index 6735e0cc6..ccd8727b9 100644
--- a/src/exchange/taler-exchange-httpd_aml-transfer-get.c
+++ b/src/exchange/taler-exchange-httpd_aml-transfer-get.c
@@ -101,6 +101,8 @@ aml_transfer_get (
int64_t limit = -20;
uint64_t offset;
struct TALER_Amount threshold;
+ struct TALER_NormalizedPaytoHashP h_payto;
+ bool have_payto = false;
if (NULL != args[0])
{
@@ -111,6 +113,10 @@ aml_transfer_get (
TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
args[0]);
}
+ TALER_MHD_parse_request_arg_auto (rc->connection,
+ "h_payto",
+ &h_payto,
+ have_payto);
TALER_MHD_parse_request_snumber (rc->connection,
"limit",
&limit);
@@ -151,6 +157,7 @@ aml_transfer_get (
&threshold,
offset,
limit,
+ have_payto ? &h_payto : NULL,
&record_cb,
transfers);
query = "select_exchange_debit_transfers";
@@ -161,6 +168,7 @@ aml_transfer_get (
&threshold,
offset,
limit,
+ have_payto ? &h_payto : NULL,
&record_cb,
transfers);
query = "select_exchange_credit_transfers";
@@ -171,6 +179,7 @@ aml_transfer_get (
&threshold,
offset,
limit,
+ have_payto ? &h_payto : NULL,
&record_cb,
transfers);
query = "select_exchange_kycauth_transfers";
diff --git a/src/exchangedb/pg_select_exchange_credit_transfers.c
b/src/exchangedb/pg_select_exchange_credit_transfers.c
index 295ebd6e6..23c48acc9 100644
--- a/src/exchangedb/pg_select_exchange_credit_transfers.c
+++ b/src/exchangedb/pg_select_exchange_credit_transfers.c
@@ -112,6 +112,7 @@ TEH_PG_select_exchange_credit_transfers (
const struct TALER_Amount *threshold,
uint64_t offset,
int64_t limit,
+ const struct TALER_NormalizedPaytoHashP *h_payto,
TALER_EXCHANGEDB_AmlTransferCallback cb,
void *cb_cls)
{
@@ -128,6 +129,9 @@ TEH_PG_select_exchange_credit_transfers (
GNUNET_PQ_query_param_uint64 (&ulimit),
TALER_PQ_query_param_amount (pg->conn,
threshold),
+ NULL != h_payto
+ ? GNUNET_PQ_query_param_auto_from_type (h_payto)
+ : GNUNET_PQ_query_param_null (),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
@@ -143,6 +147,7 @@ TEH_PG_select_exchange_credit_transfers (
" LEFT JOIN wire_targets wt"
" ON (ri.wire_source_h_payto = wt.wire_target_h_payto)"
" WHERE (ri.reserve_in_serial_id > $1)"
+ " AND ( ($4::BYTEA IS NULL) OR (wt.h_normalized_payto=$4) )"
" AND ( ( (ri.credit).val > ($3::taler_amount).val)"
" OR ( ( (ri.credit).val >= ($3::taler_amount).val)"
" AND ( (ri.credit).frac >= ($3::taler_amount).frac) ) )"
@@ -159,6 +164,7 @@ TEH_PG_select_exchange_credit_transfers (
" LEFT JOIN wire_targets wt"
" ON (ri.wire_source_h_payto = wt.wire_target_h_payto)"
" WHERE (ri.reserve_in_serial_id < $1)"
+ " AND ( ($4::BYTEA IS NULL) OR (wt.h_normalized_payto=$4) )"
" AND ( ( (ri.credit).val > ($3::taler_amount).val)"
" OR ( ( (ri.credit).val >= ($3::taler_amount).val)"
" AND ( (ri.credit).frac >= ($3::taler_amount).frac) ) )"
diff --git a/src/exchangedb/pg_select_exchange_credit_transfers.h
b/src/exchangedb/pg_select_exchange_credit_transfers.h
index 923b74e3c..66c4cfd91 100644
--- a/src/exchangedb/pg_select_exchange_credit_transfers.h
+++ b/src/exchangedb/pg_select_exchange_credit_transfers.h
@@ -33,6 +33,7 @@
* @param threshold minimum wire amount to return data for
* @param offset offset in table to filter by
* @param limit maximum number of entries to return, negative for descending
+ * @param h_payto account to filter transfer data by
* @param cb function to call on each result
* @param cb_cls closure to pass to @a cb
* @return transaction status
@@ -43,6 +44,7 @@ TEH_PG_select_exchange_credit_transfers (
const struct TALER_Amount *threshold,
uint64_t offset,
int64_t limit,
+ const struct TALER_NormalizedPaytoHashP *h_payto,
TALER_EXCHANGEDB_AmlTransferCallback cb,
void *cb_cls);
diff --git a/src/exchangedb/pg_select_exchange_debit_transfers.c
b/src/exchangedb/pg_select_exchange_debit_transfers.c
index 3cf07e4a2..9ac9574fd 100644
--- a/src/exchangedb/pg_select_exchange_debit_transfers.c
+++ b/src/exchangedb/pg_select_exchange_debit_transfers.c
@@ -113,6 +113,7 @@ TEH_PG_select_exchange_debit_transfers (
const struct TALER_Amount *threshold,
uint64_t offset,
int64_t limit,
+ const struct TALER_NormalizedPaytoHashP *h_payto,
TALER_EXCHANGEDB_AmlTransferCallback cb,
void *cb_cls)
{
@@ -129,6 +130,9 @@ TEH_PG_select_exchange_debit_transfers (
GNUNET_PQ_query_param_uint64 (&ulimit),
TALER_PQ_query_param_amount (pg->conn,
threshold),
+ NULL != h_payto
+ ? GNUNET_PQ_query_param_auto_from_type (h_payto)
+ : GNUNET_PQ_query_param_null (),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
@@ -144,6 +148,7 @@ TEH_PG_select_exchange_debit_transfers (
" LEFT JOIN wire_targets wt"
" USING (wire_target_h_payto)"
" WHERE (wo.wireout_uuid > $1)"
+ " AND ( ($4::BYTEA IS NULL) OR (wt.h_normalized_payto=$4) )"
" AND ( ( (wo.amount).val > ($3::taler_amount).val)"
" OR ( ( (wo.amount).val >= ($3::taler_amount).val)"
" AND ( (wo.amount).frac >= ($3::taler_amount).frac) ) )"
@@ -160,6 +165,7 @@ TEH_PG_select_exchange_debit_transfers (
" LEFT JOIN wire_targets wt"
" USING (wire_target_h_payto)"
" WHERE (wo.wireout_uuid < $1)"
+ " AND ( ($4::BYTEA IS NULL) OR (wt.h_normalized_payto=$4) )"
" AND ( ( (wo.amount).val > ($3::taler_amount).val)"
" OR ( ( (wo.amount).val >= ($3::taler_amount).val)"
" AND ( (wo.amount).frac >= ($3::taler_amount).frac) ) )"
diff --git a/src/exchangedb/pg_select_exchange_debit_transfers.h
b/src/exchangedb/pg_select_exchange_debit_transfers.h
index f0705e492..612ffb7f7 100644
--- a/src/exchangedb/pg_select_exchange_debit_transfers.h
+++ b/src/exchangedb/pg_select_exchange_debit_transfers.h
@@ -32,6 +32,7 @@
* @param threshold minimum wire amount to return data for
* @param offset offset in table to filter by
* @param limit maximum number of entries to return, negative for descending
+ * @param h_payto account to filter transfer data by
* @param cb function to call on each result
* @param cb_cls closure to pass to @a cb
* @return transaction status
@@ -42,6 +43,7 @@ TEH_PG_select_exchange_debit_transfers (
const struct TALER_Amount *threshold,
uint64_t offset,
int64_t limit,
+ const struct TALER_NormalizedPaytoHashP *h_payto,
TALER_EXCHANGEDB_AmlTransferCallback cb,
void *cb_cls);
diff --git a/src/exchangedb/pg_select_exchange_kycauth_transfers.c
b/src/exchangedb/pg_select_exchange_kycauth_transfers.c
index de7ed59dd..066251dd8 100644
--- a/src/exchangedb/pg_select_exchange_kycauth_transfers.c
+++ b/src/exchangedb/pg_select_exchange_kycauth_transfers.c
@@ -112,6 +112,7 @@ TEH_PG_select_exchange_kycauth_transfers (
const struct TALER_Amount *threshold,
uint64_t offset,
int64_t limit,
+ const struct TALER_NormalizedPaytoHashP *h_payto,
TALER_EXCHANGEDB_AmlTransferCallback cb,
void *cb_cls)
{
@@ -128,6 +129,9 @@ TEH_PG_select_exchange_kycauth_transfers (
GNUNET_PQ_query_param_uint64 (&ulimit),
TALER_PQ_query_param_amount (pg->conn,
threshold),
+ NULL != h_payto
+ ? GNUNET_PQ_query_param_auto_from_type (h_payto)
+ : GNUNET_PQ_query_param_null (),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
@@ -143,6 +147,7 @@ TEH_PG_select_exchange_kycauth_transfers (
" LEFT JOIN wire_targets wt"
" ON (ki.wire_source_h_payto = wt.wire_target_h_payto)"
" WHERE (ki.reserve_in_serial_id > $1)"
+ " AND ( ($4::BYTEA IS NULL) OR (wt.h_normalized_payto=$4) )"
" AND ( ( (ki.credit).val > ($3::taler_amount).val)"
" OR ( ( (ki.credit).val >= ($3::taler_amount).val)"
" AND ( (ki.credit).frac >= ($3::taler_amount).frac) ) )"
@@ -159,6 +164,7 @@ TEH_PG_select_exchange_kycauth_transfers (
" LEFT JOIN wire_targets wt"
" ON (ki.wire_source_h_payto = wt.wire_target_h_payto)"
" WHERE (ki.kycauth_in_serial_id < $1)"
+ " AND ( ($4::BYTEA IS NULL) OR (wt.h_normalized_payto=$4) )"
" AND ( ( (ki.credit).val > ($3::taler_amount).val)"
" OR ( ( (ki.credit).val >= ($3::taler_amount).val)"
" AND ( (ki.credit).frac >= ($3::taler_amount).frac) ) )"
diff --git a/src/exchangedb/pg_select_exchange_kycauth_transfers.h
b/src/exchangedb/pg_select_exchange_kycauth_transfers.h
index ed98be71a..b1fcdeabc 100644
--- a/src/exchangedb/pg_select_exchange_kycauth_transfers.h
+++ b/src/exchangedb/pg_select_exchange_kycauth_transfers.h
@@ -33,6 +33,7 @@
* @param threshold minimum wire amount to return data for
* @param offset offset in table to filter by
* @param limit maximum number of entries to return, negative for descending
+ * @param h_payto account to filter transfer data by
* @param cb function to call on each result
* @param cb_cls closure to pass to @a cb
* @return transaction status
@@ -43,6 +44,7 @@ TEH_PG_select_exchange_kycauth_transfers (
const struct TALER_Amount *threshold,
uint64_t offset,
int64_t limit,
+ const struct TALER_NormalizedPaytoHashP *h_payto,
TALER_EXCHANGEDB_AmlTransferCallback cb,
void *cb_cls);
diff --git a/src/include/taler_exchangedb_plugin.h
b/src/include/taler_exchangedb_plugin.h
index 8c9333e82..12dd1bb78 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -8012,6 +8012,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param threshold minimum wire amount to return data for
* @param offset offset in table to filter by
* @param limit maximum number of entries to return, negative for descending
+ * @param h_payto account to filter transfer data by
* @param cb function to call on each result
* @param cb_cls closure to pass to @a cb
* @return transaction status
@@ -8022,6 +8023,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_Amount *threshold,
uint64_t offset,
int64_t limit,
+ const struct TALER_NormalizedPaytoHashP *h_payto,
TALER_EXCHANGEDB_AmlTransferCallback cb,
void *cb_cls);
@@ -8033,6 +8035,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param threshold minimum wire amount to return data for
* @param offset offset in table to filter by
* @param limit maximum number of entries to return, negative for descending
+ * @param h_payto account to filter transfer data by
* @param cb function to call on each result
* @param cb_cls closure to pass to @a cb
* @return transaction status
@@ -8043,6 +8046,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_Amount *threshold,
uint64_t offset,
int64_t limit,
+ const struct TALER_NormalizedPaytoHashP *h_payto,
TALER_EXCHANGEDB_AmlTransferCallback cb,
void *cb_cls);
@@ -8054,6 +8058,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param threshold minimum wire amount to return data for
* @param offset offset in table to filter by
* @param limit maximum number of entries to return, negative for descending
+ * @param h_payto account to filter transfer data by
* @param cb function to call on each result
* @param cb_cls closure to pass to @a cb
* @return transaction status
@@ -8064,6 +8069,7 @@ struct TALER_EXCHANGEDB_Plugin
const struct TALER_Amount *threshold,
uint64_t offset,
int64_t limit,
+ const struct TALER_NormalizedPaytoHashP *h_payto,
TALER_EXCHANGEDB_AmlTransferCallback cb,
void *cb_cls);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [exchange] branch master updated: implement per account (h_payto) filter for GET /aml/*/transfer-* endpoints (for #10031),
Admin <=