exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 0d665e7bb6cf93127451b6201a5c9e1198feb5f7
parent 4049e38d5cdc80970848a751283e2698c3bf2346
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri,  3 Apr 2026 20:20:54 +0200

expose more details from protocol in Rest API

Diffstat:
Msrc/include/taler/taler-exchange/get-transfers-WTID.h | 5+++++
Msrc/include/taler/taler-exchange/post-purses-PURSE_PUB-create.h | 10++++++++++
Msrc/include/taler/taler-exchange/post-purses-PURSE_PUB-deposit.h | 10++++++++++
Msrc/include/taler/taler-exchange/post-purses-PURSE_PUB-merge.h | 5+++++
Msrc/lib/exchange_api_get-transfers-WTID.c | 5++---
Msrc/lib/exchange_api_post-purses-PURSE_PUB-create.c | 12++++--------
Msrc/lib/exchange_api_post-purses-PURSE_PUB-deposit.c | 12+++++-------
Msrc/lib/exchange_api_post-purses-PURSE_PUB-merge.c | 3+--
8 files changed, 42 insertions(+), 20 deletions(-)

diff --git a/src/include/taler/taler-exchange/get-transfers-WTID.h b/src/include/taler/taler-exchange/get-transfers-WTID.h @@ -79,6 +79,11 @@ struct TALER_EXCHANGE_TransferData */ struct GNUNET_HashCode h_details; + /** + * Public key of the merchant (to identify who this transfer was for). + */ + struct TALER_MerchantPublicKeyP merchant_pub; + }; diff --git a/src/include/taler/taler-exchange/post-purses-PURSE_PUB-create.h b/src/include/taler/taler-exchange/post-purses-PURSE_PUB-create.h @@ -188,6 +188,16 @@ struct TALER_EXCHANGE_PostPursesCreateResponse */ struct TALER_ExchangeSignatureP exchange_sig; + /** + * Total amount deposited into the purse so far (without fees). + */ + struct TALER_Amount total_deposited; + + /** + * Timestamp of the exchange for @e exchange_sig. + */ + struct GNUNET_TIME_Timestamp exchange_timestamp; + } ok; } details; diff --git a/src/include/taler/taler-exchange/post-purses-PURSE_PUB-deposit.h b/src/include/taler/taler-exchange/post-purses-PURSE_PUB-deposit.h @@ -95,6 +95,16 @@ struct TALER_EXCHANGE_PostPursesDepositResponse */ struct TALER_PrivateContractHashP h_contract_terms; + /** + * Signature by the exchange affirming the deposit. + */ + struct TALER_ExchangeSignatureP exchange_sig; + + /** + * Online signing key used by the exchange. + */ + struct TALER_ExchangePublicKeyP exchange_pub; + } ok; } details; diff --git a/src/include/taler/taler-exchange/post-purses-PURSE_PUB-merge.h b/src/include/taler/taler-exchange/post-purses-PURSE_PUB-merge.h @@ -105,6 +105,11 @@ struct TALER_EXCHANGE_PostPursesMergeResponse */ struct GNUNET_TIME_Timestamp etime; + /** + * Amount merged (excluding deposit fees). + */ + struct TALER_Amount merge_amount; + } ok; /** diff --git a/src/lib/exchange_api_get-transfers-WTID.c b/src/lib/exchange_api_get-transfers-WTID.c @@ -101,7 +101,6 @@ check_transfers_get_response_ok ( { const json_t *details_j; struct TALER_Amount total_expected; - struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_EXCHANGE_GetTransfersResponse tgr = { .hr.reply = json, .hr.http_status = MHD_HTTP_OK @@ -114,7 +113,7 @@ check_transfers_get_response_ok ( TALER_JSON_spec_amount_any ("wire_fee", &td->wire_fee), GNUNET_JSON_spec_fixed_auto ("merchant_pub", - &merchant_pub), + &td->merchant_pub), GNUNET_JSON_spec_fixed_auto ("h_payto", &td->h_payto), GNUNET_JSON_spec_timestamp ("execution_time", @@ -219,7 +218,7 @@ check_transfers_get_response_ok ( TALER_exchange_online_wire_deposit_verify ( &td->total_amount, &td->wire_fee, - &merchant_pub, + &td->merchant_pub, &td->h_payto, &td->h_details, &td->exchange_pub, diff --git a/src/lib/exchange_api_post-purses-PURSE_PUB-create.c b/src/lib/exchange_api_post-purses-PURSE_PUB-create.c @@ -241,20 +241,16 @@ handle_purse_create_deposit_finished (void *cls, break; case MHD_HTTP_OK: { - struct GNUNET_TIME_Timestamp etime; - struct TALER_Amount total_deposited; - struct TALER_ExchangeSignatureP exchange_sig; - struct TALER_ExchangePublicKeyP exchange_pub; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("exchange_sig", - &exchange_sig), + &dr.details.ok.exchange_sig), GNUNET_JSON_spec_fixed_auto ("exchange_pub", - &exchange_pub), + &dr.details.ok.exchange_pub), GNUNET_JSON_spec_timestamp ("exchange_timestamp", - &etime), + &dr.details.ok.exchange_timestamp), TALER_JSON_spec_amount ("total_deposited", pch->purse_value_after_fees.currency, - &total_deposited), + &dr.details.ok.total_deposited), GNUNET_JSON_spec_end () }; diff --git a/src/lib/exchange_api_post-purses-PURSE_PUB-deposit.c b/src/lib/exchange_api_post-purses-PURSE_PUB-deposit.c @@ -165,13 +165,11 @@ handle_purse_deposit_finished (void *cls, case MHD_HTTP_OK: { struct GNUNET_TIME_Timestamp etime; - struct TALER_ExchangeSignatureP exchange_sig; - struct TALER_ExchangePublicKeyP exchange_pub; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("exchange_sig", - &exchange_sig), + &dr.details.ok.exchange_sig), GNUNET_JSON_spec_fixed_auto ("exchange_pub", - &exchange_pub), + &dr.details.ok.exchange_pub), GNUNET_JSON_spec_fixed_auto ("h_contract_terms", &dr.details.ok.h_contract_terms), GNUNET_JSON_spec_timestamp ("exchange_timestamp", @@ -199,7 +197,7 @@ handle_purse_deposit_finished (void *cls, } if (GNUNET_OK != TALER_EXCHANGE_test_signing_key (keys, - &exchange_pub)) + &dr.details.ok.exchange_pub)) { GNUNET_break_op (0); dr.hr.http_status = 0; @@ -214,8 +212,8 @@ handle_purse_deposit_finished (void *cls, &dr.details.ok.total_deposited, &pch->purse_pub, &dr.details.ok.h_contract_terms, - &exchange_pub, - &exchange_sig)) + &dr.details.ok.exchange_pub, + &dr.details.ok.exchange_sig)) { GNUNET_break_op (0); dr.hr.http_status = 0; diff --git a/src/lib/exchange_api_post-purses-PURSE_PUB-merge.c b/src/lib/exchange_api_post-purses-PURSE_PUB-merge.c @@ -163,7 +163,6 @@ handle_purse_merge_finished (void *cls, break; case MHD_HTTP_OK: { - struct TALER_Amount total_deposited; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("exchange_sig", &dr.details.ok.exchange_sig), @@ -173,7 +172,7 @@ handle_purse_merge_finished (void *cls, &dr.details.ok.etime), TALER_JSON_spec_amount ("merge_amount", pch->purse_value_after_fees.currency, - &total_deposited), + &dr.details.ok.merge_amount), GNUNET_JSON_spec_end () };