donau

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

commit 7eb42ecdd9afd9d577e0e0b394ca99782cfbd132
parent 741441eed9c4ef63ab9e5f6f121c127d491c3319
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Wed, 15 May 2024 10:39:58 +0200

parse JSON

Diffstat:
Msrc/donau/donau-httpd_batch-submit.c | 8++++----
Msrc/lib/donau_api_batch_submit_receipts.c | 4++--
Msrc/lib/donau_api_csr_post.c | 6+++---
Msrc/testing/test_donau_api.c | 8++++----
Msrc/testing/testing_api_cmd_issue_receipts.c | 6+++---
Msrc/util/donau_crypto.c | 3++-
6 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/donau/donau-httpd_batch-submit.c b/src/donau/donau-httpd_batch-submit.c @@ -37,7 +37,7 @@ */ struct InsertReceiptContext { - struct DONAU_HashDonorTaxId *h_donor_tax_id; + struct DONAU_HashDonorTaxId h_donor_tax_id; struct DONAU_DonationReceipt *donation_receipts; uint64_t donation_year; }; @@ -83,7 +83,7 @@ DH_handler_submit_receipts_post (struct DH_RequestContext *rc, const json_t *root, const char *const args[]) { - struct InsertReceiptContext irc; + struct InsertReceiptContext irc = {0}; const json_t *donation_receipts; struct GNUNET_JSON_Specification spec[] = { @@ -160,7 +160,7 @@ DH_handler_submit_receipts_post (struct DH_RequestContext *rc, } DONAU_unique_donor_id_hash ( - irc.h_donor_tax_id, + &irc.h_donor_tax_id, &irc.donation_receipts[i].nonce, &udi_hash); @@ -185,7 +185,7 @@ DH_handler_submit_receipts_post (struct DH_RequestContext *rc, qs = DH_plugin->insert_submitted_receipts ( DH_plugin->cls, - irc.h_donor_tax_id, + &irc.h_donor_tax_id, num_dr, irc.donation_receipts, irc.donation_year); diff --git a/src/lib/donau_api_batch_submit_receipts.c b/src/lib/donau_api_batch_submit_receipts.c @@ -93,7 +93,7 @@ submit_request_body_to_json (const size_t num_drs, &drs[i].h_donation_unit_pub), GNUNET_JSON_pack_data_auto ("nonce", &drs[i].nonce), - DONAU_JSON_pack_donation_unit_sig ("donau_sig", + DONAU_JSON_pack_donation_unit_sig ("donation_unit_sig", &drs[i].donation_unit_sig)); GNUNET_assert (0 == json_array_append_new (donation_receipts, @@ -102,7 +102,7 @@ submit_request_body_to_json (const size_t num_drs, return GNUNET_JSON_PACK ( GNUNET_JSON_pack_array_steal ("donation_receipts", donation_receipts), - GNUNET_JSON_pack_data_auto ("h_tax_number", + GNUNET_JSON_pack_data_auto ("h_donor_tax_id", h_tax_id), GNUNET_JSON_pack_uint64 ("donation_year", year)); diff --git a/src/lib/donau_api_csr_post.c b/src/lib/donau_api_csr_post.c @@ -122,9 +122,9 @@ handle_csr_issue_post_finished (void *cls, csrresp.hr.hint = TALER_JSON_get_error_hint (j); break; case MHD_HTTP_BAD_REQUEST: - csrresp.hr.ec = TALER_JSON_get_error_code (j); - csrresp.hr.hint = TALER_JSON_get_error_hint (j); - break; + csrresp.hr.ec = TALER_JSON_get_error_code (j); + csrresp.hr.hint = TALER_JSON_get_error_hint (j); + break; default: /* unexpected response code */ GNUNET_break_op (0); diff --git a/src/testing/test_donau_api.c b/src/testing/test_donau_api.c @@ -95,10 +95,10 @@ run (void *cls, "7560001010000", // tax id "1234", // salt for tax id hash MHD_HTTP_CREATED), -// TALER_TESTING_cmd_submit_receipts ("submit-receipts", -// "issue-receipts", // cmd trait reference -// 2024, -// MHD_HTTP_OK), + TALER_TESTING_cmd_submit_receipts ("submit-receipts", + "issue-receipts", // cmd trait reference + 2024, + MHD_HTTP_OK), TALER_TESTING_cmd_charity_delete ("delete-charity", "post-charity", // cmd trait reference &bearer, diff --git a/src/testing/testing_api_cmd_issue_receipts.c b/src/testing/testing_api_cmd_issue_receipts.c @@ -254,9 +254,9 @@ cs_stage_two_callback ( GNUNET_assert (GNUNET_CRYPTO_BSA_CS == cs_pk->bsign_pub_key->cipher); - DONAU_donation_unit_ewv_copy ( alg_values, - &csrresp->details.ok. - alg_values); + DONAU_donation_unit_ewv_copy (alg_values, + &csrresp->details.ok. + alg_values); GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG, &ps, sizeof (ps)); diff --git a/src/util/donau_crypto.c b/src/util/donau_crypto.c @@ -291,9 +291,10 @@ DONAU_donation_unit_ewv_rsa_singleton () return &alg_values; } + void DONAU_donation_unit_ewv_copy (struct DONAU_BatchIssueValues *bi_dst, - const struct DONAU_BatchIssueValues *bi_src) + const struct DONAU_BatchIssueValues *bi_src) { if (bi_src == DONAU_donation_unit_ewv_rsa_singleton ()) {