From acbadd5c6e98282c4c4d568942b4c36c825c3dad Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 13 Oct 2021 18:52:59 +0200 Subject: -modify C API to future-proof it for returning more details as required for KYC implementation --- src/lib/exchange_api_withdraw.c | 61 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 32 deletions(-) (limited to 'src/lib/exchange_api_withdraw.c') 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); } -- cgit v1.2.3