summaryrefslogtreecommitdiff
path: root/src/bank-lib/bank_api_debit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bank-lib/bank_api_debit.c')
-rw-r--r--src/bank-lib/bank_api_debit.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/bank-lib/bank_api_debit.c b/src/bank-lib/bank_api_debit.c
index e40156ce7..58dc0a736 100644
--- a/src/bank-lib/bank_api_debit.c
+++ b/src/bank-lib/bank_api_debit.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2017--2022 Taler Systems SA
+ Copyright (C) 2017--2023 Taler Systems SA
TALER is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -82,15 +82,20 @@ parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh,
.ec = TALER_EC_NONE,
.response = history
};
- json_t *history_array;
+ const json_t *history_array;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_array_const ("outgoing_transactions",
+ &history_array),
+ GNUNET_JSON_spec_string ("debit_account",
+ &dhr.details.ok.debit_account_uri),
+ GNUNET_JSON_spec_end ()
+ };
- if (NULL == (history_array = json_object_get (history,
- "outgoing_transactions")))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (! json_is_array (history_array))
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (history,
+ spec,
+ NULL,
+ NULL))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
@@ -114,8 +119,6 @@ parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh,
&td->wtid),
GNUNET_JSON_spec_string ("credit_account",
&td->credit_account_uri),
- GNUNET_JSON_spec_string ("debit_account",
- &td->debit_account_uri),
GNUNET_JSON_spec_string ("exchange_base_url",
&td->exchange_base_url),
GNUNET_JSON_spec_end ()