From 2e13cfbbd212f13b3aefeeb9311c6c496d239963 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 11 Dec 2023 20:24:20 +0100 Subject: fakebank: implement change to bank integration API We now return the status field in POST /withdrawal-operation/$WITHDRAWAL_ID --- src/bank-lib/fakebank_tbi_post_withdrawal_operation.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/bank-lib/fakebank_tbi_post_withdrawal_operation.c b/src/bank-lib/fakebank_tbi_post_withdrawal_operation.c index 3dbbb3c91..38b92e494 100644 --- a/src/bank-lib/fakebank_tbi_post_withdrawal_operation.c +++ b/src/bank-lib/fakebank_tbi_post_withdrawal_operation.c @@ -53,6 +53,7 @@ do_post_withdrawal ( struct WithdrawalOperation *wo; char *credit_name; struct Account *credit_account; + const char *status_string; GNUNET_assert (0 == pthread_mutex_lock (&h->big_lock)); @@ -138,11 +139,20 @@ do_post_withdrawal ( wo->selection_done = true; GNUNET_assert (0 == pthread_mutex_unlock (&h->big_lock)); + if (wo->aborted) + status_string = "aborted"; + else if (wo->confirmation_done) + status_string = "confirmed"; + else + status_string = "selected"; return TALER_MHD_REPLY_JSON_PACK ( connection, MHD_HTTP_OK, + // FIXME: Deprecated field, should be deleted in the future. GNUNET_JSON_pack_bool ("transfer_done", - wo->confirmation_done)); + wo->confirmation_done), + GNUNET_JSON_pack_string ("status", + status_string)); } -- cgit v1.2.3 From c8a56f18cabc139b3f860b6eab3d9e4cb0c63355 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 11 Dec 2023 20:29:33 +0100 Subject: fakebank: update bank integration API The response to GET /withdrawal-operation/$WITHDRAWAL_ID also must include the status field. --- src/bank-lib/fakebank_tbi_get_withdrawal_operation.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/bank-lib/fakebank_tbi_get_withdrawal_operation.c b/src/bank-lib/fakebank_tbi_get_withdrawal_operation.c index fba8c5de6..4749bda77 100644 --- a/src/bank-lib/fakebank_tbi_get_withdrawal_operation.c +++ b/src/bank-lib/fakebank_tbi_get_withdrawal_operation.c @@ -56,6 +56,7 @@ TALER_FAKEBANK_tbi_get_withdrawal_operation_ ( { struct ConnectionContext *cc = *con_cls; struct WithdrawContext *wc; + const char *status_string; GNUNET_assert (0 == pthread_mutex_lock (&h->big_lock)); @@ -97,15 +98,28 @@ TALER_FAKEBANK_tbi_get_withdrawal_operation_ ( json_string ("x-taler-bank"))); GNUNET_assert (0 == pthread_mutex_unlock (&h->big_lock)); + if (wc->wo->aborted) + status_string = "aborted"; + else if (wc->wo->confirmation_done) + status_string = "confirmed"; + else if (wc->wo->selection_done) + status_string = "selected"; + else + status_string = "pending"; return TALER_MHD_REPLY_JSON_PACK ( connection, MHD_HTTP_OK, + // FIXME: deprecated field, should be removed in the future. GNUNET_JSON_pack_bool ("aborted", wc->wo->aborted), + // FIXME: deprecated field, should be removed in the future. GNUNET_JSON_pack_bool ("selection_done", wc->wo->selection_done), + // FIXME: deprecated field, should be removed in the future. GNUNET_JSON_pack_bool ("transfer_done", wc->wo->confirmation_done), + GNUNET_JSON_pack_string ("status", + status_string), GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_string ("suggested_exchange", h->exchange_url)), -- cgit v1.2.3