donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 99cafcd070243660a5f38de1d1ba9f6d30173fac
parent 65efabc74d61df615652373a900c04d5d53753c8
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Tue, 19 Mar 2024 13:28:03 +0100

[donau] add ec and make charity lookup for issue receipts

Diffstat:
Msrc/donau/donau-httpd_post-batch-issue.c | 39+++++++++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/donau/donau-httpd_post-batch-issue.c b/src/donau/donau-httpd_post-batch-issue.c @@ -203,11 +203,39 @@ DH_handler_issue_receipts_post (struct DH_RequestContext *rc, "budikeypairs"); } + // Get charity pub + + struct DONAUDB_CharityMetaData meta; + enum GNUNET_DB_QueryStatus qs; + //MHD_RESULT result; + + qs = DH_plugin->lookup_charity (DH_plugin->cls, + (uint64_t) charity_id, + &meta); + switch (qs) + { + case GNUNET_DB_STATUS_HARD_ERROR: + case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_break (0); + return TALER_MHD_reply_with_error (rc->connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, + NULL); + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: + return TALER_MHD_reply_with_error ( + rc->connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_DONAU_CHARITY_NOT_FOUND, + NULL); + break; + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: + break; + } + /* verify charity signature */ - //TODO: Get charity pub if (GNUNET_OK != DONAU_charity_budi_key_pair_verify(num_bkp, &irc.bkp, - &irc.charity_pub, + &meta.charity_pub, &irc.charity_sig)) { GNUNET_break_op (0); @@ -261,8 +289,11 @@ DH_handler_issue_receipts_post (struct DH_RequestContext *rc, // meta.current_year)); - MHD_RESULT result; - return result; + return TALER_MHD_reply_with_error ( + rc->connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_DONAU_CHARITY_NOT_FOUND, + NULL); }