exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit aa19314cc57e0db045b84829410c01e0084cb540
parent a9c54ef2095fa930f500eeaa606c34621948e706
Author: Özgür Kesim <oec-taler@kesim.org>
Date:   Mon, 11 Dec 2023 22:00:27 +0100

Merge branch 'master' of ssh://git.taler.net/exchange

Diffstat:
Msrc/bank-lib/fakebank_tbi_get_withdrawal_operation.c | 14++++++++++++++
Msrc/bank-lib/fakebank_tbi_post_withdrawal_operation.c | 12+++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)

diff --git 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)), diff --git 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)); }