summaryrefslogtreecommitdiff
path: root/src/anastasis
diff options
context:
space:
mode:
Diffstat (limited to 'src/anastasis')
-rw-r--r--src/anastasis/Makefile.am1
-rw-r--r--src/anastasis/anastasis-gtk_action.c91
-rw-r--r--src/anastasis/anastasis-gtk_handle-challenge-iban.c53
3 files changed, 145 insertions, 0 deletions
diff --git a/src/anastasis/Makefile.am b/src/anastasis/Makefile.am
index 9ca420d..8efa113 100644
--- a/src/anastasis/Makefile.am
+++ b/src/anastasis/Makefile.am
@@ -21,6 +21,7 @@ anastasis_gtk_SOURCES = \
anastasis-gtk_handle-auth-edit-provider-clicked.c \
anastasis-gtk_handle-backup-button-clicked.c \
anastasis-gtk_handle-challenge-code.c \
+ anastasis-gtk_handle-challenge-iban.c \
anastasis-gtk_handle-challenge-row-activated.c \
anastasis-gtk_handle-challenge-question.c \
anastasis-gtk_handle-clear-secret-clicked.c \
diff --git a/src/anastasis/anastasis-gtk_action.c b/src/anastasis/anastasis-gtk_action.c
index 786df84..82c00bb 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -2810,6 +2810,95 @@ diag_code (const json_t *details)
/**
+ * Create a dialog for the user to make an IBAN transfer.
+ *
+ * @param details details about the dialog to render
+ * @return dialog object
+ */
+static GtkDialog *
+diag_iban (const json_t *details)
+{
+ GtkBuilder *builder;
+ struct TALER_Amount amount;
+ const char *credit_iban;
+ const char *business;
+ const char *subject;
+ struct GNUNET_JSON_Specification spec[] = {
+ TALER_JSON_spec_amount_any ("challenge_amount",
+ &amount),
+ GNUNET_JSON_spec_string ("credit_iban",
+ &credit_iban),
+ GNUNET_JSON_spec_string ("business_name",
+ &business),
+ GNUNET_JSON_spec_string ("wire_transfer_subject",
+ &subject),
+ GNUNET_JSON_spec_end ()
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (details,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break (0);
+ json_dumpf (details,
+ stderr,
+ JSON_INDENT (2));
+ return NULL;
+ }
+
+ builder = GNUNET_GTK_get_new_builder ("anastasis_gtk_challenge_iban.glade",
+ NULL);
+ if (NULL == builder)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ {
+ GtkLabel *label;
+
+#if 0
+ /* Note: need to extract the hint from the global
+ state, but not sure if the JSON argument gives
+ us the required data... */
+ label = GTK_LABEL (gtk_builder_get_object (builder,
+ "debit_account_label"));
+ gtk_label_set_text (label,
+ debit_iban_hint);
+#else
+ json_dumpf (details,
+ stderr,
+ JSON_INDENT (2));
+#endif
+ label = GTK_LABEL (gtk_builder_get_object (builder,
+ "credit_account_label"));
+ gtk_label_set_text (label,
+ credit_iban);
+ label = GTK_LABEL (gtk_builder_get_object (builder,
+ "provider_name_label"));
+ gtk_label_set_text (label,
+ business);
+ label = GTK_LABEL (gtk_builder_get_object (builder,
+ "wire_transfer_subject_label"));
+ gtk_label_set_text (label,
+ subject);
+ label = GTK_LABEL (gtk_builder_get_object (builder,
+ "amount_label"));
+ gtk_label_set_text (label,
+ TALER_amount2s (&amount));
+ }
+
+ {
+ GtkDialog *ad;
+
+ ad = GTK_DIALOG (gtk_builder_get_object (builder,
+ "anastasis_gtk_c_iban_dialog"));
+ return ad;
+ }
+}
+
+
+/**
* The user wants to solve the selected challenge. Launch the
* dialog to allow the user to enter the solution.
*/
@@ -2829,6 +2918,8 @@ action_challenge_solving (void)
.ctor = &diag_code },
{ .type = gettext_noop ("email"),
.ctor = &diag_code },
+ { .type = gettext_noop ("iban"),
+ .ctor = &diag_iban },
{ .type = NULL,
.ctor = NULL }
};
diff --git a/src/anastasis/anastasis-gtk_handle-challenge-iban.c b/src/anastasis/anastasis-gtk_handle-challenge-iban.c
new file mode 100644
index 0000000..64e6d46
--- /dev/null
+++ b/src/anastasis/anastasis-gtk_handle-challenge-iban.c
@@ -0,0 +1,53 @@
+/*
+ This file is part of anastasis-gtk.
+ Copyright (C) 2021 Anastasis SARL
+
+ Anastasis is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ Anastasis 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 Anastasis; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+/**
+ * @file src/anastasis/anastasis-gtk_handle-challenge-iban.c
+ * @brief Handle dialog for IBAN challenge
+ * @author Christian Grothoff
+ */
+#include <gnunet/platform.h>
+#include <gnunet/gnunet_util_lib.h>
+#include "anastasis-gtk.h"
+#include "anastasis-gtk_action.h"
+
+
+/**
+ * Function called from the IBAN dialog upon completion.
+ *
+ * @param dialog the pseudonym selection dialog
+ * @param response_id response code from the dialog
+ * @param user_data the builder of the dialog
+ */
+void
+anastasis_gtk_c_iban_dialog_response_cb (GtkDialog *dialog,
+ gint response_id,
+ gpointer user_data)
+{
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_object_unref (G_OBJECT (builder));
+ GNUNET_assert (NULL == AG_ra);
+ AG_ra = ANASTASIS_redux_action (AG_redux_state,
+ "back",
+ NULL,
+ &AG_action_cb,
+ NULL);
+}