diff options
Diffstat (limited to 'src/anastasis/anastasis-gtk_action.c')
-rw-r--r-- | src/anastasis/anastasis-gtk_action.c | 91 |
1 files changed, 91 insertions, 0 deletions
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 } }; |