diff options
author | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-07-03 18:23:46 -0400 |
---|---|---|
committer | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-07-03 18:23:46 -0400 |
commit | 33d332a637d77524f140a20c0b636177276224a9 (patch) | |
tree | a0aa460e89e7379c6fd83ba19229bec54779c7d8 /src/testing/testing_api_cmd_get_transfers.c | |
parent | c4dc3bf39183559ddcfeafba65ef3d8635bc13fe (diff) | |
download | merchant-33d332a637d77524f140a20c0b636177276224a9.tar.gz merchant-33d332a637d77524f140a20c0b636177276224a9.tar.bz2 merchant-33d332a637d77524f140a20c0b636177276224a9.zip |
test GET /private/transfers
Diffstat (limited to 'src/testing/testing_api_cmd_get_transfers.c')
-rw-r--r-- | src/testing/testing_api_cmd_get_transfers.c | 124 |
1 files changed, 121 insertions, 3 deletions
diff --git a/src/testing/testing_api_cmd_get_transfers.c b/src/testing/testing_api_cmd_get_transfers.c index d0efa13a..34889e88 100644 --- a/src/testing/testing_api_cmd_get_transfers.c +++ b/src/testing/testing_api_cmd_get_transfers.c @@ -117,9 +117,127 @@ get_transfers_cb ( TALER_TESTING_interpreter_fail (gts->is); return; } - // { - // FIXME: check that list of returned transactions matches our expectations! - // } + for (unsigned int i = 0; i < transfers_length; ++i) + { + const struct TALER_TESTING_Command *transfer_cmd; + + transfer_cmd = TALER_TESTING_interpreter_lookup_command ( + gts->is, + gts->transfers[i]); + { + const struct TALER_WireTransferIdentifierRawP *wtid; + + if (GNUNET_OK != + TALER_TESTING_get_trait_wtid (transfer_cmd, + 0, + &wtid)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Could not fetch wire transfer id\n"); + TALER_TESTING_interpreter_fail (gts->is); + return; + } + if (0 != GNUNET_memcmp (wtid, + &transfers[i].wtid)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Wire transfer id does not match\n"); + TALER_TESTING_interpreter_fail (gts->is); + return; + } + } + { + const char *payto_uri; + + if (GNUNET_OK != + TALER_TESTING_get_trait_string (transfer_cmd, + 0, + &payto_uri)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Could not fetch wire transfer payto uri\n"); + TALER_TESTING_interpreter_fail (gts->is); + return; + } + if (0 != strcmp (payto_uri, + transfers[i].payto_uri)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Wire transfer payto uri does not match\n"); + TALER_TESTING_interpreter_fail (gts->is); + return; + } + } + { + const struct TALER_Amount *credit_amount; + + if (GNUNET_OK != + TALER_TESTING_get_trait_amount_obj (transfer_cmd, + 0, + &credit_amount)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Could not fetch wire transfer credit amount\n"); + TALER_TESTING_interpreter_fail (gts->is); + return; + } + if ((GNUNET_OK != TALER_amount_cmp_currency (credit_amount, + &transfers[i].credit_amount)) + || + (0 != TALER_amount_cmp (credit_amount, + &transfers[i].credit_amount))) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Wire transfer credit amount does not match\n"); + TALER_TESTING_interpreter_fail (gts->is); + return; + } + } + { + const char *exchange_url; + + if (GNUNET_OK != + TALER_TESTING_get_trait_string (transfer_cmd, + 1, + &exchange_url)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Could not fetch wire transfer exchange url\n"); + TALER_TESTING_interpreter_fail (gts->is); + return; + } + if (0 != strcmp (exchange_url, + transfers[i].exchange_url)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Wire transfer exchange url does not match\n"); + TALER_TESTING_interpreter_fail (gts->is); + return; + } + } + { + const struct GNUNET_TIME_Absolute *execution_time; + + if (GNUNET_OK != + TALER_TESTING_get_trait_absolute_time (transfer_cmd, + 0, + &execution_time)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Could not fetch wire transfer execution time\n"); + TALER_TESTING_interpreter_fail (gts->is); + return; + } + if (execution_time->abs_value_us != + transfers[i].execution_time.abs_value_us) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Wire transfer execution time does not match\n"); + TALER_TESTING_interpreter_fail (gts->is); + return; + } + } + } break; default: GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |