summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_deposits_get.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-04-20 20:18:03 +0200
committerChristian Grothoff <christian@grothoff.org>2022-04-20 20:18:03 +0200
commit1e0789eda3f10aeb7457e574fe7a5cea7f9a7de6 (patch)
tree25bbfdf1bd53cd770d85e3e50914d92dd58ebce3 /src/exchange/taler-exchange-httpd_deposits_get.c
parent8776f16b0667be8ac8c05f743f7f2252363038bb (diff)
downloadexchange-1e0789eda3f10aeb7457e574fe7a5cea7f9a7de6.tar.gz
exchange-1e0789eda3f10aeb7457e574fe7a5cea7f9a7de6.tar.bz2
exchange-1e0789eda3f10aeb7457e574fe7a5cea7f9a7de6.zip
-more deposit GET cleanup
Diffstat (limited to 'src/exchange/taler-exchange-httpd_deposits_get.c')
-rw-r--r--src/exchange/taler-exchange-httpd_deposits_get.c123
1 files changed, 51 insertions, 72 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposits_get.c b/src/exchange/taler-exchange-httpd_deposits_get.c
index 50969b3a4..fdb1a606c 100644
--- a/src/exchange/taler-exchange-httpd_deposits_get.c
+++ b/src/exchange/taler-exchange-httpd_deposits_get.c
@@ -32,66 +32,6 @@
/**
- * A merchant asked for details about a deposit. Provide
- * them. Generates the 200 reply.
- *
- * @param connection connection to the client
- * @param h_contract_terms hash of the contract
- * @param h_wire hash of wire account details
- * @param coin_pub public key of the coin
- * @param coin_contribution how much did the coin we asked about
- * contribute to the total transfer value? (deposit value minus fee)
- * @param wtid raw wire transfer identifier
- * @param exec_time execution time of the wire transfer
- * @return MHD result code
- */
-static MHD_RESULT
-reply_deposit_details (
- struct MHD_Connection *connection,
- const struct TALER_PrivateContractHashP *h_contract_terms,
- const struct TALER_MerchantWireHashP *h_wire,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const struct TALER_Amount *coin_contribution,
- const struct TALER_WireTransferIdentifierRawP *wtid,
- struct GNUNET_TIME_Timestamp exec_time)
-{
- struct TALER_ExchangePublicKeyP pub;
- struct TALER_ExchangeSignatureP sig;
- enum TALER_ErrorCode ec;
-
- if (TALER_EC_NONE !=
- (ec = TALER_exchange_online_confirm_wire_sign (
- &TEH_keys_exchange_sign_,
- h_wire,
- h_contract_terms,
- wtid,
- coin_pub,
- exec_time,
- coin_contribution,
- &pub,
- &sig)))
- {
- return TALER_MHD_reply_with_ec (connection,
- ec,
- NULL);
- }
- return TALER_MHD_REPLY_JSON_PACK (
- connection,
- MHD_HTTP_OK,
- GNUNET_JSON_pack_data_auto ("wtid",
- wtid),
- GNUNET_JSON_pack_timestamp ("execution_time",
- exec_time),
- TALER_JSON_pack_amount ("coin_contribution",
- coin_contribution),
- GNUNET_JSON_pack_data_auto ("exchange_sig",
- &sig),
- GNUNET_JSON_pack_data_auto ("exchange_pub",
- &pub));
-}
-
-
-/**
* Closure for #handle_wtid_data.
*/
struct DepositWtidContext
@@ -120,11 +60,6 @@ struct DepositWtidContext
struct TALER_CoinSpendPublicKeyP coin_pub;
/**
- * Public key of the merchant.
- */
- const struct TALER_MerchantPublicKeyP *merchant_pub;
-
- /**
* Set by #handle_wtid data to the wire transfer ID.
*/
struct TALER_WireTransferIdentifierRawP wtid;
@@ -165,6 +100,55 @@ struct DepositWtidContext
/**
+ * A merchant asked for details about a deposit. Provide
+ * them. Generates the 200 reply.
+ *
+ * @param connection connection to the client
+ * @param ctx details to respond with
+ * @return MHD result code
+ */
+static MHD_RESULT
+reply_deposit_details (
+ struct MHD_Connection *connection,
+ const struct DepositWtidContext *ctx)
+{
+ struct TALER_ExchangePublicKeyP pub;
+ struct TALER_ExchangeSignatureP sig;
+ enum TALER_ErrorCode ec;
+
+ if (TALER_EC_NONE !=
+ (ec = TALER_exchange_online_confirm_wire_sign (
+ &TEH_keys_exchange_sign_,
+ &ctx->h_wire,
+ &ctx->h_contract_terms,
+ &ctx->wtid,
+ &ctx->coin_pub,
+ ctx->execution_time,
+ &ctx->coin_delta,
+ &pub,
+ &sig)))
+ {
+ return TALER_MHD_reply_with_ec (connection,
+ ec,
+ NULL);
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_data_auto ("wtid",
+ &ctx->wtid),
+ GNUNET_JSON_pack_timestamp ("execution_time",
+ ctx->execution_time),
+ TALER_JSON_pack_amount ("coin_contribution",
+ &ctx->coin_delta),
+ GNUNET_JSON_pack_data_auto ("exchange_sig",
+ &sig),
+ GNUNET_JSON_pack_data_auto ("exchange_pub",
+ &pub));
+}
+
+
+/**
* Execute a "deposits" GET. Returns the transfer information
* associated with the given deposit.
*
@@ -194,7 +178,7 @@ deposits_get_transaction (void *cls,
&ctx->h_contract_terms,
&ctx->h_wire,
&ctx->coin_pub,
- ctx->merchant_pub,
+ &ctx->merchant,
&pending,
&ctx->wtid,
&ctx->execution_time,
@@ -274,12 +258,7 @@ handle_track_transaction_request (
GNUNET_JSON_pack_timestamp ("execution_time",
ctx->execution_time));
return reply_deposit_details (connection,
- &ctx->h_contract_terms,
- &ctx->h_wire,
- &ctx->coin_pub,
- &ctx->coin_delta,
- &ctx->wtid,
- ctx->execution_time);
+ ctx);
}