diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-06-19 18:06:51 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-06-19 18:06:51 +0200 |
commit | beea8eb383a4292b976c6c5d7356e6863e1adcbe (patch) | |
tree | f59d6f0f310a6578e17f8b3c63011be5867061cd /src/exchange/taler-exchange-httpd_responses.c | |
parent | ae7850a318794a7167b991f74066de1b6de4a19a (diff) | |
download | exchange-beea8eb383a4292b976c6c5d7356e6863e1adcbe.tar.gz exchange-beea8eb383a4292b976c6c5d7356e6863e1adcbe.tar.bz2 exchange-beea8eb383a4292b976c6c5d7356e6863e1adcbe.zip |
refactor /track logic towards new structure
Diffstat (limited to 'src/exchange/taler-exchange-httpd_responses.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_responses.c | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 7dab61ed6..286572fea 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -1163,135 +1163,4 @@ TEH_RESPONSE_reply_transfer_pending (struct MHD_Connection *connection, } -/** - * 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 - */ -int -TEH_RESPONSE_reply_track_transaction (struct MHD_Connection *connection, - const struct GNUNET_HashCode *h_contract_terms, - const struct GNUNET_HashCode *h_wire, - const struct TALER_CoinSpendPublicKeyP *coin_pub, - const struct TALER_Amount *coin_contribution, - const struct TALER_WireTransferIdentifierRawP *wtid, - struct GNUNET_TIME_Absolute exec_time) -{ - struct TALER_ConfirmWirePS cw; - struct TALER_ExchangePublicKeyP pub; - struct TALER_ExchangeSignatureP sig; - - cw.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE); - cw.purpose.size = htonl (sizeof (struct TALER_ConfirmWirePS)); - cw.h_wire = *h_wire; - cw.h_contract_terms = *h_contract_terms; - cw.wtid = *wtid; - cw.coin_pub = *coin_pub; - cw.execution_time = GNUNET_TIME_absolute_hton (exec_time); - TALER_amount_hton (&cw.coin_contribution, - coin_contribution); - TEH_KS_sign (&cw.purpose, - &pub, - &sig); - return TEH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_OK, - "{s:o, s:o, s:o, s:o, s:o}", - "wtid", GNUNET_JSON_from_data_auto (wtid), - "execution_time", GNUNET_JSON_from_time_abs (exec_time), - "coin_contribution", TALER_JSON_from_amount (coin_contribution), - "exchange_sig", GNUNET_JSON_from_data_auto (&sig), - "exchange_pub", GNUNET_JSON_from_data_auto (&pub)); -} - - -/** - * A merchant asked for transaction details about a wire transfer. - * Provide them. Generates the 200 reply. - * - * @param connection connection to the client - * @param total total amount that was transferred - * @param merchant_pub public key of the merchant - * @param h_wire destination account - * @param wire_fee wire fee that was charged - * @param exec_time execution time of the wire transfer - * @param wdd_head linked list with details about the combined deposits - * @return MHD result code - */ -int -TEH_RESPONSE_reply_track_transfer_details (struct MHD_Connection *connection, - const struct TALER_Amount *total, - const struct TALER_MerchantPublicKeyP *merchant_pub, - const struct GNUNET_HashCode *h_wire, - const struct TALER_Amount *wire_fee, - struct GNUNET_TIME_Absolute exec_time, - const struct TEH_TrackTransferDetail *wdd_head) -{ - const struct TEH_TrackTransferDetail *wdd_pos; - json_t *deposits; - struct TALER_WireDepositDetailP dd; - struct GNUNET_HashContext *hash_context; - struct TALER_WireDepositDataPS wdp; - struct TALER_ExchangePublicKeyP pub; - struct TALER_ExchangeSignatureP sig; - - GNUNET_TIME_round_abs (&exec_time); - deposits = json_array (); - hash_context = GNUNET_CRYPTO_hash_context_start (); - for (wdd_pos = wdd_head; NULL != wdd_pos; wdd_pos = wdd_pos->next) - { - dd.h_contract_terms = wdd_pos->h_contract_terms; - dd.execution_time = GNUNET_TIME_absolute_hton (exec_time); - dd.coin_pub = wdd_pos->coin_pub; - TALER_amount_hton (&dd.deposit_value, - &wdd_pos->deposit_value); - TALER_amount_hton (&dd.deposit_fee, - &wdd_pos->deposit_fee); - GNUNET_CRYPTO_hash_context_read (hash_context, - &dd, - sizeof (struct TALER_WireDepositDetailP)); - GNUNET_assert (0 == - json_array_append_new (deposits, - json_pack ("{s:o, s:o, s:o, s:o}", - "h_contract_terms", GNUNET_JSON_from_data_auto (&wdd_pos->h_contract_terms), - "coin_pub", GNUNET_JSON_from_data_auto (&wdd_pos->coin_pub), - "deposit_value", TALER_JSON_from_amount (&wdd_pos->deposit_value), - "deposit_fee", TALER_JSON_from_amount (&wdd_pos->deposit_fee)))); - } - wdp.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT); - wdp.purpose.size = htonl (sizeof (struct TALER_WireDepositDataPS)); - TALER_amount_hton (&wdp.total, - total); - TALER_amount_hton (&wdp.wire_fee, - wire_fee); - wdp.merchant_pub = *merchant_pub; - wdp.h_wire = *h_wire; - GNUNET_CRYPTO_hash_context_finish (hash_context, - &wdp.h_details); - TEH_KS_sign (&wdp.purpose, - &pub, - &sig); - return TEH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_OK, - "{s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}", - "total", TALER_JSON_from_amount (total), - "wire_fee", TALER_JSON_from_amount (wire_fee), - "merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub), - "H_wire", GNUNET_JSON_from_data_auto (h_wire), - "execution_time", GNUNET_JSON_from_time_abs (exec_time), - "deposits", deposits, - "exchange_sig", GNUNET_JSON_from_data_auto (&sig), - "exchange_pub", GNUNET_JSON_from_data_auto (&pub)); -} - - - /* end of taler-exchange-httpd_responses.c */ |