aboutsummaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_withdraw2.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-10-16 18:42:39 +0200
committerChristian Grothoff <christian@grothoff.org>2021-10-16 18:42:39 +0200
commit95c71daf5ee1954342490feabb6ec6220fa3f3e8 (patch)
treec029572e352913796e4b0a3af5b3e5912484614d /src/lib/exchange_api_withdraw2.c
parent681449a6e04e6b20bffdbd503db21145c2255ed2 (diff)
downloadexchange-95c71daf5ee1954342490feabb6ec6220fa3f3e8.tar.xz
handle new 202 accepted status code on withdraw in client logic
Diffstat (limited to 'src/lib/exchange_api_withdraw2.c')
-rw-r--r--src/lib/exchange_api_withdraw2.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/lib/exchange_api_withdraw2.c b/src/lib/exchange_api_withdraw2.c
index c8a959688..330f93d74 100644
--- a/src/lib/exchange_api_withdraw2.c
+++ b/src/lib/exchange_api_withdraw2.c
@@ -95,7 +95,7 @@ struct TALER_EXCHANGE_Withdraw2Handle
* @param json reply from the exchange
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
*/
-static int
+static enum GNUNET_GenericReturnValue
reserve_withdraw_ok (struct TALER_EXCHANGE_Withdraw2Handle *wh,
const json_t *json)
{
@@ -142,7 +142,7 @@ reserve_withdraw_ok (struct TALER_EXCHANGE_Withdraw2Handle *wh,
* @param json reply from the exchange
* @return #GNUNET_OK on success, #GNUNET_SYSERR on errors
*/
-static int
+static enum GNUNET_GenericReturnValue
reserve_withdraw_payment_required (
struct TALER_EXCHANGE_Withdraw2Handle *wh,
const json_t *json)
@@ -269,6 +269,28 @@ handle_reserve_withdraw_finished (void *cls,
GNUNET_assert (NULL == wh->cb);
TALER_EXCHANGE_withdraw2_cancel (wh);
return;
+ case MHD_HTTP_ACCEPTED:
+ /* only validate reply is well-formed */
+ {
+ uint64_t ptu;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_uint64 ("payment_target_uuid",
+ &ptu),
+ GNUNET_JSON_spec_end ()
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (j,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break_op (0);
+ hr.http_status = 0;
+ hr.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
+ break;
+ }
+ }
+ break;
case MHD_HTTP_BAD_REQUEST:
/* This should never happen, either us or the exchange is buggy
(or API version conflict); just pass JSON reply to the application */