merchant

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

commit 5cdcdfb2c4728f4c0afcebaad7041677cfdffcb6
parent e1d4b43af59fe8201e142103d4872c0727c2ca9e
Author: Sebastian <sebasjm@gmail.com>
Date:   Fri,  9 Feb 2024 11:09:00 -0300

fix #8354

Diffstat:
Msrc/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c | 7+++++--
Msrc/backenddb/pg_delete_otp.c | 2+-
Msrc/backenddb/pg_update_otp.c | 6++++--
3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c b/src/backend/taler-merchant-httpd_private-patch-otp-devices-ID.c @@ -46,8 +46,11 @@ TMH_private_patch_otp_devices_ID (const struct TMH_RequestHandler *rh, GNUNET_JSON_spec_uint64 ("otp_ctr", &tp.otp_ctr), NULL), - TALER_JSON_spec_otp_key ("otp_key", - (const char **) &tp.otp_key), + GNUNET_JSON_spec_mark_optional( + + TALER_JSON_spec_otp_key ("otp_key", + (const char **) &tp.otp_key), + NULL), GNUNET_JSON_spec_end () }; diff --git a/src/backenddb/pg_delete_otp.c b/src/backenddb/pg_delete_otp.c @@ -47,7 +47,7 @@ TMH_PG_delete_otp (void *cls, " (SELECT merchant_serial " " FROM merchant_instances" " WHERE merchant_id=$1)" - " AND merchant_otp_devices.template_id=$2"); + " AND merchant_otp_devices.otp_id=$2"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "delete_otp", params); diff --git a/src/backenddb/pg_update_otp.c b/src/backenddb/pg_update_otp.c @@ -51,7 +51,9 @@ TMH_PG_update_otp (void *cls, GNUNET_PQ_query_param_string (td->otp_description), GNUNET_PQ_query_param_uint32 (&pos32), GNUNET_PQ_query_param_uint64 (&td->otp_ctr), - GNUNET_PQ_query_param_string (td->otp_key), + (NULL == td->otp_key) + ? GNUNET_PQ_query_param_null() + : GNUNET_PQ_query_param_string (td->otp_key), GNUNET_PQ_query_param_end }; @@ -62,7 +64,7 @@ TMH_PG_update_otp (void *cls, " otp_description=$3" ",otp_algorithm=$4" ",otp_ctr=$5" - ",otp_key=$6" + ",otp_key=COALESCE($6,otp_key)" " WHERE merchant_serial=" " (SELECT merchant_serial" " FROM merchant_instances"