diff options
Diffstat (limited to 'src/include/donau_service.h')
-rw-r--r-- | src/include/donau_service.h | 139 |
1 files changed, 106 insertions, 33 deletions
diff --git a/src/include/donau_service.h b/src/include/donau_service.h index 722f321..3f630e4 100644 --- a/src/include/donau_service.h +++ b/src/include/donau_service.h @@ -584,6 +584,89 @@ struct DONAU_DonorReceiptsToStatementResult */ struct DONAU_HttpResponse hr; +}; + + +/** + * Callbacks of this type are used to serve the result of submitting a + * permission request to a donau. + * + * @param cls closure + * @param dr response details + */ +typedef void +(*DONAU_DonorReceiptsToStatementResultCallback) ( + void *cls, + const struct DONAU_DonorReceiptsToStatementResult *dr); + + +/** + * Submit a batch of receipts to the donau and get the + * donau's response. This API is typically used by a donor. Note that + * while we return the response verbatim to the caller for further processing, + * we do already verify that the response is well-formed (i.e. that signatures + * included in the response are all valid). If the donau's reply is not + * well-formed, we return an HTTP status code of zero to @a cb. + * + * We also verify that the signature of the charity is valid for this + * request. Also, the @a donau must be ready to operate (i.e. have + * finished processing the /keys reply). If either check fails, we do + * NOT initiate the receipts with the donau and instead return NULL. + * + * @param ctx curl context + * @param url donau base URL + * @param num_drs length of the @a drs array + * @param drs array with details about the donation receipts + * @param year corresponding year + * @param h_donor_tax_id salted and hashed tax id + * @param cb the callback to call when a reply for this request is available + * @param cls closure for the above callback + * @param[out] ec if NULL is returned, set to the error code explaining why the operation failed + * @return a handle for this request; NULL if the inputs are invalid (i.e. + * signatures fail to verify). In this case, the callback is not called. + */ +struct DONAU_DonorReceiptsToStatementHandle * +DONAU_donor_receipts_to_statement ( + struct GNUNET_CURL_Context *ctx, + const char *url, + const size_t num_drs, + const struct DONAU_DonationReceipt drs[num_drs], + const uint64_t year, + const struct DONAU_HashDonorTaxId *h_donor_tax_id, + DONAU_DonorReceiptsToStatementResultCallback cb, + void *cls); + +/** + * Cancel a batch permission request. This function cannot be used + * on a request handle if a response is already served for it. + * + * @param[in] the Batch Submit recipts handle + */ +void +DONAU_donor_receipts_to_statement_cancel ( + struct DONAU_DonorReceiptsToStatementHandle *); + + +/* ********************* GET /donation-statement *********************** */ + + +/** + * @brief A get donation statement Handle + */ +struct DONAU_DonationStatementGetHandle; + + +/** + * Structure with information about a + * operation's result. + */ +struct DONAU_DonationStatementResponse +{ + /** + * HTTP response data + */ + struct DONAU_HttpResponse hr; + union { @@ -602,14 +685,14 @@ struct DONAU_DonorReceiptsToStatementResult * The donation statment for a requested year. Signature over the total amount, * the year, the unique identifier hash */ - struct DONAU_DonauSignatureP *sig; + struct DONAU_DonauSignatureP donation_statement_sig; - } ok; + /** + * The donau public to verify the signature. + */ + struct DONAU_DonauPublicKeyP donau_pub; - struct - { - /* TODO: returning full details is not implemented */ - } conflict; + } ok; } details; }; @@ -623,28 +706,20 @@ struct DONAU_DonorReceiptsToStatementResult * @param dr response details */ typedef void -(*DONAU_DonorReceiptsToStatementResultCallback) ( +(*DONAU_GetDonationStatmentResponseCallback) ( void *cls, - const struct DONAU_DonorReceiptsToStatementResult *dr); + const struct DONAU_DonationStatementResponse *dr); /** - * Submit a batch of receipts to the donau and get the - * donau's response. This API is typically used by a donor. Note that - * while we return the response verbatim to the caller for further processing, + * Get a specific donation statement from the donau. This API is typically used by a donor. + * Note that while we return the response verbatim to the caller for further processing, * we do already verify that the response is well-formed (i.e. that signatures * included in the response are all valid). If the donau's reply is not * well-formed, we return an HTTP status code of zero to @a cb. * - * We also verify that the signature of the charity is valid for this - * request. Also, the @a donau must be ready to operate (i.e. have - * finished processing the /keys reply). If either check fails, we do - * NOT initiate the receipts with the donau and instead return NULL. - * * @param ctx curl context * @param url donau base URL - * @param num_drs length of the @a drs array - * @param drs array with details about the donation receipts * @param year corresponding year * @param h_donor_tax_id salted and hashed tax id * @param cb the callback to call when a reply for this request is available @@ -653,16 +728,14 @@ typedef void * @return a handle for this request; NULL if the inputs are invalid (i.e. * signatures fail to verify). In this case, the callback is not called. */ -struct DONAU_DonorReceiptsToStatementHandle * -DONAU_donor_receipts_to_statement ( +struct DONAU_DonationStatementGetHandle * +DONAU_donation_statement_get ( struct GNUNET_CURL_Context *ctx, const char *url, - const size_t num_drs, - const struct DONAU_DonationReceipt drs[num_drs], const uint64_t year, const struct DONAU_HashDonorTaxId *h_donor_tax_id, - DONAU_DonorReceiptsToStatementResultCallback cb, - void *cls); + DONAU_GetDonationStatmentResponseCallback cb, + void *cb_cls); /** * Cancel a batch permission request. This function cannot be used @@ -671,8 +744,8 @@ DONAU_donor_receipts_to_statement ( * @param[in] the Batch Submit recipts handle */ void -DONAU_donor_receipts_to_statement_cancel ( - struct DONAU_DonorReceiptsToStatementHandle *); +DONAU_donation_statement_get_cancel ( + struct DONAU_DonationStatementGetHandle *); /* ********************* POST /csr batch-issue *********************** */ @@ -751,13 +824,13 @@ typedef void * In this case, the callback is not called. */ struct DONAU_CsRBatchIssueHandle * -DONAU_csr_batch_issue ( - struct GNUNET_CURL_Context *curl_ctx, - const char *donau_url, +DONAU_csr_issue ( + struct GNUNET_CURL_Context *ctx, + const char *url, const struct DONAU_DonationUnitPublicKey *pk, - const struct GNUNET_CRYPTO_CsBlindingNonce nonce, - DONAU_CsRBatchIssueCallback res_cb, - void *res_cb_cls); + const struct GNUNET_CRYPTO_CsSessionNonce *nonce, + DONAU_CsRBatchIssueCallback cb, + void *cb_cls); /** @@ -768,7 +841,7 @@ DONAU_csr_batch_issue ( * @param csrh the batch-issue handle */ void -DONAU_csr_batch_issue_cancel ( +DONAU_csr_cancel ( struct DONAU_CsRBatchIssueHandle *csrh); |