donau

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

commit b0413b60f14520db759ffb89e8893f91e39ea81d
parent 7130aee6b2c600c47fcaf18eda83eb180b89d2a8
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Wed, 13 Mar 2024 20:52:50 +0100

[testing] working on issue receipts

Diffstat:
Msrc/include/donau_testing_lib.h | 4----
Msrc/testing/test_donau_api.c | 2--
Msrc/testing/testing_api_cmd_issue_receipts.c | 61+++++++++++++++++++++++++------------------------------------
3 files changed, 25 insertions(+), 42 deletions(-)

diff --git a/src/include/donau_testing_lib.h b/src/include/donau_testing_lib.h @@ -118,8 +118,6 @@ TALER_TESTING_cmd_charities_get (const char *label, * @param label the command label. * @param charity_reference reference for traits * @param year current year (mostly) - * @param num_bkp number of @bkp - * @param bkp budi key pair array * @param expected_response_code expected HTTP response code. * @return the command. */ @@ -127,8 +125,6 @@ struct TALER_TESTING_Command TALER_TESTING_cmd_issue_receipts (const char *label, const char *charity_reference, const uint64_t year, - const unsigned int num_bkp, - const struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp[static num_bkp], unsigned int expected_response_code); /** diff --git a/src/testing/test_donau_api.c b/src/testing/test_donau_api.c @@ -94,8 +94,6 @@ run (void *cls, TALER_TESTING_cmd_issue_receipts ("issue-receipts", "post-charity", 2024, - 24, - bkp, MHD_HTTP_CREATED), TALER_TESTING_cmd_charity_delete("delete-charity", "post-charity", // cmd trait reference diff --git a/src/testing/testing_api_cmd_issue_receipts.c b/src/testing/testing_api_cmd_issue_receipts.c @@ -39,9 +39,9 @@ struct StatusState struct DONAU_BatchIssueReceiptHandle *birh; /** - * The charity POST request. + * Reference to charity post command. */ - struct DONAU_CharityRequest charity_req; + const char *charity_reference; /** * Private key of the charity, for signature. @@ -127,9 +127,29 @@ status_run (void *cls, struct TALER_TESTING_Interpreter *is) { struct StatusState *ss = cls; - ss->is = is; + /* Get charity id from trait */ + { + const struct TALER_TESTING_Command *charity_post_cmd; + const unsigned long long *charity_id; + + charity_post_cmd = TALER_TESTING_interpreter_lookup_command (is, + ss->charity_reference); + + if (GNUNET_OK != + TALER_TESTING_get_trait_charity_id (charity_post_cmd, + &charity_id)) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } + ss->charity_id = (uint64_t) *(charity_id); + } + + // TODO: build bkps with traits from /keys request + ss->birh = DONAU_charity_issue_receipt ( TALER_TESTING_interpreter_get_context (is), TALER_TESTING_get_donau_url (is), @@ -145,7 +165,7 @@ status_run (void *cls, /** - * Cleanup the state from a "reserve status" CMD, and possibly + * Cleanup the state from a "issue receipt status" CMD, and possibly * cancel a pending operation thereof. * * @param cls closure. @@ -169,42 +189,11 @@ cleanup (void *cls, } -/** - * Offer internal data from a "deposit" CMD, to other commands. - * - * @param cls closure. - * @param[out] ret result. - * @param trait name of the trait. - * @param index index number of the object to offer. - * @return #GNUNET_OK on success. - */ -static enum GNUNET_GenericReturnValue -charity_post_traits (void *cls, - const void **ret, - const char *trait, - unsigned int index) -{ - struct StatusState *ss = cls; - struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_charity_priv (&ss->charity_priv), - TALER_TESTING_make_trait_charity_pub (&ss->charity_req.charity_pub), - TALER_TESTING_make_trait_charity_id (&ss->charity_id), - TALER_TESTING_trait_end () - }; - - return TALER_TESTING_get_trait (traits, - ret, - trait, - index); -} - struct TALER_TESTING_Command TALER_TESTING_cmd_issue_receipts (const char *label, const char *charity_reference, const uint64_t year, - const unsigned int num_bkp, - const struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp[static num_bkp], unsigned int expected_response_code) { struct StatusState *ss; @@ -212,6 +201,7 @@ TALER_TESTING_cmd_issue_receipts (const char *label, ss = GNUNET_new (struct StatusState); ss->year = year; + ss->charity_reference = charity_reference; ss->expected_response_code = expected_response_code; { struct TALER_TESTING_Command cmd = { @@ -219,7 +209,6 @@ TALER_TESTING_cmd_issue_receipts (const char *label, .label = label, .run = &status_run, .cleanup = &cleanup - //.traits = &charity_post_traits }; return cmd;