diff options
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 70 |
1 files changed, 59 insertions, 11 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index a6c10413..db9e9c51 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -2259,9 +2259,9 @@ lookup_transfer_details_by_order_cb (void *cls, &exchange_url), GNUNET_PQ_result_spec_auto_from_type ("wtid", &wtid), - TALER_PQ_RESULT_SPEC_AMOUNT ("deposit_value", + TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_deposit_value", &deposit_value), - TALER_PQ_RESULT_SPEC_AMOUNT ("deposit_fee", + TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_deposit_fee", &deposit_fee), GNUNET_PQ_result_spec_auto_from_type ("transfer_confirmed", &transfer_confirmed), @@ -2348,11 +2348,11 @@ postgres_insert_deposit_to_transfer ( struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&deposit_serial), - GNUNET_PQ_query_param_auto_from_type (&dd->exchange_pub), + TALER_PQ_query_param_amount (&dd->coin_contribution), + GNUNET_PQ_query_param_absolute_time (&dd->execution_time), GNUNET_PQ_query_param_auto_from_type (&dd->exchange_sig), + GNUNET_PQ_query_param_auto_from_type (&dd->exchange_pub), GNUNET_PQ_query_param_auto_from_type (&dd->wtid), - GNUNET_PQ_query_param_absolute_time (&dd->execution_time), - TALER_PQ_query_param_amount (&dd->coin_contribution), GNUNET_PQ_query_param_end }; @@ -6935,6 +6935,7 @@ libtaler_plugin_merchantdb_postgres_init (void *cls) " FROM merchant_contract_terms" " WHERE order_serial=$1", 1), + /* for postgres_lookup_payment_status() */ GNUNET_PQ_make_prepare ("lookup_payment_status_session_id", "SELECT" " wired" @@ -6944,14 +6945,61 @@ libtaler_plugin_merchantdb_postgres_init (void *cls) " AND session_id=$2", 2), /* for postgres_lookup_deposits_by_order() */ - // FIXME - /* for postgres_lookup_transfer_deposits_by_order() */ - // FIXME + GNUNET_PQ_make_prepare ("lookup_deposits_by_order", + "SELECT" + " deposit_serial" + ",exchange_url" + ",h_wire" + ",amount_with_fee_val" + ",amount_with_fee_frac" + ",deposit_fee_val" + ",deposit_fee_frac" + ",coin_pub" + " FROM merchant_deposits" + " JOIN merchant_accounts USING (account_serial)" + " WHERE order_serial=$1", + 1), + /* for postgres_lookup_transfer_details_by_order() */ + GNUNET_PQ_make_prepare ("lookup_transfer_details_by_order", + "SELECT" + " md.deposit_serial" + ",md.exchange_url" + ",mt.wtid" + ",exchange_deposit_value_val" + ",exchange_deposit_value_frac" + ",exchange_deposit_fee_val" + ",exchange_deposit_fee_frac" + ",mt.confirmed AS transfer_confirmed" + " FROM merchant_transfer_to_coin" + " JOIN merchant_deposits AS md USING (deposit_serial)" + " JOIN merchant_transfers AS mt USING (credit_serial)" + " WHERE deposit_serial IN" + " (SELECT deposit_serial" + " FROM merchant_deposits" + " WHERE order_serial=$1)", + 1), /* for postgres_insert_deposit_to_transfer() */ - // FIXME + GNUNET_PQ_make_prepare ("insert_deposit_to_transfer", + "INSERT INTO merchant_deposit_to_transfer" + "(deposit_serial" + ",coin_contribution_value_val" + ",coin_contribution_value_frac" + ",credit_serial" + ",execution_time" + ",signkey_serial" + ",exchange_sig" + ") SELECT $1, $2, $3, credit_serial, $4, signkey_serial, $5" + " FROM merchant_transfers" + " CROSS JOIN merchant_exchange_signing_keys" + " WHERE exchange_pub=$6" + " AND wtid=$7", + 7), /* for postgres_mark_order_wired() */ - // FIXME - + GNUNET_PQ_make_prepare ("mark_order_wired", + "UPDATE merchant_contract_terms SET" + " wired=true" + " WHERE order_serial=$1", + 1), /* for process_refund_cb() used in postgres_increase_refund() */ GNUNET_PQ_make_prepare ("find_refunds_by_coin", "SELECT" |