summaryrefslogtreecommitdiff
path: root/src/lib/merchant_api_post_order_claim.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/merchant_api_post_order_claim.c')
-rw-r--r--src/lib/merchant_api_post_order_claim.c64
1 files changed, 25 insertions, 39 deletions
diff --git a/src/lib/merchant_api_post_order_claim.c b/src/lib/merchant_api_post_order_claim.c
index 66e58c2a..76802ea5 100644
--- a/src/lib/merchant_api_post_order_claim.c
+++ b/src/lib/merchant_api_post_order_claim.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2021 Taler Systems SA
+ Copyright (C) 2014-2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -86,40 +86,36 @@ handle_post_order_claim_finished (void *cls,
const void *response)
{
struct TALER_MERCHANT_OrderClaimHandle *och = cls;
- json_t *contract_terms;
- struct TALER_MerchantSignatureP sig;
- struct TALER_PrivateContractHashP hash;
const json_t *json = response;
+ struct TALER_MERCHANT_OrderClaimResponse ocr = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
+ };
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("contract_terms",
- &contract_terms),
- GNUNET_JSON_spec_fixed_auto ("sig",
- &sig),
+ GNUNET_JSON_spec_object_const (
+ "contract_terms",
+ &ocr.details.ok.contract_terms),
+ GNUNET_JSON_spec_fixed_auto (
+ "sig",
+ &ocr.details.ok.sig),
GNUNET_JSON_spec_end ()
};
- struct TALER_MERCHANT_HttpResponse hr = {
- .http_status = (unsigned int) response_code,
- .reply = json
- };
och->job = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Order claimed with status %u\n",
(unsigned int) response_code);
if (MHD_HTTP_OK != response_code)
{
- hr.ec = TALER_JSON_get_error_code (json);
- hr.hint = TALER_JSON_get_error_hint (json);
+ ocr.hr.ec = TALER_JSON_get_error_code (json);
+ ocr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Proposal lookup failed with HTTP status code %u/%d\n",
(unsigned int) response_code,
- (int) hr.ec);
+ (int) ocr.hr.ec);
och->cb (och->cb_cls,
- &hr,
- NULL,
- NULL,
- NULL);
+ &ocr);
TALER_MERCHANT_order_claim_cancel (och);
return;
}
@@ -132,39 +128,29 @@ handle_post_order_claim_finished (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Claiming order failed: could not parse JSON response\n");
GNUNET_break_op (0);
- hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- hr.http_status = 0;
+ ocr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ ocr.hr.http_status = 0;
och->cb (och->cb_cls,
- &hr,
- NULL,
- NULL,
- NULL);
+ &ocr);
TALER_MERCHANT_order_claim_cancel (och);
return;
}
if (GNUNET_OK !=
- TALER_JSON_contract_hash (contract_terms,
- &hash))
+ TALER_JSON_contract_hash (ocr.details.ok.contract_terms,
+ &ocr.details.ok.h_contract_terms))
{
GNUNET_break (0);
- hr.ec = TALER_EC_MERCHANT_POST_ORDERS_ID_CLAIM_CLIENT_INTERNAL_FAILURE;
- hr.http_status = 0;
+ ocr.hr.ec = TALER_EC_MERCHANT_POST_ORDERS_ID_CLAIM_CLIENT_INTERNAL_FAILURE;
+ ocr.hr.http_status = 0;
GNUNET_JSON_parse_free (spec);
och->cb (och->cb_cls,
- &hr,
- NULL,
- NULL,
- NULL);
+ &ocr);
TALER_MERCHANT_order_claim_cancel (och);
return;
}
-
och->cb (och->cb_cls,
- &hr,
- contract_terms,
- &sig,
- &hash);
+ &ocr);
GNUNET_JSON_parse_free (spec);
TALER_MERCHANT_order_claim_cancel (och);
}