summaryrefslogtreecommitdiff
path: root/src/bank-lib/bank_api_common.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-12-06 19:24:00 +0100
committerChristian Grothoff <christian@grothoff.org>2017-12-06 19:24:00 +0100
commit042616899f89d38167632e3ff24b16469a27fbef (patch)
treecd0bfb86882f3cc8cd493e7fb3cb0e5ea00e356c /src/bank-lib/bank_api_common.c
parent5540747ca2e5f37f2df504d689b850d1078fcdc5 (diff)
downloadexchange-042616899f89d38167632e3ff24b16469a27fbef.tar.gz
exchange-042616899f89d38167632e3ff24b16469a27fbef.tar.bz2
exchange-042616899f89d38167632e3ff24b16469a27fbef.zip
largely fix #5077
Diffstat (limited to 'src/bank-lib/bank_api_common.c')
-rw-r--r--src/bank-lib/bank_api_common.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/bank-lib/bank_api_common.c b/src/bank-lib/bank_api_common.c
index 738d2a5b8..b4b197492 100644
--- a/src/bank-lib/bank_api_common.c
+++ b/src/bank-lib/bank_api_common.c
@@ -80,7 +80,7 @@ TALER_BANK_make_auth_header_ (const struct TALER_BANK_AuthenticationData *auth)
authh = append (authh,
"X-Taler-Bank-Password",
auth->details.basic.password);
- return authh;
+ return authh;
}
return NULL;
}
@@ -111,5 +111,33 @@ TALER_BANK_path_to_url_ (const char *u,
}
+/**
+ * Parse error code given in @a json.
+ *
+ * @param json the json to parse
+ * @return error code, or #TALER_EC_INVALID if not found
+ */
+enum TALER_ErrorCode
+TALER_BANK_parse_ec_ (const json_t *json)
+{
+ uint32_t ec;
+
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_uint32 ("ec",
+ &ec),
+ GNUNET_JSON_spec_end()
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (json,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break_op (0);
+ return TALER_EC_INVALID;
+ }
+ return (enum TALER_ErrorCode) ec;
+}
+
/* end of bank_api_common.c */