summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-12-11 20:29:33 +0100
committerFlorian Dold <florian@dold.me>2023-12-11 20:29:33 +0100
commitc8a56f18cabc139b3f860b6eab3d9e4cb0c63355 (patch)
tree317490db8b669bda8718d04a0333056c6434bf92
parent2e13cfbbd212f13b3aefeeb9311c6c496d239963 (diff)
downloadexchange-c8a56f18cabc139b3f860b6eab3d9e4cb0c63355.tar.gz
exchange-c8a56f18cabc139b3f860b6eab3d9e4cb0c63355.tar.bz2
exchange-c8a56f18cabc139b3f860b6eab3d9e4cb0c63355.zip
fakebank: update bank integration API
The response to GET /withdrawal-operation/$WITHDRAWAL_ID also must include the status field.
-rw-r--r--src/bank-lib/fakebank_tbi_get_withdrawal_operation.c14
1 files changed, 14 insertions, 0 deletions
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)),