From 0748ecde7be1fb9537382d7cadc38031fbc696ff Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 22 Jun 2020 20:30:25 +0200 Subject: return active-status of reserves from backenddb (fixes FIXMEs) --- src/backenddb/plugin_merchantdb_postgres.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/backenddb') diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index 54719940..fc1e3acc 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -4341,7 +4341,7 @@ lookup_reserves_cb (void *cls, struct TALER_Amount exchange_initial_balance; struct TALER_Amount pickup_amount; struct TALER_Amount committed_amount; - uint8_t active = 0; + uint8_t active; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_auto_from_type ("reserve_pub", &reserve_pub), @@ -4357,8 +4357,8 @@ lookup_reserves_cb (void *cls, &committed_amount), TALER_PQ_RESULT_SPEC_AMOUNT ("tips_picked_up", &pickup_amount), - /*GNUNET_PQ_result_spec_auto_from_type ("active", - &active), FIXME: 'active'*/ + GNUNET_PQ_result_spec_auto_from_type ("active", + &active), GNUNET_PQ_result_spec_end }; @@ -4374,10 +4374,10 @@ lookup_reserves_cb (void *cls, switch (lrc->active) { case TALER_EXCHANGE_YNA_YES: - if (! active) + if (0 == active) continue; case TALER_EXCHANGE_YNA_NO: - if (active) + if (0 != active) continue; case TALER_EXCHANGE_YNA_ALL: break; @@ -4682,7 +4682,7 @@ postgres_lookup_reserve (void *cls, struct TALER_Amount exchange_initial_balance; struct TALER_Amount pickup_amount; struct TALER_Amount committed_amount; - /*uint8_t active;*/ + uint8_t active; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_absolute_time ("creation_time", &creation_time), @@ -4696,8 +4696,8 @@ postgres_lookup_reserve (void *cls, &pickup_amount), TALER_PQ_RESULT_SPEC_AMOUNT ("tips_committed", &committed_amount), - /*GNUNET_PQ_result_spec_auto_from_type ("active", - &active), FIXME: active! */ + GNUNET_PQ_result_spec_auto_from_type ("active", + &active), GNUNET_PQ_result_spec_end }; enum GNUNET_DB_QueryStatus qs; @@ -4718,6 +4718,7 @@ postgres_lookup_reserve (void *cls, &exchange_initial_balance, &pickup_amount, &committed_amount, + (0 != active), 0, NULL); return qs; @@ -4739,6 +4740,7 @@ postgres_lookup_reserve (void *cls, &exchange_initial_balance, &pickup_amount, &committed_amount, + 0 != active, ltc.tips_length, ltc.tips); } @@ -7789,7 +7791,9 @@ libtaler_plugin_merchantdb_postgres_init (void *cls) ",tips_committed_frac" ",tips_picked_up_val" ",tips_picked_up_frac" + ",reserve_priv IS NOT NULL AS active" " FROM merchant_tip_reserves" + " FULL OUTER JOIN merchant_tip_reserve_keys USING (reserve_serial)" " WHERE creation_time > $2" " AND merchant_serial =" " (SELECT merchant_serial" @@ -7823,7 +7827,9 @@ libtaler_plugin_merchantdb_postgres_init (void *cls) ",tips_committed_frac" ",tips_picked_up_val" ",tips_picked_up_frac" + ",reserve_priv IS NOT NULL AS active" " FROM merchant_tip_reserves" + " FULL OUTER JOIN merchant_tip_reserve_keys USING (reserve_serial)" " WHERE reserve_pub = $2" " AND merchant_serial =" " (SELECT merchant_serial" -- cgit v1.2.3