taler-mdb

GNU Taler Extensions and Integrations
Log | Files | Refs | Submodules | README | LICENSE

commit 16b3b2875b389508dbb67db5c06ad430a1935de3
parent 25fb310061e4763dd692be481f58b5b32c329aba
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Fri, 20 May 2022 17:11:07 +0200

-products must be an array

Diffstat:
Msrc/main.c | 28++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -1676,6 +1676,22 @@ launch_payment (struct Product *product) /* create the json object for the order request */ if (NULL != product->preview) { + json_t *products; + + products = json_array (); + GNUNET_assert (NULL != products); + GNUNET_assert ( + 0 == + json_array_append_new (products, + GNUNET_JSON_PACK ( + GNUNET_JSON_pack_string ("description", + product->description), + GNUNET_JSON_pack_string ("image", + product->preview), + TALER_JSON_pack_amount ("price", + &product->price), + GNUNET_JSON_pack_uint64 ("quantity", + 1)))); orderReq = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("summary", product->description), @@ -1684,17 +1700,9 @@ launch_payment (struct Product *product) GNUNET_TIME_relative_to_timestamp ( PAY_TIMEOUT)), #endif - GNUNET_JSON_pack_object_steal ( + GNUNET_JSON_pack_array_steal ( "products", - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("description", - product->description), - GNUNET_JSON_pack_string ("image", - product->preview), - TALER_JSON_pack_amount ("price", - &product->price), - GNUNET_JSON_pack_uint64 ("quantity", - 1))), + products), TALER_JSON_pack_amount ("amount", &product->price), GNUNET_JSON_pack_string ("fulfillment_message",