merchant

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

commit 6f607ef343c0af08ccc6e6fbec1afc26e5446f85
parent 40fcdf6f9e74989fa02889d4a8047816903784bd
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 27 Feb 2026 18:05:26 +0100

implement #11124 returning expected_transfer_serial_id from GET /private/transfers

Diffstat:
Msrc/backend/taler-merchant-httpd_private-get-transfers.c | 8++++++++
Msrc/backenddb/pg_lookup_transfers.c | 12++++++++++++
Msrc/backenddb/test_merchantdb.c | 7++++---
Msrc/include/taler_merchantdb_plugin.h | 9+++++----
4 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-get-transfers.c b/src/backend/taler-merchant-httpd_private-get-transfers.c @@ -35,6 +35,7 @@ * @param payto_uri target account that received the wire transfer * @param exchange_url base URL of the exchange that made the wire transfer * @param transfer_serial_id serial number identifying the transfer in the backend + * @param expected_transfer_serial_id serial number identifying the expected transfer in the backend, 0 if not @a expected * @param execution_time when did the exchange make the transfer, #GNUNET_TIME_UNIT_FOREVER_ABS * if it did not yet happen * @param expected true if the merchant acknowledged the wire transfer reception @@ -46,6 +47,7 @@ transfer_cb (void *cls, struct TALER_FullPayto payto_uri, const char *exchange_url, uint64_t transfer_serial_id, + uint64_t expected_transfer_serial_id, struct GNUNET_TIME_Absolute execution_time, bool expected) { @@ -63,6 +65,12 @@ transfer_cb (void *cls, exchange_url), GNUNET_JSON_pack_uint64 ("transfer_serial_id", transfer_serial_id), + (0 == expected_transfer_serial_id) + ? GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_string ("dummy", + NULL)) + : GNUNET_JSON_pack_uint64 ("expected_transfer_serial_id", + expected_transfer_serial_id), // FIXME: protocol breaking to remove... GNUNET_JSON_pack_bool ("verified", false), diff --git a/src/backenddb/pg_lookup_transfers.c b/src/backenddb/pg_lookup_transfers.c @@ -76,6 +76,7 @@ lookup_transfers_cb (void *cls, struct TALER_FullPayto payto_uri; char *exchange_url; uint64_t transfer_serial_id; + uint64_t expected_transfer_serial_id = 0; struct GNUNET_TIME_Absolute execution_time; bool expected; struct GNUNET_PQ_ResultSpec rs[] = { @@ -89,6 +90,10 @@ lookup_transfers_cb (void *cls, &exchange_url), GNUNET_PQ_result_spec_uint64 ("credit_serial", &transfer_serial_id), + GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_uint64 ("expected_credit_serial", + &expected_transfer_serial_id), + NULL), GNUNET_PQ_result_spec_absolute_time ("execution_time", &execution_time), GNUNET_PQ_result_spec_bool ("expected", @@ -111,6 +116,7 @@ lookup_transfers_cb (void *cls, payto_uri, exchange_url, transfer_serial_id, + expected_transfer_serial_id, execution_time, expected); GNUNET_PQ_cleanup_result (rs); @@ -168,9 +174,15 @@ TMH_PG_lookup_transfers (void *cls, ",mt.credit_serial" ",mt.execution_time" ",mt.expected" + ",met.expected_credit_serial" " FROM merchant_transfers mt" " JOIN merchant_accounts mac" " USING (account_serial)" + " LEFT JOIN merchant_expected_transfers met" + " ON mt.wtid = met.wtid" + " AND mt.account_serial = met.account_serial" + " AND mt.exchange_url = met.exchange_url" + " AND mt.expected" " WHERE ( $7 OR " " (mt.execution_time < $2 AND" " mt.execution_time >= $3) )" diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c @@ -4066,10 +4066,10 @@ struct TestLookupTransfers_Closure * @param payto_uri target account that received the wire transfer * @param exchange_url base URL of the exchange that made the wire transfer * @param transfer_serial_id serial number identifying the transfer in the backend + * @param expected_transfer_serial_id serial number identifying the expected transfer in the backend, 0 if not @a expected * @param execution_time when did the exchange make the transfer, #GNUNET_TIME_UNIT_FOREVER_TS * if it did not yet happen - * @param confirmed true if the merchant confirmed this wire transfer - * false if it is so far only claimed to have been made by the exchange + * @param expected true if the merchant acknowledged the wire transfer reception */ static void lookup_transfers_cb (void *cls, @@ -4078,8 +4078,9 @@ lookup_transfers_cb (void *cls, struct TALER_FullPayto payto_uri, const char *exchange_url, uint64_t transfer_serial_id, + uint64_t expected_transfer_serial_id, struct GNUNET_TIME_Absolute execution_time, - bool confirmed) + bool expected) { struct TestLookupTransfers_Closure *cmp = cls; if (NULL == cmp) diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h @@ -1340,11 +1340,11 @@ typedef void * @param wtid wire transfer identifier * @param payto_uri target account that received the wire transfer * @param exchange_url base URL of the exchange that made the wire transfer - * @param expected_transfer_serial_id serial number identifying the expected transfer in the backend + * @param transfer_serial_id serial number identifying the transfer in the backend + * @param expected_transfer_serial_id serial number identifying the expected transfer in the backend, 0 if not @a expected * @param execution_time when did the exchange make the transfer, #GNUNET_TIME_UNIT_FOREVER_ABS * if it did not yet happen - * @param confirmed true if the merchant confirmed this wire transfer - * false if it is so far only claimed to have been made by the exchange + * @param expected true if the merchant acknowledged the wire transfer reception */ typedef void (*TALER_MERCHANTDB_TransferCallback)( @@ -1353,9 +1353,10 @@ typedef void const struct TALER_WireTransferIdentifierRawP *wtid, struct TALER_FullPayto payto_uri, const char *exchange_url, + uint64_t transfer_serial_id, uint64_t expected_transfer_serial_id, struct GNUNET_TIME_Absolute execution_time, - bool confirmed); + bool expected); /**