exchange

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

commit 2ad7a781183998f8694d72e8d00f190a031325c7
parent 10dd553ccdeaa19610ad9f9075d1135ab6994ce2
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  4 Apr 2026 00:41:13 +0200

have libtalerexchange return more details from protocol to clients

Diffstat:
Msrc/include/taler/taler-exchange/post-reserves-RESERVE_PUB-purse.h | 20++++++++++++++++++++
Msrc/lib/exchange_api_get-kyc-check-H_NORMALIZED_PAYTO.c | 4----
Msrc/lib/exchange_api_get-kyc-proof-PROVIDER_NAME.c | 3+++
Msrc/lib/exchange_api_post-batch-deposit.c | 5+++++
Msrc/lib/exchange_api_post-kyc-wallet.c | 10++++++++++
Msrc/lib/exchange_api_post-purses-PURSE_PUB-merge.c | 13+++++++++++++
Msrc/lib/exchange_api_post-reserves-RESERVE_PUB-purse.c | 35++++++++++++++++++++++-------------
Msrc/lib/exchange_api_post-withdraw_blinded.c | 11+++++++++++
8 files changed, 84 insertions(+), 17 deletions(-)

diff --git a/src/include/taler/taler-exchange/post-reserves-RESERVE_PUB-purse.h b/src/include/taler/taler-exchange/post-reserves-RESERVE_PUB-purse.h @@ -190,6 +190,26 @@ struct TALER_EXCHANGE_PostReservesPurseResponse struct { + /** + * Signature by the exchange affirming the purse creation. + */ + struct TALER_ExchangeSignatureP exchange_sig; + + /** + * Online signing key used by the exchange. + */ + struct TALER_ExchangePublicKeyP exchange_pub; + + /** + * Timestamp of the exchange for @e exchange_sig. + */ + struct GNUNET_TIME_Timestamp exchange_timestamp; + + /** + * Amount deposited (excluding deposit fees). + */ + struct TALER_Amount total_deposited; + } ok; /** diff --git a/src/lib/exchange_api_get-kyc-check-H_NORMALIZED_PAYTO.c b/src/lib/exchange_api_get-kyc-check-H_NORMALIZED_PAYTO.c @@ -424,10 +424,6 @@ TALER_EXCHANGE_get_kyc_check_start ( CURLOPT_TIMEOUT_MS, (long) (tms + 500L))); } - job_headers - = curl_slist_append ( - job_headers, - "Content-Type: application/json"); { union TALER_AccountPublicKeyP account_pub; union TALER_AccountSignatureP account_sig; diff --git a/src/lib/exchange_api_get-kyc-proof-PROVIDER_NAME.c b/src/lib/exchange_api_get-kyc-proof-PROVIDER_NAME.c @@ -119,6 +119,9 @@ handle_get_kyc_proof_finished (void *cls, { case 0: break; + case MHD_HTTP_OK: + /* KYC process already completed; nothing more to do */ + break; case MHD_HTTP_SEE_OTHER: { char *redirect_url; diff --git a/src/lib/exchange_api_post-batch-deposit.c b/src/lib/exchange_api_post-batch-deposit.c @@ -569,6 +569,11 @@ handle_deposit_finished (void *cls, "requirement_row", &dr->details.unavailable_for_legal_reasons.requirement_row), GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_fixed_auto ( + "account_pub", + &dr->details.unavailable_for_legal_reasons.account_pub), + NULL), + GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_bool ( "bad_kyc_auth", &dr->details.unavailable_for_legal_reasons.bad_kyc_auth), diff --git a/src/lib/exchange_api_post-kyc-wallet.c b/src/lib/exchange_api_post-kyc-wallet.c @@ -157,6 +157,16 @@ handle_kyc_wallet_finished (void *cls, GNUNET_JSON_spec_uint64 ( "requirement_row", &ks.details.unavailable_for_legal_reasons.requirement_row), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_fixed_auto ( + "account_pub", + &ks.details.unavailable_for_legal_reasons.account_pub), + NULL), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_bool ( + "bad_kyc_auth", + &ks.details.unavailable_for_legal_reasons.bad_kyc_auth), + NULL), GNUNET_JSON_spec_end () }; diff --git a/src/lib/exchange_api_post-purses-PURSE_PUB-merge.c b/src/lib/exchange_api_post-purses-PURSE_PUB-merge.c @@ -271,9 +271,22 @@ handle_purse_merge_finished (void *cls, case MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS: { struct GNUNET_JSON_Specification spec[] = { + GNUNET_JSON_spec_fixed_auto ( + "h_payto", + &dr.details.unavailable_for_legal_reasons.h_payto), GNUNET_JSON_spec_uint64 ( "requirement_row", &dr.details.unavailable_for_legal_reasons.requirement_row), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_fixed_auto ( + "account_pub", + &dr.details.unavailable_for_legal_reasons.account_pub), + NULL), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_bool ( + "bad_kyc_auth", + &dr.details.unavailable_for_legal_reasons.bad_kyc_auth), + NULL), GNUNET_JSON_spec_end () }; diff --git a/src/lib/exchange_api_post-reserves-RESERVE_PUB-purse.c b/src/lib/exchange_api_post-reserves-RESERVE_PUB-purse.c @@ -212,19 +212,15 @@ handle_purse_create_with_merge_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[] = { TALER_JSON_spec_amount_any ("total_deposited", - &total_deposited), + &dr.details.ok.total_deposited), 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), GNUNET_JSON_spec_end () }; @@ -240,7 +236,7 @@ handle_purse_create_with_merge_finished (void *cls, } if (GNUNET_OK != TALER_EXCHANGE_test_signing_key (prph->keys, - &exchange_pub)) + &dr.details.ok.exchange_pub)) { GNUNET_break_op (0); dr.hr.http_status = 0; @@ -249,14 +245,14 @@ handle_purse_create_with_merge_finished (void *cls, } if (GNUNET_OK != TALER_exchange_online_purse_created_verify ( - etime, + dr.details.ok.exchange_timestamp, prph->purse_expiration, &prph->purse_value_after_fees, - &total_deposited, + &dr.details.ok.total_deposited, &prph->purse_pub, &prph->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; @@ -350,9 +346,22 @@ handle_purse_create_with_merge_finished (void *cls, case MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS: { struct GNUNET_JSON_Specification spec[] = { + GNUNET_JSON_spec_fixed_auto ( + "h_payto", + &dr.details.unavailable_for_legal_reasons.h_payto), GNUNET_JSON_spec_uint64 ( "requirement_row", &dr.details.unavailable_for_legal_reasons.requirement_row), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_fixed_auto ( + "account_pub", + &dr.details.unavailable_for_legal_reasons.account_pub), + NULL), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_bool ( + "bad_kyc_auth", + &dr.details.unavailable_for_legal_reasons.bad_kyc_auth), + NULL), GNUNET_JSON_spec_end () }; diff --git a/src/lib/exchange_api_post-withdraw_blinded.c b/src/lib/exchange_api_post-withdraw_blinded.c @@ -418,9 +418,20 @@ handle_withdraw_blinded_finished ( GNUNET_JSON_spec_uint64 ( "requirement_row", &wbr.details.unavailable_for_legal_reasons.requirement_row), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_fixed_auto ( + "account_pub", + &wbr.details.unavailable_for_legal_reasons.account_pub), + NULL), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_bool ( + "bad_kyc_auth", + &wbr.details.unavailable_for_legal_reasons.bad_kyc_auth), + NULL), GNUNET_JSON_spec_end () }; + wbr.hr.ec = TALER_JSON_get_error_code (j_response); if (GNUNET_OK != GNUNET_JSON_parse (j_response, spec,