merchant

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

commit fdc385f93bb4aece0cae5fb0ff560bac7ee68a43
parent 5d9e670c42ca2c2e2f6667e8d02f56eda9f05c68
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon, 17 May 2021 13:54:43 +0200

do not select expired reserves when auto-selecting reserve for tipping (#6871)

Diffstat:
Mconfigure.ac | 14++++++++++++++
Msrc/backenddb/plugin_merchantdb_postgres.c | 9++++++---
2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -1,6 +1,20 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. # +# This file is part of TALER +# Copyright (C) 2014-2021 Taler Systems SA +# +# TALER is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3, or (at your option) any later version. +# +# TALER is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/license> +# # This configure file is in the public domain AC_PREREQ([2.69]) diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c @@ -5308,9 +5308,11 @@ RETRY: } if (NULL == reserve_pubp) { + struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (instance_id), TALER_PQ_query_param_amount (amount), + GNUNET_PQ_query_param_absolute_time (&now), GNUNET_PQ_query_param_end }; @@ -8243,12 +8245,13 @@ postgres_connect (void *cls) " exchange_initial_balance_val - tips_committed_val > $2" " OR" " (exchange_initial_balance_val - tips_committed_val = $2" - " AND exchange_initial_balance_frac - tips_committed_frac >= $3)" - " AND merchant_serial =" + " AND exchange_initial_balance_frac - tips_committed_frac >= $3)" + " AND expiration > $4" + " AND merchant_serial =" " (SELECT merchant_serial" " FROM merchant_instances" " WHERE merchant_id=$1)", - 3), + 4), /* For postgres_authorize_tip() */ GNUNET_PQ_make_prepare ("lookup_reserve_status",