From cf42868740b7481d2ebaac4ca0a152fbd9e97a95 Mon Sep 17 00:00:00 2001 From: Jonathan Buchanan Date: Wed, 29 Jul 2020 02:23:55 -0400 Subject: lib code/tests for claim token --- src/lib/merchant_api_post_order_claim.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/lib/merchant_api_post_order_claim.c') diff --git a/src/lib/merchant_api_post_order_claim.c b/src/lib/merchant_api_post_order_claim.c index 08e4f771..5ec2e243 100644 --- a/src/lib/merchant_api_post_order_claim.c +++ b/src/lib/merchant_api_post_order_claim.c @@ -166,13 +166,16 @@ handle_post_order_claim_finished (void *cls, /** - * Calls the GET /proposal API at the backend. That is, - * retrieve a proposal data by providing its transaction id. + * Calls the POST /orders/$ID/claim API at the backend. That is, + * retrieve the final contract terms including the client nonce. + * + * This is a PUBLIC API for wallets. * * @param ctx execution context * @param backend_url base URL of the merchant backend * @param order_id order id used to perform the lookup - * @param nonce nonce used to perform the lookup + * @param nonce nonce to use to claim the proposal + * @param claim_token the token used to verify the claim * @param cb callback which will work the response gotten from the backend * @param cb_cls closure to pass to @a cb * @return handle for this handle, NULL upon errors @@ -182,6 +185,7 @@ TALER_MERCHANT_order_claim (struct GNUNET_CURL_Context *ctx, const char *backend_url, const char *order_id, const struct GNUNET_CRYPTO_EddsaPublicKey *nonce, + const struct TALER_ClaimTokenP *claim_token, TALER_MERCHANT_OrderClaimCallback cb, void *cb_cls) { @@ -196,6 +200,13 @@ TALER_MERCHANT_order_claim (struct GNUNET_CURL_Context *ctx, GNUNET_break (0); return NULL; } + if (NULL != claim_token) + { + GNUNET_assert (0 == + json_object_set_new (req_obj, + "token", + GNUNET_JSON_from_data_auto (claim_token))); + } och = GNUNET_new (struct TALER_MERCHANT_OrderClaimHandle); och->ctx = ctx; och->cb = cb; -- cgit v1.2.3