diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-04-10 23:30:59 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-04-10 23:30:59 +0200 |
commit | ad925ccc324ca2b84676a39d63b776ba337da492 (patch) | |
tree | 57d2450179027ec552d6e5562d18bb98852c866e /src/testing | |
parent | 208dbea1ce964495dbd4ee1b572694a43d8cdb6b (diff) |
prepare test_kyc_api to test #7684
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_kyc_api.c | 117 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_transfers.c | 8 |
2 files changed, 113 insertions, 12 deletions
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c index 507338e4..747902ea 100644 --- a/src/testing/test_kyc_api.c +++ b/src/testing/test_kyc_api.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2022 Taler Systems SA + Copyright (C) 2014-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 as @@ -43,8 +43,6 @@ */ #define CONFIG_FILE "test_kyc_api.conf" -#define PAYTO_I1 "payto://x-taler-bank/localhost/3?receiver-name=3" - /** * Exchange base URL. Could also be taken from config. */ @@ -101,18 +99,13 @@ static struct GNUNET_OS_Process *merchantd; #define USER_ACCOUNT_NAME "62" /** - * Account number of some other user. - */ -#define USER_ACCOUNT_NAME2 "63" - -/** * Account number used by the merchant */ #define MERCHANT_ACCOUNT_NAME "3" /** - * Execute the taler-exchange-aggregator, closer and transfer commands with + * Execute the taler-exchange-aggregator and transfer commands with * our configuration file. * * @param label label to use for the command. @@ -257,7 +250,7 @@ run (void *cls, merchant_payto), TALER_TESTING_cmd_merchant_post_transfer ("post-transfer-1", &bc.exchange_auth, - PAYTO_I1, + merchant_payto, merchant_url, "EUR:4.98", MHD_HTTP_OK, @@ -265,13 +258,111 @@ run (void *cls, NULL), TALER_TESTING_cmd_merchant_get_transfers ("get-transfers-1", merchant_url, - PAYTO_I1, + merchant_payto, MHD_HTTP_OK, "post-transfer-1", NULL), TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-3"), TALER_TESTING_cmd_end () }; + struct TALER_TESTING_Command aml[] = { + TALER_TESTING_cmd_set_officer ("aml-officer", + NULL, + "Ernest&Young", + true, + false), + cmd_transfer_to_exchange ("create-reserve-big", + "EUR:100.02"), + TALER_TESTING_cmd_exec_wirewatch ("wirewatch-big", + CONFIG_FILE), + TALER_TESTING_cmd_take_aml_decision ("freeze", + "aml-officer", + "post-transfer-1", + "EUR:1", + "suspicious", + TALER_AML_FROZEN, + NULL, + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-big", + "EUR:100.02", + payer_payto, + exchange_payto, + "create-reserve-big"), + TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-aml", + "create-reserve-big", + "EUR:5", + 0, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-aml", + merchant_url, + MHD_HTTP_OK, + "10-aml", /* order ID */ + GNUNET_TIME_UNIT_ZERO_TS, + GNUNET_TIME_UNIT_FOREVER_TS, + true, + "EUR:5.0", + "x-taler-bank", + "", + "", + NULL), + TALER_TESTING_cmd_merchant_claim_order ("reclaim-aml", + merchant_url, + MHD_HTTP_OK, + "create-proposal-aml", + NULL), + TALER_TESTING_cmd_merchant_pay_order ("deposit-simple", + merchant_url, + MHD_HTTP_OK, + "create-proposal-aml", + "withdraw-coin-aml", + "EUR:5", + "EUR:4.99", + "session-aml"), + TALER_TESTING_cmd_merchant_post_orders_paid ("verify-order-aml-paid", + merchant_url, + "deposit-simple", + "session-aml", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-aml-1"), + CMD_EXEC_AGGREGATOR ("run-aggregator-aml-frozen"), + /* AML-frozen: hence nothing happened at the bank yet: */ + TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-aml-2"), + + /* FIXME-7684: add logic to get AML state from merchant here */ + TALER_TESTING_cmd_sleep ("sleep to de-collide AML timestamps", + 1), + TALER_TESTING_cmd_take_aml_decision ("unfreeze", + "aml-officer", + "post-transfer-1", + "EUR:100", + "fine", + TALER_AML_NORMAL, + NULL, + MHD_HTTP_NO_CONTENT), + CMD_EXEC_AGGREGATOR ("run-aggregator-aml-normal"), + TALER_TESTING_cmd_check_bank_transfer ( + "check_bank_transfer-498c-post-unfreeze", + EXCHANGE_URL, + "EUR:4.98", + exchange_payto, + merchant_payto), + TALER_TESTING_cmd_merchant_post_transfer ("post-transfer-aml", + &bc.exchange_auth, + merchant_payto, + merchant_url, + "EUR:4.98", + MHD_HTTP_OK, + "deposit-simple", + NULL), + TALER_TESTING_cmd_merchant_get_transfers ("get-transfers-aml", + merchant_url, + merchant_payto, + MHD_HTTP_OK, + "post-transfer-1", + "post-transfer-aml", + NULL), + TALER_TESTING_cmd_end () + }; /* end of aml batch */ struct TALER_TESTING_Command commands[] = { /* general setup */ @@ -295,11 +386,13 @@ run (void *cls, TALER_TESTING_cmd_merchant_post_instances ("instance-create-default-setup", merchant_url, "default", - PAYTO_I1, + merchant_payto, "EUR", MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_batch ("pay", pay), + TALER_TESTING_cmd_batch ("aml", + aml), TALER_TESTING_cmd_end () }; diff --git a/src/testing/testing_api_cmd_post_transfers.c b/src/testing/testing_api_cmd_post_transfers.c index dee1b183..4cff2348 100644 --- a/src/testing/testing_api_cmd_post_transfers.c +++ b/src/testing/testing_api_cmd_post_transfers.c @@ -70,6 +70,11 @@ struct PostTransfersState const char *payto_uri; /** + * Set to the hash of the @e payto_uri. + */ + struct TALER_PaytoHashP h_payto; + + /** * Authentication details to authenticate to the bank. */ struct TALER_BANK_AuthenticationData auth; @@ -338,6 +343,7 @@ post_transfers_traits (void *cls, TALER_TESTING_make_trait_wtid (&pts->wtid), TALER_TESTING_make_trait_credit_payto_uri ( (const char **) &pts->credit_account), + TALER_TESTING_make_trait_h_payto (&pts->h_payto), TALER_TESTING_make_trait_amount (&pts->credit_amount), TALER_TESTING_make_trait_fee (&pts->wire_fee), TALER_TESTING_make_trait_exchange_url ( @@ -529,6 +535,8 @@ TALER_TESTING_cmd_merchant_post_transfer ( pts->merchant_url = merchant_url; pts->auth = *auth; pts->payto_uri = payto_uri; + TALER_payto_hash (payto_uri, + &pts->h_payto); GNUNET_assert (GNUNET_OK == TALER_string_to_amount (credit_amount, &pts->credit_amount)); |