commit ffcf44889d13d9a327cd47a2b1d44691cca21b9e
parent 941180fa33b3abc5cc2a826e99e1aaeb1d9034f7
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 24 Apr 2023 20:03:15 +0200
fix GET instance test failures
Diffstat:
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git 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
@@ -719,6 +719,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.
*/
struct TALER_MerchantWireHashP h_wire;
diff --git 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)