commit e5a5b6d566433dc59eebc275e75023790b0b1fbe
parent 7e83be753e05fbf22feeaa58e11f7c10b5e71afd
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date: Wed, 13 Mar 2024 10:13:35 +0100
[lib] batch-issue compiles
Diffstat:
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
@@ -25,8 +25,8 @@ libdonau_la_SOURCES = \
donau_api_charity_post.c \
donau_api_charity_delete.c \
donau_api_charities_get.c \
- donau_api_curl_defaults.c donau_api_curl_defaults.h
- #donau_api_batch_issue_receipts.c
+ donau_api_curl_defaults.c donau_api_curl_defaults.h \
+ donau_api_batch_issue_receipts.c
## maybe need libtalercurl
libdonau_la_LIBADD = \
diff --git a/src/lib/donau_api_batch_issue_receipts.c b/src/lib/donau_api_batch_issue_receipts.c
@@ -54,7 +54,7 @@ struct DONAU_BatchIssueReceiptHandle
/**
* Function to call with the result.
*/
- DONAU_PostCharityResponseCallback cb;
+ DONAU_BatchIssueReceiptsCallback cb;
/**
* BUDI-key-pair signature.
@@ -82,12 +82,16 @@ struct DONAU_BatchIssueReceiptHandle
* @param charity_sig signature from charity over @bkp
*/
json_t *
-budi_key_pair_to_json (const unsigned int num_bkp,
+issue_receipt_body_to_json (const unsigned int num_bkp,
const struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp[static num_bkp],
- const uint64_t year;
- const DONAU_CharitySignatureP *charity_sig)
+ const uint64_t year,
+ const struct DONAU_CharitySignatureP *charity_sig)
{
json_t *budikeypairs;
+
+ budikeypairs = json_array ();
+ GNUNET_assert (NULL != budikeypairs);
+
for (unsigned int i = 0; i < num_bkp; i++)
{
json_t *budikeypair;
@@ -95,7 +99,7 @@ budi_key_pair_to_json (const unsigned int num_bkp,
budikeypair = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("bkp",
&bkp[i]));
- GNUNET_assert (NULL != signkey);
+ GNUNET_assert (NULL != budikeypair);
GNUNET_assert (0 ==
json_array_append_new (budikeypairs,
budikeypair));
@@ -173,7 +177,7 @@ handle_batch_issue_finished (void *cls,
}
-struct DONAU_CharityPostHandle *
+struct DONAU_BatchIssueReceiptHandle *
DONAU_charity_issue_receipt (
struct GNUNET_CURL_Context *ctx,
const char *url,
@@ -186,26 +190,26 @@ DONAU_charity_issue_receipt (
void *cb_cls)
{
struct DONAU_BatchIssueReceiptHandle *birh;
+ birh = GNUNET_new (struct DONAU_BatchIssueReceiptHandle);
CURL *eh;
json_t *body;
// make signature over budi-key-pair
- DONAU_charity_budi_key_pair_sign(bkp, charity_priv, &birh->charity_sig);
+ DONAU_charity_budi_key_pair_sign(num_bkp, bkp, charity_priv, &birh->charity_sig);
TALER_LOG_DEBUG ("Connecting to the donau (%s)\n",
url);
- birh = GNUNET_new (struct DONAU_BatchIssueReceiptHandle);
birh->url = GNUNET_strdup (url);
birh->cb = cb;
birh->cb_cls = cb_cls;
birh->ctx = ctx;
- char arg_str[sizeof (id) * 2 + 32];
+ char arg_str[sizeof (charity_id) * 2 + 32];
GNUNET_snprintf (arg_str,
sizeof (arg_str),
"batch-issue/%llu",
(unsigned long long)
- id);
- cgh->url = TALER_url_join (url,
+ charity_id);
+ birh->url = TALER_url_join (url,
arg_str,
NULL);
if (NULL == birh->url)