From d1544d029e1d4aaba894f25276f36b14bd3a0ac4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 27 Jun 2017 16:17:26 +0200 Subject: fix logical order of functions --- src/backenddb/plugin_merchantdb_postgres.c | 79 +++++++++++++++--------------- 1 file changed, 40 insertions(+), 39 deletions(-) (limited to 'src/backenddb/plugin_merchantdb_postgres.c') diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index 3967a18f..a51b7119 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -1685,18 +1685,56 @@ postgres_get_refunds_from_contract_terms_hash (void *cls, } +/** + * Insert a refund row into merchant_refunds. Not meant to be exported + * in the db API. + * + * @param cls closure, tipically a connection to the db + * @param merchant_pub merchant instance public key + * @param h_contract_terms hashcode of the contract related to this refund + * @param coin_pub public key of the coin giving the (part of) refund + * @param reason human readable explaination behind the refund + * @param refund how much this coin is refunding + * @param refund_fee refund fee for this coin + */ +enum GNUNET_DB_QueryStatus +insert_refund (void *cls, + const struct TALER_MerchantPublicKeyP *merchant_pub, + const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + const char *reason, + const struct TALER_Amount *refund, + const struct TALER_Amount *refund_fee) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_auto_from_type (merchant_pub), + GNUNET_PQ_query_param_auto_from_type (h_contract_terms), + GNUNET_PQ_query_param_auto_from_type (coin_pub), + GNUNET_PQ_query_param_string (reason), + TALER_PQ_query_param_amount (refund), + TALER_PQ_query_param_amount (refund_fee), + GNUNET_PQ_query_param_end + }; + + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "insert_refund", + params); +} + + /** * Closure for #process_refund_cb. */ struct FindRefundContext { /** - * + * Updated to reflect total amount refunded so far. */ struct TALER_Amount refunded_amount; /** - * + * Set to #GNUNET_SYSERR on hard errors. */ int err; }; @@ -1786,43 +1824,6 @@ struct InsertRefundContext }; -/** - * Insert a refund row into merchant_refunds. Not meant to be exported - * in the db API. - * - * @param cls closure, tipically a connection to the db - * @param merchant_pub merchant instance public key - * @param h_contract_terms hashcode of the contract related to this refund - * @param coin_pub public key of the coin giving the (part of) refund - * @param reason human readable explaination behind the refund - * @param refund how much this coin is refunding - * @param refund_fee refund fee for this coin - */ -enum GNUNET_DB_QueryStatus -insert_refund (void *cls, - const struct TALER_MerchantPublicKeyP *merchant_pub, - const struct GNUNET_HashCode *h_contract_terms, - const struct TALER_CoinSpendPublicKeyP *coin_pub, - const char *reason, - const struct TALER_Amount *refund, - const struct TALER_Amount *refund_fee) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_auto_from_type (merchant_pub), - GNUNET_PQ_query_param_auto_from_type (h_contract_terms), - GNUNET_PQ_query_param_auto_from_type (coin_pub), - GNUNET_PQ_query_param_string (reason), - TALER_PQ_query_param_amount (refund), - TALER_PQ_query_param_amount (refund_fee), - GNUNET_PQ_query_param_end - }; - - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "insert_refund", - params); -} - /** * Function to be called with the results of a SELECT statement * that has returned @a num_results results. -- cgit v1.2.3