summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_responses.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-05-22 18:21:15 +0200
committerChristian Grothoff <christian@grothoff.org>2022-05-22 18:21:15 +0200
commit40daa209fb0fb5292956fd3f5770a90e8da0c2a6 (patch)
tree18e2bd458c6bf9e640b17feba35f51d2d79c5cf0 /src/exchange/taler-exchange-httpd_responses.c
parent8658ae03cab72142b2376d5318e039320b02913a (diff)
downloadexchange-40daa209fb0fb5292956fd3f5770a90e8da0c2a6.tar.gz
exchange-40daa209fb0fb5292956fd3f5770a90e8da0c2a6.tar.bz2
exchange-40daa209fb0fb5292956fd3f5770a90e8da0c2a6.zip
-more work on reverse history
Diffstat (limited to 'src/exchange/taler-exchange-httpd_responses.c')
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index 4d40303bd..89d557c7d 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -735,6 +735,71 @@ TEH_RESPONSE_compile_reserve_history (
}
}
break;
+ case TALER_EXCHANGEDB_RO_PURSE_MERGE:
+ {
+ const struct TALER_EXCHANGEDB_PurseMerge *merge =
+ pos->details.merge;
+ struct TALER_Amount amount;
+
+ GNUNET_assert (0 >=
+ TALER_amount_subtract (&amount,
+ &merge->amount_with_fee,
+ &merge->purse_fee));
+ if (0 !=
+ json_array_append_new (
+ json_history,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("type",
+ "MERGE"),
+ GNUNET_JSON_pack_data_auto ("h_contract_terms",
+ &merge->h_contract_terms),
+ GNUNET_JSON_pack_data_auto ("merge_pub",
+ &merge->merge_pub),
+ GNUNET_JSON_pack_data_auto ("purse_sig",
+ &merge->purse_sig),
+ GNUNET_JSON_pack_data_auto ("purse_pub",
+ &merge->purse_pub),
+ GNUNET_JSON_pack_data_auto ("merge_sig",
+ &merge->merge_sig),
+ GNUNET_JSON_pack_data_auto ("reserve_sig",
+ &merge->reserve_sig),
+ GNUNET_JSON_pack_timestamp ("merge_timestamp",
+ merge->merge_timestamp),
+ TALER_JSON_pack_amount ("amount",
+ &amount),
+ TALER_JSON_pack_amount ("purse_fee",
+ &merge->purse_fee))))
+ {
+ GNUNET_break (0);
+ json_decref (json_history);
+ return NULL;
+ }
+ }
+ break;
+ case TALER_EXCHANGEDB_RO_HISTORY_REQUEST:
+ {
+ const struct TALER_EXCHANGEDB_HistoryRequest *history =
+ pos->details.history;
+
+ if (0 !=
+ json_array_append_new (
+ json_history,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("type",
+ "HISTORY"),
+ GNUNET_JSON_pack_data_auto ("reserve_sig",
+ &history->reserve_sig),
+ GNUNET_JSON_pack_timestamp ("request_timestamp",
+ history->request_timestamp),
+ TALER_JSON_pack_amount ("history_fee",
+ &history->history_fee))))
+ {
+ GNUNET_break (0);
+ json_decref (json_history);
+ return NULL;
+ }
+ }
+ break;
}
}