diff options
Diffstat (limited to 'src/lib/merchant_api_merchant_get_order.c')
-rw-r--r-- | src/lib/merchant_api_merchant_get_order.c | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/src/lib/merchant_api_merchant_get_order.c b/src/lib/merchant_api_merchant_get_order.c index a0c1995b..a8a50738 100644 --- a/src/lib/merchant_api_merchant_get_order.c +++ b/src/lib/merchant_api_merchant_get_order.c @@ -130,9 +130,9 @@ handle_claimed (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, struct TALER_MERCHANT_OrderStatusResponse *osr) { struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_json ("contract_terms", - (json_t **) &osr->details.ok.details.claimed. - contract_terms), + GNUNET_JSON_spec_object_const ( + "contract_terms", + &osr->details.ok.details.claimed.contract_terms), GNUNET_JSON_spec_end () }; @@ -151,7 +151,6 @@ handle_claimed (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, osr->details.ok.status = TALER_MERCHANT_OSC_CLAIMED; omgh->cb (omgh->cb_cls, osr); - GNUNET_JSON_parse_free (spec); } @@ -169,9 +168,9 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, { uint32_t ec32; uint32_t hc32; - json_t *wire_details; - json_t *wire_reports; - json_t *refund_details; + const json_t *wire_details; + const json_t *wire_reports; + const json_t *refund_details; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_bool ("refunded", &osr->details.ok.details.paid.refunded), @@ -187,15 +186,15 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, &hc32), TALER_JSON_spec_amount_any ("refund_amount", &osr->details.ok.details.paid.refund_amount), - GNUNET_JSON_spec_json ( + GNUNET_JSON_spec_object_const ( "contract_terms", - (json_t **) &osr->details.ok.details.paid.contract_terms), - GNUNET_JSON_spec_json ("wire_details", - &wire_details), - GNUNET_JSON_spec_json ("wire_reports", - &wire_reports), - GNUNET_JSON_spec_json ("refund_details", - &refund_details), + &osr->details.ok.details.paid.contract_terms), + GNUNET_JSON_spec_array_const ("wire_details", + &wire_details), + GNUNET_JSON_spec_array_const ("wire_reports", + &wire_reports), + GNUNET_JSON_spec_array_const ("refund_details", + &refund_details), GNUNET_JSON_spec_end () }; @@ -211,19 +210,6 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, osr); return; } - if (! (json_is_array (wire_details) && - json_is_array (wire_reports) && - json_is_array (refund_details) && - json_is_object (osr->details.ok.details.paid.contract_terms)) ) - { - GNUNET_break_op (0); - osr->hr.http_status = 0; - osr->hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; - omgh->cb (omgh->cb_cls, - osr); - GNUNET_JSON_parse_free (spec); - 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; @@ -264,7 +250,6 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, osr->hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; omgh->cb (omgh->cb_cls, osr); - GNUNET_JSON_parse_free (spec); return; } } @@ -300,7 +285,6 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, osr->hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; omgh->cb (omgh->cb_cls, osr); - GNUNET_JSON_parse_free (spec); return; } wr->code = (enum TALER_ErrorCode) c32; @@ -333,7 +317,6 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, osr->hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED; omgh->cb (omgh->cb_cls, osr); - GNUNET_JSON_parse_free (spec); return; } } @@ -347,7 +330,6 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, omgh->cb (omgh->cb_cls, osr); } - GNUNET_JSON_parse_free (spec); } |