summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/Makefile.am2
-rw-r--r--contrib/request_payment.must2
-rw-r--r--src/backend/taler-merchant-httpd_get-orders-ID.c80
3 files changed, 55 insertions, 29 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 589b36f3..17c8ea4a 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1,3 +1,5 @@
+pkgdatadir = $(prefix)/share/taler/merchant/
+
dist_pkgdata_DATA = \
request_payment.must \
offer_refund.must
diff --git a/contrib/request_payment.must b/contrib/request_payment.must
index 89062b6f..6ef7794e 100644
--- a/contrib/request_payment.must
+++ b/contrib/request_payment.must
@@ -153,7 +153,7 @@ body {
<p>
You can use this QR code to pay with your mobile wallet:
</p>
- {{taler_pay_qrcode_svg}}
+ {{{taler_pay_qrcode_svg}}}
<p>
Click <a href="{{taler_pay_uri}}">this link</a> to open your system's
Taler wallet if it exists.
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c
index 2c7ec572..d906b89b 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -319,6 +319,21 @@ m_enter (void *cls, const char *name)
/**
+ * Function called by mustach to activate the next item in the
+ * section. Does nothing, as we do not support sections.
+ *
+ * @param cls a `struct KVC[]` array
+ * @return 0 (no next item to activate)
+ */
+static int
+m_next (void *cls)
+{
+ (void) cls;
+ return 0;
+}
+
+
+/**
* Function called by Mustach to leave the current section.
* As we do not support sections, we should never be called.
*
@@ -359,6 +374,9 @@ m_get (void *cls,
return MUSTACH_OK;
}
}
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Template requires value for unexpected name `%s'\n",
+ name);
return MUSTACH_ERROR_ITEM_NOT_FOUND;
}
@@ -385,10 +403,11 @@ m_stop (void *cls,
* Our 'universal' callbacks for mustach.
*/
static struct mustach_itf itf = {
- .enter = m_enter,
- .leave = m_leave,
- .get = m_get,
- .stop = m_stop
+ .enter = &m_enter,
+ .next = &m_next,
+ .leave = &m_leave,
+ .get = &m_get,
+ .stop = &m_stop
};
@@ -429,7 +448,7 @@ load_template (const char *name)
return NULL;
}
GNUNET_asprintf (&fn,
- "%s/%s.must",
+ "%s/merchant/%s.must",
path,
name);
GNUNET_free (path);
@@ -533,7 +552,7 @@ create_qrcode (const char *uri)
QRinput_free (qri);
/* FIXME-Dold: generate <img> with inline SVG instead of <pre> here! */
GNUNET_buffer_write_str (&buf,
- "<pre>\n\n\n\n ");
+ "<pre><br><br><br><br><br> ");
for (unsigned int y = 0; y<qrc->width; y++)
{
for (unsigned int x = 0; x<qrc->width; x++)
@@ -544,10 +563,10 @@ create_qrcode (const char *uri)
(0 != (qrc->data[off] & 1)) ? "██" : " ");
}
GNUNET_buffer_write_str (&buf,
- "\n ");
+ "<br> ");
}
GNUNET_buffer_write_str (&buf,
- "\n\n\n\n</pre>");
+ "<br><br><br><br></pre>");
QRcode_free (qrc);
return GNUNET_buffer_reap_str (&buf);
}
@@ -712,26 +731,31 @@ send_pay_request (struct GetOrderData *god,
GNUNET_strdup (taler_pay_uri) },
{ "taler_pay_qrcode_svg",
qr },
+ { "order_summary",
+ GNUNET_strdup ("FIXME") },
{ NULL, NULL }
};
const char *tmpl;
+ int eno;
tmpl = load_template ("request_payment");
if (NULL == tmpl)
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
- "mustach");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to load template `%s'\n",
+ "request_payment");
return MHD_NO; // FIXME: add nicer error reply...
}
if (0 !=
- mustach (tmpl,
- &itf,
- &kvc,
- &body,
- &body_size))
+ (eno = mustach (tmpl,
+ &itf,
+ &kvc,
+ &body,
+ &body_size)))
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
- "mustach");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "mustach failed with error %d\n",
+ eno);
return MHD_NO; // FIXME: add nicer error reply...
}
}
@@ -1233,13 +1257,12 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
struct TALER_ClaimTokenP db_claim_token;
-#if FIXME_6446
- qs = TMH_db->lookup_order_token (TMH_db->cls,
- hc->instance->settings.id,
- order_id,
- &god->contract_terms,
- &db_claim_token);
+ qs = TMH_db->lookup_order (TMH_db->cls,
+ hc->instance->settings.id,
+ order_id,
+ &db_claim_token,
+ &god->contract_terms);
if (0 > qs)
{
/* single, read-only SQL statements should never cause
@@ -1252,7 +1275,6 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
TALER_EC_GET_ORDERS_DB_LOOKUP_ERROR,
"database error looking up order");
}
-#endif
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -1569,8 +1591,9 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
tmpl = load_template ("offer_refund");
if (NULL == tmpl)
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
- "mustach");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to load template `%s'\n",
+ "offer_refund");
return MHD_NO; // FIXME: add nicer error reply...
}
if (0 !=
@@ -1595,8 +1618,9 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
tmpl = load_template ("show_order_details");
if (NULL == tmpl)
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
- "mustach");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to load template `%s'\n",
+ "show_order_details");
return MHD_NO; // FIXME: add nicer error reply...
}
if (0 !=