summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2023-09-03 17:58:43 +0200
committerChristian Grothoff <grothoff@gnunet.org>2023-09-03 17:58:43 +0200
commitd289bb8718d6cb2f3962e325e9d8d7156dd12af8 (patch)
tree320dee89ee258c5e61ea045c283c988631240703
parent5adf8fabdcd28402acb0e19a5254431111890984 (diff)
downloadmerchant-d289bb8718d6cb2f3962e325e9d8d7156dd12af8.tar.gz
merchant-d289bb8718d6cb2f3962e325e9d8d7156dd12af8.tar.bz2
merchant-d289bb8718d6cb2f3962e325e9d8d7156dd12af8.zip
adaptations for #7275
-rw-r--r--src/bank/mb_credit.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/bank/mb_credit.c b/src/bank/mb_credit.c
index 345a79c8..65da86e0 100644
--- a/src/bank/mb_credit.c
+++ b/src/bank/mb_credit.c
@@ -69,15 +69,21 @@ static enum GNUNET_GenericReturnValue
parse_account_history (struct TALER_MERCHANT_BANK_CreditHistoryHandle *hh,
const json_t *history)
{
- json_t *history_array;
+ const json_t *history_array;
+ const char *credit_account_uri;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_array_const ("incoming_transactions",
+ &history_array),
+ GNUNET_JSON_spec_string ("credit_account",
+ &credit_account_uri),
+ GNUNET_JSON_spec_end ()
+ };
- if (NULL == (history_array = json_object_get (history,
- "incoming_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;
@@ -97,8 +103,6 @@ parse_account_history (struct TALER_MERCHANT_BANK_CreditHistoryHandle *hh,
&td.wire_subject),
GNUNET_JSON_spec_string ("debit_account",
&td.debit_account_uri),
- GNUNET_JSON_spec_string ("credit_account",
- &td.credit_account_uri),
GNUNET_JSON_spec_end ()
};
json_t *transaction = json_array_get (history_array,
@@ -112,6 +116,7 @@ parse_account_history (struct TALER_MERCHANT_BANK_CreditHistoryHandle *hh,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+ td.credit_account_uri = credit_account_uri;
if (GNUNET_OK !=
hh->hcb (hh->hcb_cls,
MHD_HTTP_OK,