aboutsummaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_withdraw.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-10-13 18:52:59 +0200
committerChristian Grothoff <christian@grothoff.org>2021-10-13 18:52:59 +0200
commitacbadd5c6e98282c4c4d568942b4c36c825c3dad (patch)
tree80560e70be10ff5a77265ef1b5e54bdf3998be62 /src/lib/exchange_api_withdraw.c
parent9e25e39b80657f2fa07be22d878b2d3d8c4b5b45 (diff)
downloadexchange-acbadd5c6e98282c4c4d568942b4c36c825c3dad.tar.xz
-modify C API to future-proof it for returning more details as required for KYC implementation
Diffstat (limited to 'src/lib/exchange_api_withdraw.c')
-rw-r--r--src/lib/exchange_api_withdraw.c61
1 files changed, 29 insertions, 32 deletions
diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c
index b96adacd4..aa1468247 100644
--- a/src/lib/exchange_api_withdraw.c
+++ b/src/lib/exchange_api_withdraw.c
@@ -91,44 +91,41 @@ handle_reserve_withdraw_finished (
const struct GNUNET_CRYPTO_RsaSignature *blind_sig)
{
struct TALER_EXCHANGE_WithdrawHandle *wh = cls;
+ struct TALER_EXCHANGE_WithdrawResponse wr = {
+ .hr = *hr
+ };
wh->wh2 = NULL;
- if (MHD_HTTP_OK != hr->http_status)
+ switch (hr->http_status)
{
- wh->cb (wh->cb_cls,
- hr,
- NULL);
- }
- else
- {
- struct TALER_FreshCoin fc;
-
- if (GNUNET_OK !=
- TALER_planchet_to_coin (&wh->pk.key,
- blind_sig,
- &wh->ps,
- &wh->c_hash,
- &fc))
+ case MHD_HTTP_OK:
{
- struct TALER_EXCHANGE_HttpResponse hrx = {
- .reply = hr->reply,
- .http_status = 0,
- .ec = TALER_EC_EXCHANGE_WITHDRAW_UNBLIND_FAILURE
- };
-
- wh->cb (wh->cb_cls,
- &hrx,
- NULL);
+ struct TALER_FreshCoin fc;
+
+ if (GNUNET_OK !=
+ TALER_planchet_to_coin (&wh->pk.key,
+ blind_sig,
+ &wh->ps,
+ &wh->c_hash,
+ &fc))
+ {
+ wr.hr.http_status = 0;
+ wr.hr.ec = TALER_EC_EXCHANGE_WITHDRAW_UNBLIND_FAILURE;
+ break;
+ }
+ wr.details.success.sig = fc.sig;
+ break;
}
- else
- {
- wh->cb (wh->cb_cls,
- hr,
- &fc.sig);
- GNUNET_CRYPTO_rsa_signature_free (fc.sig.rsa_signature);
- }
-
+ case MHD_HTTP_ACCEPTED:
+ wr.details.accepted.payment_target_uuid; // FIXME
+ break;
+ default:
+ break;
}
+ wh->cb (wh->cb_cls,
+ &wr);
+ if (MHD_HTTP_OK == hr->http_status)
+ GNUNET_CRYPTO_rsa_signature_free (wr.details.success.sig.rsa_signature);
TALER_EXCHANGE_withdraw_cancel (wh);
}