summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/taler-merchant-httpd.c11
-rw-r--r--src/backend/taler-merchant-httpd.h6
-rw-r--r--src/backend/taler-merchant-httpd_proposal.c35
3 files changed, 51 insertions, 1 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index f5705c88..2bf927db 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -557,6 +557,17 @@ instances_iterator_cb (void *cls,
mi = GNUNET_new (struct MerchantInstance);
if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (iic->config, section, "NAME", &mi->name))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ section,
+ "NAME");
+ GNUNET_free (mi);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+
+ if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (iic->config,
section,
"KEYFILE",
diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h
index 91dc7a22..1e917e7f 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -87,6 +87,11 @@ struct MerchantInstance
char *id;
/**
+ * Legal name of the merchant.
+ */
+ char *name;
+
+ /**
* File holding the merchant's private key
*/
char *keyfile;
@@ -130,7 +135,6 @@ struct MerchantInstance
* Only valid if @e tip_exchange is non-null.
*/
struct TALER_ReservePrivateKeyP tip_reserve;
-
};
diff --git a/src/backend/taler-merchant-httpd_proposal.c b/src/backend/taler-merchant-httpd_proposal.c
index f3fee473..bbd7d39c 100644
--- a/src/backend/taler-merchant-httpd_proposal.c
+++ b/src/backend/taler-merchant-httpd_proposal.c
@@ -248,6 +248,41 @@ proposal_put (struct MHD_Connection *connection,
json_integer ((json_int_t) default_wire_fee_amortization));
}
+ if (NULL == json_object_get (order, "pay_url"))
+ {
+ char *url;
+ url = TMH_make_absolute_backend_url (connection, "pay", NULL);
+ json_object_set_new (order, "pay_url", json_string (url));
+ }
+
+ if (NULL == json_object_get (order, "products"))
+ {
+ // FIXME: When there is no explicit product,
+ // should we create a singleton product list?
+ json_object_set_new (order, "products", json_object ());
+ }
+
+ const char *instance = json_string_value (json_object_get (order, "instance"));
+ if (NULL != instance)
+ {
+ // The frontend either fully specifieds the "merchant" field, or just gives
+ // the backend the "instance" name and lets it fill out.
+ struct MerchantInstance *mi = TMH_lookup_instance (instance);
+ if (NULL == mi)
+ {
+ return TMH_RESPONSE_reply_internal_error (connection,
+ TALER_EC_PROPOSAL_ORDER_PARSE_ERROR,
+ "merchant instance not found");
+ }
+ json_t *merchant = json_object ();
+ json_object_set_new (merchant, "instance", json_string (instance));
+ json_object_set_new (merchant, "name", json_string (mi->name));
+ json_object_set_new (merchant, "jurisdiction", json_string ("none"));
+ json_object_set_new (merchant, "address", json_string ("none"));
+ json_object_set_new (order, "merchant", merchant);
+ json_object_del (order, "instance");
+ }
+
/* extract fields we need to sign separately */
res = TMH_PARSE_json_data (connection,
order,