From ffcf44889d13d9a327cd47a2b1d44691cca21b9e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 24 Apr 2023 20:03:15 +0200 Subject: fix GET instance test failures --- src/backend/taler-merchant-httpd_private-get-instances-ID.c | 7 ++++--- src/include/taler_merchant_service.h | 5 +++++ src/lib/merchant_api_get_instance.c | 12 ++++++++---- 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID.c b/src/backend/taler-merchant-httpd_private-get-instances-ID.c index d2e3d937..2a2116d9 100644 --- a/src/backend/taler-merchant-httpd_private-get-instances-ID.c +++ b/src/backend/taler-merchant-httpd_private-get-instances-ID.c @@ -52,9 +52,10 @@ get_instances_ID (struct TMH_MerchantInstance *mi, GNUNET_JSON_pack_string ( "payto_uri", wm->payto_uri), - GNUNET_JSON_pack_string ( - "credit_facade_url", - wm->credit_facade_url), + GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_string ( + "credit_facade_url", + wm->credit_facade_url)), GNUNET_JSON_pack_data_auto ("h_wire", &wm->h_wire), GNUNET_JSON_pack_data_auto ( diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 39f39a3e..8cf8fbcc 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -718,6 +718,11 @@ struct TALER_MERCHANT_Account */ const char *payto_uri; + /** + * Credit facade URL of the account. + */ + const char *credit_facade_url; + /** * Hash of @e payto_uri and @e salt. */ diff --git a/src/lib/merchant_api_get_instance.c b/src/lib/merchant_api_get_instance.c index c8fbfc00..6807866f 100644 --- a/src/lib/merchant_api_get_instance.c +++ b/src/lib/merchant_api_get_instance.c @@ -137,19 +137,24 @@ handle_get_instance_finished (void *cls, { unsigned int accounts_length = json_array_size (accounts); struct TALER_MERCHANT_Account aa[accounts_length]; - const char *payto_uris[accounts_length]; size_t index; json_t *value; int ret = GNUNET_OK; - memset (payto_uris, 0, sizeof (payto_uris)); + memset (aa, + 0, + sizeof (aa)); json_array_foreach (accounts, index, value) { struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("salt", &aa[index].salt), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_string ("credit_facade_url", + &aa[index].credit_facade_url), + NULL), GNUNET_JSON_spec_string ("payto_uri", - &payto_uris[index]), + &aa[index].payto_uri), GNUNET_JSON_spec_fixed_auto ("h_wire", &aa[index].h_wire), GNUNET_JSON_spec_bool ("active", @@ -168,7 +173,6 @@ handle_get_instance_finished (void *cls, igr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; } - aa[index].payto_uri = payto_uris[index]; } if (GNUNET_OK == ret) -- cgit v1.2.3