taler-mdb

GNU Taler Extensions and Integrations
Log | Files | Refs | Submodules | README | LICENSE

commit fab216bf576b574a06fb89ff23c5a5db18207ce4
parent ee24475b7d32ce9d6c39a1c6afe88d46fad8d33c
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Mon,  5 Feb 2024 17:48:11 +0100

show transient message when dispensing

Diffstat:
Msrc/taler-mdb.c | 58+++++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 41 insertions(+), 17 deletions(-)

diff --git a/src/taler-mdb.c b/src/taler-mdb.c @@ -684,6 +684,11 @@ static char *fulfillment_msg; static char *essid; /** + * Should we hide a transient error when MDB is ready? + */ +static bool clear_error_on_start; + +/** * Handle for the payment */ static struct PaymentActivity *payment_activity; @@ -1222,6 +1227,31 @@ order_delete_cb ( } +/** + * Clear the screen showing the QR code for the order. + * + * @param[in,out] pa payment activity to clear screen for + */ +static void +clear_screen (struct PaymentActivity *pa) +{ + if (NULL == pa->taler_pay_uri) + return; +#if HAVE_QRENCODE_H + if (NULL != qrDisplay.memory) + memset (qrDisplay.memory, + 0xFF, + qrDisplay.var_info.xres * qrDisplay.var_info.yres + * sizeof (uint16_t)); + if (0 < qrDisplay.backlightfd) + (void) ! write (qrDisplay.backlightfd, + &backlight_off, + 1); +#endif + GNUNET_free (pa->taler_pay_uri); +} + + static void cleanup_payment (struct PaymentActivity *pa) { @@ -1288,21 +1318,7 @@ cleanup_payment (struct PaymentActivity *pa) GNUNET_SCHEDULER_cancel (pa->delay_pay_task); pa->delay_pay_task = NULL; } - if (NULL != pa->taler_pay_uri) - { -#if HAVE_QRENCODE_H - if (NULL != qrDisplay.memory) - memset (qrDisplay.memory, - 0xFF, - qrDisplay.var_info.xres * qrDisplay.var_info.yres - * sizeof (uint16_t)); - if (0 < qrDisplay.backlightfd) - (void) ! write (qrDisplay.backlightfd, - &backlight_off, - 1); -#endif - GNUNET_free (pa->taler_pay_uri); - } + clear_screen (pa); GNUNET_free (pa->order_id); GNUNET_SCHEDULER_add_now (&async_pa_cleanup_job, pa); @@ -1744,7 +1760,7 @@ check_payment_cb (void *cls, (MHD_HTTP_REQUEST_TIMEOUT != hr->http_status) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Backend request to /check-payment failed: %u/%d\n", + "Backend request to GET /orders/$ID failed: %u/%d\n", hr->http_status, (int) hr->ec); mdb.cmd = &cmd_reader_display_backend_not_reachable; @@ -1757,11 +1773,14 @@ check_payment_cb (void *cls, } GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Backend request to /check-payment returned: %u\n", + "Backend request to GET /orders/$ID returned: %u\n", hr->http_status); if ( (MHD_HTTP_OK == hr->http_status) && (TALER_MERCHANT_OSC_PAID == osr->details.ok.status) ) { + clear_screen (pa); + clear_error_on_start = true; + temporary_error ("dispensing"); mdb.cmd = &cmd_approve_vend; payment_activity->paid = true; run_mdb_event_loop (); @@ -2043,6 +2062,11 @@ vend_success (void) cleanup_payment (payment_activity); payment_activity = NULL; } + if (clear_error_on_start) + { + hide_error (); + start_advertising (); + } }