/*
This file is part of TALER
(C) 2014--2020 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see
*/
/**
* @file taler-merchant-httpd_helper.c
* @brief shared logic for various handlers
* @author Christian Grothoff
*/
#include "platform.h"
#include
#include
#include
#include "taler-merchant-httpd_helper.h"
/**
* check @a payto_uris for well-formedness
*
* @param payto_uris JSON array of payto URIs (presumably)
* @return true if they are all valid URIs (and this is an array of strings)
*/
bool
TMH_payto_uri_array_valid (const json_t *payto_uris)
{
bool payto_ok = true;
if (! json_is_array (payto_uris))
{
GNUNET_break_op (0);
payto_ok = false;
}
else
{
unsigned int len = json_array_size (payto_uris);
for (unsigned int i = 0; ij_wire = json_pack ("{s:s, s:o}",
"payto_uri", payto_uri,
"salt", GNUNET_JSON_from_data_auto (&salt));
GNUNET_assert (NULL != wm->j_wire);
/* This also tests for things like the IBAN being malformed */
GNUNET_assert (GNUNET_OK ==
TALER_JSON_merchant_wire_signature_hash (wm->j_wire,
&wm->h_wire));
wm->wire_method
= TALER_payto_get_method (payto_uri);
GNUNET_assert (NULL != wm->wire_method); /* checked earlier */
wm->active = true;
return wm;
}