diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-08-31 14:17:18 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-08-31 14:17:18 +0200 |
commit | 7d50fee1384e44b007e8c00dd610eef2cedf1866 (patch) | |
tree | 76279e0428446bb937cb5474d4c24604b58b9f04 /src/backenddb/plugin_merchantdb_postgres.c | |
parent | 58bcfc40d82ceddf5db759ccd8de0ebf6b48e49c (diff) | |
download | merchant-7d50fee1384e44b007e8c00dd610eef2cedf1866.tar.gz merchant-7d50fee1384e44b007e8c00dd610eef2cedf1866.tar.bz2 merchant-7d50fee1384e44b007e8c00dd610eef2cedf1866.zip |
fix refund test and logic: if refund is smaller than refund that was previously awarded, that's not a hard error but simply 'no change required'
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index 76d4efee..cb475190 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -2200,14 +2200,16 @@ process_deposits_for_refund_cb (void *cls, TALER_amount2s (¤t_refund)); /* stop immediately if we are done */ - if (0 == TALER_amount_cmp (ctx->refund, + if (0 >= TALER_amount_cmp (ctx->refund, ¤t_refund)) + { + ctx->qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; return; - + } /* Phase 2: Try to increase current refund until it matches desired refund */ - for (unsigned int i=0; i<num_results; i++) + for (unsigned int i=0;i<num_results; i++) { const struct TALER_Amount *increment; struct TALER_Amount left; @@ -2345,6 +2347,10 @@ postgres_increase_refund_for_contract (void *cls, GNUNET_PQ_query_param_end }; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Asked to refund %s on contract %s\n", + TALER_amount2s (refund), + GNUNET_h2s (h_contract_terms)); if (GNUNET_OK != postgres_start (cls)) { |