[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-mdb] branch master updated: substitute PRODUCT_DESCRIPTION
From: |
gnunet |
Subject: |
[taler-taler-mdb] branch master updated: substitute PRODUCT_DESCRIPTION in fulfillment-msg |
Date: |
Mon, 24 Aug 2020 14:20:16 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository taler-mdb.
The following commit(s) were added to refs/heads/master by this push:
new e919344 substitute PRODUCT_DESCRIPTION in fulfillment-msg
e919344 is described below
commit e919344cc2bf38326abc4c31b5753dcbdaff8e5a
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Aug 24 14:20:14 2020 +0200
substitute PRODUCT_DESCRIPTION in fulfillment-msg
---
src/main.c | 30 ++++++++++++++++++++++++++----
taler.conf | 8 +-------
2 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/src/main.c b/src/main.c
index e50b5e6..21a87a0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1534,16 +1534,37 @@ launch_payment (struct Product *product)
{
struct PaymentActivity *pa;
json_t *orderReq;
+ char *msg;
+ const char *pos;
+
+ pos = strstr (fulfillment_msg,
+ "${PRODUCT_DESCRIPTION}");
+ if (NULL != pos)
+ {
+ /* replace ${PRODUCT_DESCRIPTION} with the real one */
+ GNUNET_asprintf (&msg,
+ "%.*s%s%s",
+ /* first output URL until ${PRODUCT_DESCRIPTION} */
+ (int) (pos - fulfillment_msg),
+ fulfillment_msg,
+ /* replace ${PRODUCT_DESCRIPTION} with the right
description */
+ product->description,
+ /* append rest of original URL */
+ pos + strlen ("${PRODUCT_DESCRIPTION}"));
+ }
+ else
+ {
+ msg = GNUNET_strdup (fulfillment_msg);
+ }
/* create the json object for the order request */
if (NULL != product->preview)
{
orderReq = json_pack ("{ s:s, s:s, s:o, s:s, s:o }",
- "summary",
- product->description,
+ "summary", product->description,
"preview", product->preview,
"amount", TALER_JSON_from_amount (&product->price),
- "fulfillment_message", fulfillment_msg,
+ "fulfillment_message", msg,
"auto_refund", GNUNET_JSON_from_time_rel (
MAX_REFUND_DELAY)
);
@@ -1554,11 +1575,12 @@ launch_payment (struct Product *product)
"summary",
product->description,
"amount", TALER_JSON_from_amount (&product->price),
- "fulfillment_message", fulfillment_msg,
+ "fulfillment_message", msg,
"auto_refund", GNUNET_JSON_from_time_rel (
MAX_REFUND_DELAY)
);
}
+ GNUNET_free (msg);
if (NULL == orderReq)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/taler.conf b/taler.conf
index 31d4292..f7add87 100644
--- a/taler.conf
+++ b/taler.conf
@@ -4,14 +4,8 @@ currency = TESTKUDOS
[taler-mdb]
backend-base-url = http://backend.test.taler.net/
backend-authorization = ApiKey Sandbox
-# taler url for success message (see taler documentation)
-fulfillment-url = taler://fulfillment-success
-# alternative url (see taler documentation)
-#fulfillment-url = https(s)://
# Message to diplay after purchase is completed,
-# will be concatenated with product
-# must be url - utf8 encoded
-fulfillment-msg = /Enjoy+your+
+fulfillment-msg = Enjoy your ${PRODUCT_DESCRIPTION}
# Name of the UART where the MDB connector is reachable.
UART_DEVICE = /dev/ttyAMA0
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-taler-mdb] branch master updated: substitute PRODUCT_DESCRIPTION in fulfillment-msg,
gnunet <=