gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] branch master updated: Adding function tha


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: Adding function that concatenates amount strings. Needed as payment generator now reads currency dynamically.
Date: Tue, 21 Mar 2017 21:21:15 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 2dc9f49  Adding function that concatenates amount strings. Needed as 
payment generator now reads currency dynamically.
2dc9f49 is described below

commit 2dc9f4973d7eca15cfe6c2215d07719dcb000f6e
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Mar 21 21:20:26 2017 +0100

    Adding function that concatenates amount strings.
    Needed as payment generator now reads currency dynamically.
---
 src/samples/generate_payments.c | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/src/samples/generate_payments.c b/src/samples/generate_payments.c
index 94c7fab..b9d25c0 100644
--- a/src/samples/generate_payments.c
+++ b/src/samples/generate_payments.c
@@ -1255,6 +1255,28 @@ do_shutdown (void *cls)
 }
 
 /**
+ * Take currency and the part after ":" in the
+ * "CURRENCY:XX.YY" format, and return a string
+ * in the format "CURRENCY:XX.YY".
+ *
+ * @param currency currency
+ * @param rpart float numbers after the ":", in string form
+ * @return pointer to allocated and concatenated "CURRENCY:XX.YY"
+ * formatted string.
+ *
+ * FIXME: deallocate this string from within the interpreter
+ * commands who use it.
+ */
+char *
+amount_concat (char *currency, char *rpart)
+{
+  char *ret;
+  GNUNET_asprintf (&ret, "%s:%s",
+                   currency, rpart);
+  return ret;
+}
+
+/**
  * Main function that will be run by the scheduler.
  *
  * @param cls closure
@@ -1285,25 +1307,25 @@ run (void *cls)
       .expected_response_code = MHD_HTTP_OK,
       .details.admin_add_incoming.sender_details = "{ \"type\":\"test\", 
\"account_number\":62, \"uuid\":1 }",
       .details.admin_add_incoming.transfer_details = "{ \"uuid\": 1}",
-      .details.admin_add_incoming.amount = CURRENCY ":5.01" },
+      .details.admin_add_incoming.amount = amount_concat (currency, "5.01") },
     /* Withdraw a 5 EUR coin, at fee of 1 ct */
     { .oc = OC_WITHDRAW_SIGN,
       .label = "withdraw-coin-1",
       .expected_response_code = MHD_HTTP_OK,
       .details.reserve_withdraw.reserve_reference = "create-reserve-1",
-      .details.reserve_withdraw.amount = CURRENCY ":5" },
+      .details.reserve_withdraw.amount = amount_concat (currency, "5") },
     /* Withdraw a 5 EUR coin, at fee of 1 ct */
     { .oc = OC_WITHDRAW_SIGN,
       .label = "withdraw-coin-2",
       .expected_response_code = MHD_HTTP_OK,
       .details.reserve_withdraw.reserve_reference = "create-reserve-2",
-      .details.reserve_withdraw.amount = CURRENCY ":5" },
+      .details.reserve_withdraw.amount = amount_concat (currency, "5") },
     /* Withdraw a 5 EUR coin, at fee of 1 ct */
     { .oc = OC_WITHDRAW_SIGN,
       .label = "withdraw-coin-3",
       .expected_response_code = MHD_HTTP_OK,
       .details.reserve_withdraw.reserve_reference = "create-reserve-3",
-      .details.reserve_withdraw.amount = CURRENCY ":5" },
+      .details.reserve_withdraw.amount = amount_concat (currency, "5") },
 
     /* Create proposal */
     { .oc = OC_PROPOSAL,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]