summaryrefslogtreecommitdiff
path: root/src/lib/merchant_api_merchant_get_order.c
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2023-11-25 16:05:05 +0900
committerChristian Grothoff <grothoff@gnunet.org>2023-11-25 16:05:05 +0900
commit7782a680228b6e76ae2598cacfc65ff250e8e020 (patch)
tree8a1e4e462808077b49cee038fed6b634d9176313 /src/lib/merchant_api_merchant_get_order.c
parent6fa958a3cec156bc0eb89ddfae8b150d7400d2be (diff)
downloadmerchant-7782a680228b6e76ae2598cacfc65ff250e8e020.tar.gz
merchant-7782a680228b6e76ae2598cacfc65ff250e8e020.tar.bz2
merchant-7782a680228b6e76ae2598cacfc65ff250e8e020.zip
-update to new spec parsers for better error checking
Diffstat (limited to 'src/lib/merchant_api_merchant_get_order.c')
-rw-r--r--src/lib/merchant_api_merchant_get_order.c21
1 files changed, 8 insertions, 13 deletions
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;
}