diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-03-05 21:57:46 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-03-05 21:57:46 +0100 |
commit | eac90da9bc7db641b91d364586de856dac6faaef (patch) | |
tree | 92b9bf39dd23a3cb9677e13feb4b63a0454cc950 /src/reducer | |
parent | b9a9d2f6101b5211987861f56cd6e35331f96faa (diff) | |
download | anastasis-eac90da9bc7db641b91d364586de856dac6faaef.tar.gz anastasis-eac90da9bc7db641b91d364586de856dac6faaef.tar.bz2 anastasis-eac90da9bc7db641b91d364586de856dac6faaef.zip |
consistently give display_name human-readable translated hints
Diffstat (limited to 'src/reducer')
-rw-r--r-- | src/reducer/anastasis_api_recovery_redux.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/reducer/anastasis_api_recovery_redux.c b/src/reducer/anastasis_api_recovery_redux.c index f783195..0e81e5a 100644 --- a/src/reducer/anastasis_api_recovery_redux.c +++ b/src/reducer/anastasis_api_recovery_redux.c @@ -536,16 +536,21 @@ start_feedback_cb ( case ANASTASIS_CHALLENGE_START_STATUS_FILENAME_PROVIDED: { json_t *instructions; + char *hint; + GNUNET_asprintf (&hint, + _ ("Required TAN can be found in `%s'"), + csr->details.tan_filename); instructions = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("state", "code-in-file"), GNUNET_JSON_pack_string ("filename", csr->details.tan_filename), GNUNET_JSON_pack_string ("display_hint", - csr->details.tan_filename), + hint), GNUNET_JSON_pack_uint64 ("http_status", (json_int_t) csr->http_status)); + GNUNET_free (hint); GNUNET_assert (0 == json_object_set_new (feedback, uuid, @@ -561,16 +566,21 @@ start_feedback_cb ( case ANASTASIS_CHALLENGE_START_STATUS_TAN_SENT_HINT_PROVIDED: { json_t *instructions; + char *hint; + GNUNET_asprintf (&hint, + _ ("TAN code was sent to `%s'"), + csr->details.tan_address_hint); instructions = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("state", "send-to-address"), GNUNET_JSON_pack_string ("address_hint", csr->details.tan_address_hint), GNUNET_JSON_pack_string ("display_hint", - csr->details.tan_address_hint), + hint), GNUNET_JSON_pack_uint64 ("http_status", (json_int_t) csr->http_status)); + GNUNET_free (hint); GNUNET_assert (0 == json_object_set_new (feedback, uuid, @@ -586,7 +596,11 @@ start_feedback_cb ( case ANASTASIS_CHALLENGE_START_STATUS_PAYMENT_REQUIRED: { json_t *pay; + char *hint; + GNUNET_asprintf (&hint, + _ ("Taler payment to `%s' required"), + csr->details.payment_required.taler_pay_uri); pay = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("state", "taler-payment"), @@ -596,10 +610,11 @@ start_feedback_cb ( GNUNET_JSON_pack_string ("provider", cd->provider_url), GNUNET_JSON_pack_string ("display_hint", - csr->details.payment_required.taler_pay_uri), + hint), GNUNET_JSON_pack_data_auto ( "payment_secret", &csr->details.payment_required.payment_secret)); + GNUNET_free (hint); GNUNET_assert (0 == json_object_set_new (feedback, uuid, @@ -632,9 +647,6 @@ start_feedback_cb ( err = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("state", "server-failure"), - GNUNET_JSON_pack_string ( - "display_hint", - _ ("The Anastasis provider experienced a failure")), GNUNET_JSON_pack_uint64 ("http_status", csr->http_status), GNUNET_JSON_pack_uint64 ("error_code", @@ -660,9 +672,6 @@ start_feedback_cb ( "truth-unknown"), GNUNET_JSON_pack_uint64 ("http_status", csr->http_status), - GNUNET_JSON_pack_string ( - "display_hint", - _ ("The provider does not have the requested information")), GNUNET_JSON_pack_uint64 ("error_code", TALER_EC_ANASTASIS_TRUTH_UNKNOWN)); GNUNET_assert (0 == @@ -840,8 +849,6 @@ answer_feedback_cb ( instructions = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("status", "incorrect-answer"), - GNUNET_JSON_pack_string ("display_hint", - _ ("The provided answer was incorrect")), GNUNET_JSON_pack_uint64 ("error_code", csr->ec), GNUNET_JSON_pack_uint64 ("http_status", @@ -861,7 +868,11 @@ answer_feedback_cb ( case ANASTASIS_CHALLENGE_ANSWER_STATUS_PAYMENT_REQUIRED: { json_t *pay; + char *hint; + GNUNET_asprintf (&hint, + _ ("Taler payment to `%s' required"), + csr->details.payment_required.taler_pay_uri); pay = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("state", "taler-payment"), @@ -870,12 +881,13 @@ answer_feedback_cb ( csr->details.payment_required.taler_pay_uri), GNUNET_JSON_pack_string ( "display_hint", - csr->details.payment_required.taler_pay_uri), + hint), GNUNET_JSON_pack_string ("provider", cd->provider_url), GNUNET_JSON_pack_data_auto ( "payment_secret", &csr->details.payment_required.payment_secret)); + GNUNET_free (hint); GNUNET_assert (0 == json_object_set_new (feedback, uuid, @@ -908,9 +920,6 @@ answer_feedback_cb ( err = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("state", "server-failure"), - GNUNET_JSON_pack_string ( - "display_hint", - _ ("The Anastasis provider experienced a failure")), GNUNET_JSON_pack_uint64 ("http_status", csr->http_status), GNUNET_JSON_pack_uint64 ("error_code", @@ -936,8 +945,6 @@ answer_feedback_cb ( "truth-unknown"), GNUNET_JSON_pack_uint64 ("http_status", csr->http_status), - GNUNET_JSON_pack_string ("display_hint", - TALER_ErrorCode_get_hint (csr->ec)), GNUNET_JSON_pack_uint64 ("error_code", TALER_EC_ANASTASIS_TRUTH_UNKNOWN)); GNUNET_assert (0 == |