[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis-gtk] branch master updated: implement lookup_recovery_c
From: |
gnunet |
Subject: |
[taler-anastasis-gtk] branch master updated: implement lookup_recovery_cost |
Date: |
Fri, 12 Mar 2021 14:35:35 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis-gtk.
The following commit(s) were added to refs/heads/master by this push:
new d7640c0 implement lookup_recovery_cost
d7640c0 is described below
commit d7640c04ac35add9f648d332861f011391755ea1
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Mar 12 14:35:33 2021 +0100
implement lookup_recovery_cost
---
src/anastasis/anastasis-gtk_action.c | 46 +++++++++++++++++++++++++++++++++++-
1 file changed, 45 insertions(+), 1 deletion(-)
diff --git a/src/anastasis/anastasis-gtk_action.c
b/src/anastasis/anastasis-gtk_action.c
index 8321ac0..42ebc34 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -634,11 +634,55 @@ lookup_recovery_cost (const char *provider,
const char *type,
struct TALER_Amount *method_cost)
{
+ json_t *aps;
+ json_t *ap;
+ json_t *methods;
+ size_t index;
+ json_t *method;
+
memset (method_cost,
0,
sizeof (struct TALER_Amount));
+ aps = json_object_get (redux_state,
+ "authentication_providers");
+ GNUNET_assert (NULL != aps);
+ ap = json_object_get (aps,
+ provider);
+ if (NULL == ap)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ methods = json_object_get (ap,
+ "methods");
+ json_array_foreach (methods, index, method)
+ {
+ struct TALER_Amount fee;
+ const char *mtype;
+ struct GNUNET_JSON_Specification spec[] = {
+ TALER_JSON_spec_amount ("usage_fee",
+ &fee),
+ GNUNET_JSON_spec_string ("type",
+ &mtype),
+ GNUNET_JSON_spec_end ()
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (method,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break (0);
+ continue;
+ }
+ if (0 == strcmp (mtype,
+ type))
+ {
+ *method_cost = fee;
+ return;
+ }
+ }
GNUNET_break (0);
- // redux_state.authentication_providers[url].methods[*].type = type =>
usage_fee
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis-gtk] branch master updated: implement lookup_recovery_cost,
gnunet <=