summaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_deposit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-07-31 20:27:16 +0200
committerChristian Grothoff <christian@grothoff.org>2021-07-31 20:27:16 +0200
commit1d54400a025ff62ad15b77ab117ea5188884b1a1 (patch)
tree195b21644b44a24b84bee159ca0011a1d372a109 /src/lib/exchange_api_deposit.c
parent723a3b742e9b284400c5164d146dc953383b4384 (diff)
downloadexchange-1d54400a025ff62ad15b77ab117ea5188884b1a1.tar.gz
exchange-1d54400a025ff62ad15b77ab117ea5188884b1a1.tar.bz2
exchange-1d54400a025ff62ad15b77ab117ea5188884b1a1.zip
-more eliminations of json_pack
Diffstat (limited to 'src/lib/exchange_api_deposit.c')
-rw-r--r--src/lib/exchange_api_deposit.c57
1 files changed, 24 insertions, 33 deletions
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index 792920c1..f22ae0df 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2020 Taler Systems SA
+ Copyright (C) 2014-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -663,38 +663,29 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
return NULL;
}
- deposit_obj = json_pack ("{s:o, s:O," /* f/wire */
- " s:o, s:o," /* h_wire, h_contract_terms */
- " s:o," /* denom_pub */
- " s:o, s:o," /* ub_sig, timestamp */
- " s:o," /* merchant_pub */
- " s:o, s:o," /* refund_deadline, wire_deadline */
- " s:o}", /* coin_sig */
- "contribution", TALER_JSON_from_amount (amount),
- "wire", wire_details,
- "h_wire", GNUNET_JSON_from_data_auto (&h_wire),
- "h_contract_terms", GNUNET_JSON_from_data_auto (
- h_contract_terms),
- "denom_pub_hash", GNUNET_JSON_from_data_auto (
- &denom_pub_hash),
- "ub_sig", GNUNET_JSON_from_rsa_signature (
- denom_sig->rsa_signature),
- "timestamp", GNUNET_JSON_from_time_abs (timestamp),
- "merchant_pub", GNUNET_JSON_from_data_auto (
- merchant_pub),
- "refund_deadline", GNUNET_JSON_from_time_abs (
- refund_deadline),
- "wire_transfer_deadline", GNUNET_JSON_from_time_abs (
- wire_deadline),
- "coin_sig", GNUNET_JSON_from_data_auto (coin_sig)
- );
- if (NULL == deposit_obj)
- {
- *ec = TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE;
- GNUNET_break (0);
- return NULL;
- }
-
+ deposit_obj = GNUNET_JSON_PACK (
+ TALER_JSON_pack_amount ("contribution",
+ amount),
+ GNUNET_JSON_pack_object_incref ("wire",
+ wire_details),
+ GNUNET_JSON_pack_data_auto ("h_wire",
+ &h_wire),
+ GNUNET_JSON_pack_data_auto ("h_contract_terms",
+ h_contract_terms),
+ GNUNET_JSON_pack_data_auto ("denom_pub_hash",
+ &denom_pub_hash),
+ TALER_JSON_pack_denomination_signature ("ub_sig",
+ denom_sig),
+ GNUNET_JSON_pack_time_abs ("timestamp",
+ timestamp),
+ GNUNET_JSON_pack_data_auto ("merchant_pub",
+ merchant_pub),
+ GNUNET_JSON_pack_time_abs ("refund_deadline",
+ refund_deadline),
+ GNUNET_JSON_pack_time_abs ("wire_transfer_deadline",
+ wire_deadline),
+ GNUNET_JSON_pack_data_auto ("coin_sig",
+ coin_sig));
dh = GNUNET_new (struct TALER_EXCHANGE_DepositHandle);
dh->auditor_chance = AUDITOR_CHANCE;
dh->exchange = exchange;