summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-post-transfers.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-05-06 19:32:36 +0200
committerChristian Grothoff <christian@grothoff.org>2020-05-06 19:32:36 +0200
commitc84339de2d37076cfd114ae1a097cf084d36b7a0 (patch)
treea01ac1f7b5fda6780b3198dbc73bf8c580ab8c60 /src/backend/taler-merchant-httpd_private-post-transfers.c
parent2ba0fedd391988610d6d18d9e5b61ac00c9f663e (diff)
downloadmerchant-c84339de2d37076cfd114ae1a097cf084d36b7a0.tar.gz
merchant-c84339de2d37076cfd114ae1a097cf084d36b7a0.tar.bz2
merchant-c84339de2d37076cfd114ae1a097cf084d36b7a0.zip
fix ftbfs
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-post-transfers.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-post-transfers.c96
1 files changed, 28 insertions, 68 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-transfers.c b/src/backend/taler-merchant-httpd_private-post-transfers.c
index ce76a6f2..2f22d051 100644
--- a/src/backend/taler-merchant-httpd_private-post-transfers.c
+++ b/src/backend/taler-merchant-httpd_private-post-transfers.c
@@ -255,43 +255,17 @@ build_deposits_response (void *cls,
struct TrackTransferContext *rctx = cls;
struct Entry *entry = value;
json_t *element;
- json_t *contract_terms;
- json_t *order_id;
- TMH_db->preflight (TMH_db->cls);
- if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
- TMH_db->find_contract_terms_from_hash (TMH_db->cls,
- &contract_terms,
- key,
- &rctx->mi->pubkey))
- {
- GNUNET_break_op (0);
- return GNUNET_NO;
- }
-
- order_id = json_object_get (contract_terms,
- "order_id");
- if (NULL == order_id)
- {
- GNUNET_break_op (0);
- json_decref (contract_terms);
- return GNUNET_NO;
- }
- element = json_pack ("{s:O, s:o, s:o}",
- "order_id", order_id,
+ element = json_pack ("{s:s, s:o, s:o}",
+ "order_id", entry->order_id,
"deposit_value", TALER_JSON_from_amount (
&entry->deposit_value),
"deposit_fee", TALER_JSON_from_amount (
&entry->deposit_fee));
- json_decref (contract_terms);
- if (NULL == element)
- {
- GNUNET_break_op (0);
- return GNUNET_NO;
- }
- GNUNET_break (0 ==
- json_array_append_new (rctx->deposits_response,
- element));
+ GNUNET_assert (NULL != element);
+ GNUNET_assert (0 ==
+ json_array_append_new (rctx->deposits_response,
+ element));
return GNUNET_YES;
}
@@ -368,6 +342,7 @@ transform_response (const json_t *result,
current_entry = GNUNET_new (struct Entry);
current_entry->deposit_value = iter_value;
current_entry->deposit_fee = iter_fee;
+ current_entry->order_id = "FIXME";
if (GNUNET_SYSERR ==
GNUNET_CONTAINER_multihashmap_put (map,
@@ -595,25 +570,12 @@ check_wire_fee (struct TrackTransferContext *rctx,
*
* @param cls closure
* @param hr HTTP response details
- * @param exchange_pub public key of the exchange used to sign @a json
- * @param h_wire hash of the wire transfer address the transfer went to, or NULL on error
- * @param execution_time time when the exchange claims to have performed the wire transfer
- * @param total_amount total amount of the wire transfer, or NULL if the exchange could
- * not provide any @a wtid (set only if @a http_status is #MHD_HTTP_OK)
- * @param wire_fee wire fee that was charged by the exchange
- * @param details_length length of the @a details array
- * @param details array with details about the combined transactions
+ * @param td transfer data
*/
static void
wire_transfer_cb (void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr,
- const struct TALER_ExchangePublicKeyP *exchange_pub,
- const struct GNUNET_HashCode *h_wire,
- struct GNUNET_TIME_Absolute execution_time,
- const struct TALER_Amount *total_amount,
- const struct TALER_Amount *wire_fee,
- unsigned int details_length,
- const struct TALER_TrackTransferDetails *details)
+ const struct TALER_EXCHANGE_TransferData *td)
{
struct TrackTransferContext *rctx = cls;
json_t *jresponse;
@@ -641,11 +603,7 @@ wire_transfer_cb (void *cls,
rctx->exchange_url,
rctx->payto_uri,
&rctx->wtid,
- total_amount,
- wire_fee,
- execution_time,
- details_length,
- details);
+ td);
if (0 > qs)
{
/* Special report if retries insufficient */
@@ -667,8 +625,8 @@ wire_transfer_cb (void *cls,
if (GNUNET_SYSERR ==
check_wire_fee (rctx,
hr->reply,
- execution_time,
- wire_fee))
+ td->execution_time,
+ &td->wire_fee))
return;
/* Now we want to double-check that any (Taler coin) deposit
@@ -679,7 +637,7 @@ wire_transfer_cb (void *cls,
* details_length is how many (Taler coin) deposits have been
* aggregated into _this_ wire transfer.
*///
- for (unsigned int i = 0; i<details_length; i++)
+ for (unsigned int i = 0; i < td->details_length; i++)
{
rctx->current_offset = i;
rctx->current_detail = &details[i];
@@ -688,8 +646,9 @@ wire_transfer_cb (void *cls,
TMH_db->preflight (TMH_db->cls);
qs = TMH_db->find_payments_by_hash_and_coin (TMH_db->cls,
&details[i].h_contract_terms,
- &rctx->mi->pubkey,
- &details[i].coin_pub,
+ &rctx->hc->instance->settings.
+ id,
+ &td->details[i].coin_pub,
&check_transfer,
rctx);
if (0 > qs)
@@ -699,8 +658,8 @@ wire_transfer_cb (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
/* Always report on hard error as well to enable diagnostics */
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- resume_track_transfer_with_response
- (rctx,
+ resume_track_transfer_with_response (
+ rctx,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_MHD_make_json_pack ("{s:I, s:s}",
"code",
@@ -724,8 +683,8 @@ wire_transfer_cb (void *cls,
/* Internal error: how can we have called #check_transfer()
but still have no result? */
GNUNET_break (0);
- resume_track_transfer_with_response
- (rctx,
+ resume_track_transfer_with_response (
+ rctx,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_MHD_make_json_pack ("{s:I, s:s, s:I, s:s}",
"code",
@@ -741,8 +700,8 @@ wire_transfer_cb (void *cls,
/* #check_transfer() failed, report conflict! */
GNUNET_break_op (0);
GNUNET_assert (NULL != rctx->response);
- resume_track_transfer_with_response
- (rctx,
+ resume_track_transfer_with_response (
+ rctx,
MHD_HTTP_FAILED_DEPENDENCY,
rctx->response);
rctx->response = NULL;
@@ -754,8 +713,8 @@ wire_transfer_cb (void *cls,
{
TMH_db->preflight (TMH_db->cls);
qs = TMH_db->store_coin_to_transfer (TMH_db->cls,
- &details[i].h_contract_terms,
- &details[i].coin_pub,
+ &td->details[i].h_contract_terms,
+ &td->details[i].coin_pub,
&rctx->wtid);
if (GNUNET_DB_STATUS_SOFT_ERROR != qs)
break;
@@ -766,8 +725,8 @@ wire_transfer_cb (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
/* Always report on hard error as well to enable diagnostics */
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- resume_track_transfer_with_response
- (rctx,
+ resume_track_transfer_with_response (
+ rctx,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_MHD_make_json_pack ("{s:I, s:s}",
"code",
@@ -1057,7 +1016,8 @@ TMH_private_post_transfers (const struct TMH_RequestHandler *rh,
rctx->exchange_url,
&rctx->wtid,
&rctx->amount,
- rctx->payto_uri);
+ rctx->payto_uri,
+ true /* confirmed! */);
if (0 > qs)
{
/* Simple select queries should not cause serialization issues */