summaryrefslogtreecommitdiff
path: root/src/lib/merchant_api_post_instances.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-04-23 22:57:55 +0200
committerChristian Grothoff <christian@grothoff.org>2023-04-23 22:57:55 +0200
commit154f964aab5df00cbadaa015474c2b323161aa96 (patch)
tree084f300e664fb96d0693baf73434ed245ef56641 /src/lib/merchant_api_post_instances.c
parent889595f986d922ffbcdcd746fdfad7f1a0e53595 (diff)
downloadmerchant-154f964aab5df00cbadaa015474c2b323161aa96.tar.gz
merchant-154f964aab5df00cbadaa015474c2b323161aa96.tar.bz2
merchant-154f964aab5df00cbadaa015474c2b323161aa96.zip
API change for #6363
Diffstat (limited to 'src/lib/merchant_api_post_instances.c')
-rw-r--r--src/lib/merchant_api_post_instances.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/lib/merchant_api_post_instances.c b/src/lib/merchant_api_post_instances.c
index 85069dc3..88ef3a06 100644
--- a/src/lib/merchant_api_post_instances.c
+++ b/src/lib/merchant_api_post_instances.c
@@ -165,7 +165,7 @@ TALER_MERCHANT_instances_post (
const char *backend_url,
const char *instance_id,
unsigned int accounts_length,
- const char *payto_uris[],
+ const struct TALER_MERCHANT_AccountConfig accounts[],
const char *name,
enum TALER_KYCLOGIC_KycUserType ut,
const json_t *address,
@@ -180,7 +180,7 @@ TALER_MERCHANT_instances_post (
void *cb_cls)
{
struct TALER_MERCHANT_InstancesPostHandle *iph;
- json_t *jpayto_uris;
+ json_t *jaccounts;
json_t *req_obj;
json_t *auth_obj;
const char *uts;
@@ -219,8 +219,8 @@ TALER_MERCHANT_instances_post (
GNUNET_break (0);
return NULL;
}
- jpayto_uris = json_array ();
- if (NULL == jpayto_uris)
+ jaccounts = json_array ();
+ if (NULL == jaccounts)
{
json_decref (auth_obj);
GNUNET_break (0);
@@ -228,19 +228,35 @@ TALER_MERCHANT_instances_post (
}
for (unsigned int i = 0; i<accounts_length; i++)
{
+ const struct TALER_MERCHANT_AccountConfig *account = &accounts[i];
+ json_t *jaccount =
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string (
+ "payto_uri",
+ account->payto_uri),
+ GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_string (
+ "credit_facade_url",
+ account->credit_facade_url)),
+ GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_object_incref (
+ "credit_facade_credentials",
+ accounts->credit_facade_credentials))
+ );
+
if (0 !=
- json_array_append_new (jpayto_uris,
- json_string (payto_uris[i])))
+ json_array_append_new (jaccounts,
+ jaccount))
{
GNUNET_break (0);
json_decref (auth_obj);
- json_decref (jpayto_uris);
+ json_decref (jaccounts);
return NULL;
}
}
req_obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_array_steal ("payto_uris",
- jpayto_uris),
+ GNUNET_JSON_pack_array_steal ("accounts",
+ jaccounts),
GNUNET_JSON_pack_string ("id",
instance_id),
GNUNET_JSON_pack_string ("name",