diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-07-17 13:18:00 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-07-29 12:18:46 +0200 |
commit | b6e1a74a413949268a76766e5ba49263f59d6c44 (patch) | |
tree | 0dbe5ad715f5d70159813e5dbad65ac70ee25118 /src | |
parent | 99ede27f90d7124990b565cabfd354a20f184cdd (diff) |
return KYCAUTH transfers from fakebank account history API
Diffstat (limited to 'src')
-rw-r--r-- | src/bank-lib/fakebank.h | 2 | ||||
-rw-r--r-- | src/bank-lib/fakebank_twg_history.c | 67 |
2 files changed, 56 insertions, 13 deletions
diff --git a/src/bank-lib/fakebank.h b/src/bank-lib/fakebank.h index d0802a895..87c7a4af1 100644 --- a/src/bank-lib/fakebank.h +++ b/src/bank-lib/fakebank.h @@ -401,7 +401,7 @@ struct Transaction /** * Subject of the transfer. */ - struct TALER_WadIdentifierP wad; + struct TALER_WadIdentifierP wad_id; /** * Base URL of the originating exchange. diff --git a/src/bank-lib/fakebank_twg_history.c b/src/bank-lib/fakebank_twg_history.c index 5dfc160b0..ccb385537 100644 --- a/src/bank-lib/fakebank_twg_history.c +++ b/src/bank-lib/fakebank_twg_history.c @@ -454,7 +454,8 @@ TALER_FAKEBANK_twg_get_credit_history_ ( { json_t *trans; - if (T_CREDIT != pos->type) + if ( (T_CREDIT != pos->type) && + (T_AUTH != pos->type) ) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unexpected DEBIT transaction #%llu for account `%s'\n", @@ -466,17 +467,59 @@ TALER_FAKEBANK_twg_get_credit_history_ ( pos = pos->next_in; continue; } - trans = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_uint64 ("row_id", - pos->row_id), - GNUNET_JSON_pack_timestamp ("date", - pos->date), - TALER_JSON_pack_amount ("amount", - &pos->amount), - GNUNET_JSON_pack_string ("debit_account", - pos->debit_account->payto_uri), - GNUNET_JSON_pack_data_auto ("reserve_pub", - &pos->subject.credit.reserve_pub)); + switch (pos->type) + { + case T_DEBIT: + GNUNET_assert (0); + break; + case T_WAD: + trans = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_string ("type", + "WAD"), + GNUNET_JSON_pack_uint64 ("row_id", + pos->row_id), + GNUNET_JSON_pack_timestamp ("date", + pos->date), + TALER_JSON_pack_amount ("amount", + &pos->amount), + GNUNET_JSON_pack_string ("debit_account", + pos->debit_account->payto_uri), + GNUNET_JSON_pack_string ("origin_exchange_url", + pos->subject.wad.origin_base_url), + GNUNET_JSON_pack_data_auto ("wad_id", + &pos->subject.wad.wad_id)); + break; + case T_CREDIT: + trans = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_string ("type", + "RESERVE"), + GNUNET_JSON_pack_uint64 ("row_id", + pos->row_id), + GNUNET_JSON_pack_timestamp ("date", + pos->date), + TALER_JSON_pack_amount ("amount", + &pos->amount), + GNUNET_JSON_pack_string ("debit_account", + pos->debit_account->payto_uri), + GNUNET_JSON_pack_data_auto ("reserve_pub", + &pos->subject.credit.reserve_pub)); + break; + case T_AUTH: + trans = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_string ("type", + "KYCAUTH"), + GNUNET_JSON_pack_uint64 ("row_id", + pos->row_id), + GNUNET_JSON_pack_timestamp ("date", + pos->date), + TALER_JSON_pack_amount ("amount", + &pos->amount), + GNUNET_JSON_pack_string ("debit_account", + pos->debit_account->payto_uri), + GNUNET_JSON_pack_data_auto ("account_pub", + &pos->subject.auth.account_pub)); + break; + } GNUNET_assert (NULL != trans); GNUNET_assert (0 == json_array_append_new (hc->history, |