summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-get-orders-ID.c
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-07 05:52:23 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-07 05:52:23 -0400
commit5eb0a2e98faecfec89add4845f817548b3fee86b (patch)
tree113ddae80b46f5f34a2ae7f4159323d98bf021fd /src/backend/taler-merchant-httpd_private-get-orders-ID.c
parent002772c388aaa794c068c9239565c8467f6c65a8 (diff)
downloadmerchant-5eb0a2e98faecfec89add4845f817548b3fee86b.tar.gz
merchant-5eb0a2e98faecfec89add4845f817548b3fee86b.tar.bz2
merchant-5eb0a2e98faecfec89add4845f817548b3fee86b.zip
fixed merchant get order with transfer status
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-get-orders-ID.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders-ID.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
index d637f5cf..b6bdb139 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -332,17 +332,17 @@ gorc_report (struct GetOrderRequestContext *gorc,
GNUNET_assert (0 ==
json_array_append_new (
gorc->wire_reports,
- json_pack ("{s:I, s:s, s:o, s:I, s:I}",
+ json_pack ("{s:I, s:s, s:I, s:I, s:o}",
"code",
(json_int_t) ec,
"hint",
hint,
- "coin_pub",
- GNUNET_JSON_from_data_auto (coin_pub),
"exchange_ec",
(json_int_t) exchange_hr->ec,
"exchange_hc",
- (json_int_t) exchange_hr->http_status)));
+ (json_int_t) exchange_hr->http_status,
+ "coin_pub",
+ GNUNET_JSON_from_data_auto (coin_pub))));
else
GNUNET_assert (0 ==
json_array_append_new (
@@ -700,7 +700,19 @@ process_transfer_details (void *cls,
struct GetOrderRequestContext *gorc = cls;
json_t *wire_details = gorc->wire_details;
struct TALER_Amount wired;
-
+ struct GNUNET_TIME_Absolute execution_time_round = execution_time;
+
+ /* Compute total amount *wired* */
+ GNUNET_assert (0 <
+ TALER_amount_add (&gorc->deposits_total,
+ &gorc->deposits_total,
+ deposit_value));
+ GNUNET_assert (0 <
+ TALER_amount_add (&gorc->deposit_fees_total,
+ &gorc->deposit_fees_total,
+ deposit_fee));
+
+ GNUNET_TIME_round_abs (&execution_time_round);
GNUNET_assert
(0 <= TALER_amount_subtract (&wired,
deposit_value,
@@ -716,7 +728,7 @@ process_transfer_details (void *cls,
"amount",
TALER_JSON_from_amount (&wired),
"execution_time",
- GNUNET_JSON_from_time_abs (execution_time),
+ GNUNET_JSON_from_time_abs (execution_time_round),
"confirmed",
transfer_confirmed)));
}
@@ -956,6 +968,12 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
{
/* suspend connection, wait for exchange to check wire transfer status there */
gorc->transfer_status_requested = false; /* only try ONCE */
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_get_zero (TMH_currency,
+ &gorc->deposits_total));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_get_zero (TMH_currency,
+ &gorc->deposit_fees_total));
TMH_db->lookup_deposits_by_order (TMH_db->cls,
gorc->order_serial,
&deposit_cb,