merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit d289bb8718d6cb2f3962e325e9d8d7156dd12af8
parent 5adf8fabdcd28402acb0e19a5254431111890984
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Sun,  3 Sep 2023 17:58:43 +0200

adaptations for #7275

Diffstat:
Msrc/bank/mb_credit.c | 25+++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)

diff --git 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,