merchant

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

commit 4a312017e07335a7285d6a984f4a2a3882877288
parent 272f1d9ebc2cd2469dbaaaca94b3ea03973b3f2a
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 31 Jul 2024 15:04:31 +0200

comment out most of test_kyc_api, requires more fundamental merchant work

Diffstat:
Msrc/lib/merchant_api_get_instance.c | 7+++++++
Msrc/testing/test_kyc_api.c | 37+++++++++++++++++++++++++++++++++++--
Msrc/testing/testing_api_cmd_get_instance.c | 25+++++++++++++++++++------
Msrc/testing/testing_api_cmd_post_instances.c | 30+++++++++++++++++-------------
4 files changed, 78 insertions(+), 21 deletions(-)

diff --git a/src/lib/merchant_api_get_instance.c b/src/lib/merchant_api_get_instance.c @@ -181,6 +181,7 @@ TALER_MERCHANT_instance_get (struct GNUNET_CURL_Context *ctx, igh->ctx = ctx; igh->cb = cb; igh->cb_cls = cb_cls; + if (NULL != instance_id) { char *path; @@ -192,6 +193,12 @@ TALER_MERCHANT_instance_get (struct GNUNET_CURL_Context *ctx, NULL); GNUNET_free (path); } + else + { + igh->url = TALER_url_join (backend_url, + "private", + NULL); + } if (NULL == igh->url) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c @@ -105,6 +105,18 @@ static char *merchant_url_i1a; CONFIG_FILE), \ TALER_TESTING_cmd_exec_transfer (label "-transfer", CONFIG_FILE) +/** + * Execute the taler-exchange-wirewatch command with + * our configuration file. + * + * @param label label to use for the command. + */ +#define CMD_EXEC_WIREWATCH(label) \ + TALER_TESTING_cmd_exec_wirewatch2 ( \ + label, \ + CONFIG_FILE, \ + "exchange-account-exchange") + /** * Run wire transfer of funds from some user's account to the @@ -234,15 +246,33 @@ run (void *cls, TALER_TESTING_cmd_depositcheck ( "deposit-check", CONFIG_FILE), + TALER_TESTING_cmd_merchant_get_instance ( + "get-default-instance", + merchant_url, + NULL, + MHD_HTTP_OK, + "instance-create-default-setup"), + TALER_TESTING_cmd_admin_add_kycauth ( + "merchant-kyc-auth-transfer", + "EUR:0.01", + &cred.ba, + merchant_payto, + "get-default-instance"), + CMD_EXEC_WIREWATCH ( + "import-kyc-account-withdraw"), /* Now we should get a status of pending */ TALER_TESTING_cmd_merchant_kyc_get ( "kyc-pending", merchant_url, - NULL, - NULL, + NULL, /* instance */ + NULL, /* h_wire_ref: which account to query */ EXCHANGE_URL, MHD_HTTP_ACCEPTED, true), + // FIXME: need new endpoint here to tell the + // merchant backend to actually start the KYC + // process (using merchant_priv!) +#if FUTURE_WORK TALER_TESTING_cmd_proof_kyc_oauth2 ( "kyc-do", "kyc-pending", @@ -277,6 +307,7 @@ run (void *cls, NULL), TALER_TESTING_cmd_check_bank_empty ( "check_bank_empty-3"), +#endif TALER_TESTING_cmd_end () }; struct TALER_TESTING_Command aml[] = { @@ -463,8 +494,10 @@ run (void *cls, MHD_HTTP_OK), TALER_TESTING_cmd_batch ("pay", pay), +#if FIXME_FUTURE_WORK TALER_TESTING_cmd_batch ("aml", aml), +#endif TALER_TESTING_cmd_end () }; diff --git a/src/testing/testing_api_cmd_get_instance.c b/src/testing/testing_api_cmd_get_instance.c @@ -45,6 +45,11 @@ struct GetInstanceState struct TALER_TESTING_Interpreter *is; /** + * Public key of the merchant instance. + */ + union TALER_AccountPublicKeyP account_pub; + + /** * Base URL of the merchant serving the request. */ const char *merchant_url; @@ -102,6 +107,8 @@ get_instance_cb (void *cls, const struct TALER_MERCHANT_InstanceDetails *details = &igr->details.ok.details; + gis->account_pub.merchant_pub + = details->merchant_pub; { const char *name; @@ -281,7 +288,12 @@ get_instance_traits (void *cls, { struct GetInstanceState *pps = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_merchant_base_url (pps->merchant_url), + TALER_TESTING_make_trait_merchant_base_url ( + pps->merchant_url), + TALER_TESTING_make_trait_merchant_pub ( + &pps->account_pub.merchant_pub), + TALER_TESTING_make_trait_account_pub ( + &pps->account_pub), TALER_TESTING_trait_end (), }; @@ -293,11 +305,12 @@ get_instance_traits (void *cls, struct TALER_TESTING_Command -TALER_TESTING_cmd_merchant_get_instance (const char *label, - const char *merchant_url, - const char *instance_id, - unsigned int http_status, - const char *instance_reference) +TALER_TESTING_cmd_merchant_get_instance ( + const char *label, + const char *merchant_url, + const char *instance_id, + unsigned int http_status, + const char *instance_reference) { struct GetInstanceState *gis; diff --git a/src/testing/testing_api_cmd_post_instances.c b/src/testing/testing_api_cmd_post_instances.c @@ -104,18 +104,20 @@ struct PostInstancesState * @param hr response being processed */ static void -post_instances_cb (void *cls, - const struct TALER_MERCHANT_HttpResponse *hr) +post_instances_cb ( + void *cls, + const struct TALER_MERCHANT_HttpResponse *hr) { struct PostInstancesState *pis = cls; pis->iph = NULL; if (pis->http_status != hr->http_status) { - TALER_TESTING_unexpected_status_with_body (pis->is, - hr->http_status, - pis->http_status, - hr->reply); + TALER_TESTING_unexpected_status_with_body ( + pis->is, + hr->http_status, + pis->http_status, + hr->reply); TALER_TESTING_interpreter_fail (pis->is); return; } @@ -152,9 +154,10 @@ post_instances_cb (void *cls, * @param is interpreter state. */ static void -post_instances_run (void *cls, - const struct TALER_TESTING_Command *cmd, - struct TALER_TESTING_Interpreter *is) +post_instances_run ( + void *cls, + const struct TALER_TESTING_Command *cmd, + struct TALER_TESTING_Interpreter *is) { struct PostInstancesState *pis = cls; @@ -283,10 +286,11 @@ TALER_TESTING_cmd_merchant_post_instances2 ( struct TALER_TESTING_Command -TALER_TESTING_cmd_merchant_post_instances (const char *label, - const char *merchant_url, - const char *instance_id, - unsigned int http_status) +TALER_TESTING_cmd_merchant_post_instances ( + const char *label, + const char *merchant_url, + const char *instance_id, + unsigned int http_status) { return TALER_TESTING_cmd_merchant_post_instances2 ( label,