diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-03-03 09:31:38 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-03-03 09:31:38 +0100 |
commit | 892a3dac2ed4303fb58016b7170bd9f00c9e6b6b (patch) | |
tree | 4b34be4a6dea0385a9a78ea5da15f7c5c0261cc6 /src/backend | |
parent | bb6163e9eda287af4947e0fd7e1f66a4e9809814 (diff) | |
download | merchant-892a3dac2ed4303fb58016b7170bd9f00c9e6b6b.tar.gz merchant-892a3dac2ed4303fb58016b7170bd9f00c9e6b6b.tar.bz2 merchant-892a3dac2ed4303fb58016b7170bd9f00c9e6b6b.zip |
stay with simple strings, i18n now to be solved in backwards-compatible way (reverting previous i18n patch)
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/taler-merchant-httpd_order.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/backend/taler-merchant-httpd_order.c b/src/backend/taler-merchant-httpd_order.c index c873be9b..67da89c3 100644 --- a/src/backend/taler-merchant-httpd_order.c +++ b/src/backend/taler-merchant-httpd_order.c @@ -68,16 +68,34 @@ check_products (json_t *products) return GNUNET_SYSERR; } json_array_foreach (products, index, value) { - - if (NULL == json_object_get (value, - "description")) + const char *description; + const char *error_name; + unsigned int error_line; + int res; + struct GNUNET_JSON_Specification spec[] = { + GNUNET_JSON_spec_string ("description", &description), + /* FIXME: there are other fields in the product specification + that are currently not labeled as optional. Maybe check + those as well, or make them truly optional. */ + GNUNET_JSON_spec_end () + }; + + /* extract fields we need to sign separately */ + res = GNUNET_JSON_parse (value, + spec, + &error_name, + &error_line); + if (GNUNET_OK != res) { GNUNET_break (0); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Product description parsing failed at product #%u\n", - (unsigned int) index); + "Product description parsing failed at #%u: %s:%u\n", + (unsigned int) index, + error_name, + error_line); return GNUNET_SYSERR; } + GNUNET_JSON_parse_free (spec); } return GNUNET_OK; } @@ -195,7 +213,7 @@ proposal_put (struct MHD_Connection *connection, int res; struct TALER_Amount total; const char *order_id; - json_t *summary; + const char *summary; const char *fulfillment_url; json_t *products; json_t *merchant; @@ -206,7 +224,7 @@ proposal_put (struct MHD_Connection *connection, struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_amount ("amount", &total), GNUNET_JSON_spec_string ("order_id", &order_id), - GNUNET_JSON_spec_json ("summary", &summary), + GNUNET_JSON_spec_string ("summary", &summary), GNUNET_JSON_spec_string ("fulfillment_url", &fulfillment_url), /** |