merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit f9ff0790a2a94b7482dae6db07b1866f1605cd37
parent 74608a02e60f1b51198c45af40e9420ffdd2e2fb
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 10 Dec 2017 00:02:52 +0100

check return values

Diffstat:
Msrc/merchant-tools/taler-merchant-generate-payments.c | 27+++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/merchant-tools/taler-merchant-generate-payments.c b/src/merchant-tools/taler-merchant-generate-payments.c @@ -762,14 +762,15 @@ find_pk (const struct TALER_EXCHANGE_Keys *keys, * Allocates and return a string representing a order. * In this process, this function gives the order those * prices specified by the user. Please NOTE that any amount - * must be given in the form "XX.YY". + * must be given in the form "CUR:XX.YY". * * @param max_fee merchant's allowed max_fee * @param amount total amount for this order + * @return JSON string for the order, NULL on errors */ static json_t * -make_order (char *maxfee, - char *total) +make_order (const char *maxfee, + const char *total) { struct TALER_Amount tmp_amount; json_t *total_j; @@ -779,12 +780,26 @@ make_order (char *maxfee, struct GNUNET_TIME_Absolute now; char *timestamp; - TALER_string_to_amount (maxfee, &tmp_amount); + if (GNUNET_OK != + TALER_string_to_amount (maxfee, + &tmp_amount)) + { + GNUNET_break (0); + return NULL; + } maxfee_j = TALER_JSON_from_amount (&tmp_amount); - TALER_string_to_amount (total, &tmp_amount); + GNUNET_assert (NULL != maxfee_j); + if (GNUNET_OK != + TALER_string_to_amount (total, + &tmp_amount)) + { + GNUNET_break (0); + return NULL; + } total_j = TALER_JSON_from_amount (&tmp_amount); + GNUNET_assert (NULL != total_j); now = GNUNET_TIME_absolute_get (); - + GNUNET_TIME_round_abs (&now); GNUNET_asprintf (&timestamp, "/Date(%u)/", now.abs_value_us / 1000LL / 1000LL);