From 7782a680228b6e76ae2598cacfc65ff250e8e020 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 25 Nov 2023 16:05:05 +0900 Subject: -update to new spec parsers for better error checking --- src/lib/merchant_api_merchant_get_order.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/lib/merchant_api_merchant_get_order.c') diff --git a/src/lib/merchant_api_merchant_get_order.c b/src/lib/merchant_api_merchant_get_order.c index a8a50738..5e3a5ead 100644 --- a/src/lib/merchant_api_merchant_get_order.c +++ b/src/lib/merchant_api_merchant_get_order.c @@ -166,7 +166,6 @@ static void handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, struct TALER_MERCHANT_OrderStatusResponse *osr) { - uint32_t ec32; uint32_t hc32; const json_t *wire_details; const json_t *wire_reports; @@ -180,8 +179,8 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, &osr->details.ok.details.paid.wired), TALER_JSON_spec_amount_any ("deposit_total", &osr->details.ok.details.paid.deposit_total), - GNUNET_JSON_spec_uint32 ("exchange_code", - &ec32), + TALER_JSON_spec_ec ("exchange_code", + &osr->details.ok.details.paid.exchange_ec), GNUNET_JSON_spec_uint32 ("exchange_http_status", &hc32), TALER_JSON_spec_amount_any ("refund_amount", @@ -211,7 +210,7 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, return; } osr->details.ok.status = TALER_MERCHANT_OSC_PAID; - osr->details.ok.details.paid.exchange_ec = (enum TALER_ErrorCode) ec32; + osr->details.ok.details.paid.exchange_hc = (unsigned int) hc32; { unsigned int wts_len = json_array_size (wire_details); @@ -227,7 +226,7 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, const json_t *w = json_array_get (wire_details, i); struct GNUNET_JSON_Specification ispec[] = { - GNUNET_JSON_spec_string ("exchange_url", + TALER_JSON_spec_web_url ("exchange_url", &wt->exchange_url), GNUNET_JSON_spec_fixed_auto ("wtid", &wt->wtid), @@ -258,16 +257,14 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, { struct TALER_MERCHANT_WireReport *wr = &wrs[i]; const json_t *w = json_array_get (wire_reports, i); - uint32_t c32; - uint32_t eec32; uint32_t ehs32; struct GNUNET_JSON_Specification ispec[] = { - GNUNET_JSON_spec_uint32 ("code", - &c32), + TALER_JSON_spec_ec ("code", + &wr->code), GNUNET_JSON_spec_string ("hint", &wr->hint), - GNUNET_JSON_spec_uint32 ("exchange_code", - &eec32), + TALER_JSON_spec_ec ("exchange_code", + &wr->hr.ec), GNUNET_JSON_spec_uint32 ("exchange_http_status", &ehs32), GNUNET_JSON_spec_fixed_auto ("coin_pub", @@ -287,8 +284,6 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, osr); return; } - wr->code = (enum TALER_ErrorCode) c32; - wr->hr.ec = (enum TALER_ErrorCode) eec32; wr->hr.http_status = (unsigned int) ehs32; } -- cgit v1.2.3