exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 1a08b84bdacee9c2cb38399edb3b2abf348ba288
parent e0f37c65d680c63a4fdfad8aca55f44f502417b0
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 23 Jul 2024 22:39:34 +0200

-fix bugs

Diffstat:
Msrc/exchangedb/pg_lookup_pending_legitimization.c | 4++--
Msrc/include/taler_exchange_service.h | 4----
Msrc/lib/exchange_api_kyc_info.c | 18+++++++-----------
Msrc/testing/taler-unified-setup.sh | 2+-
Msrc/testing/test_exchange_p2p.c | 12+++++++++---
5 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/src/exchangedb/pg_lookup_pending_legitimization.c b/src/exchangedb/pg_lookup_pending_legitimization.c @@ -57,8 +57,8 @@ TEH_PG_lookup_pending_legitimization ( " JOIN wire_targets wt" " ON (lm.access_token = wt.access_token)" " WHERE legitimization_measure_serial_id=$1" - " AND access_token=$1" - " AND NOT is_finished;"); + " AND lm.access_token=$2" + " AND NOT lm.is_finished;"); return GNUNET_PQ_eval_prepared_singleton_select ( pg->conn, "lookup_pending_legitimization", diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h @@ -4381,10 +4381,6 @@ struct TALER_EXCHANGE_KycInfoHandle; */ struct TALER_EXCHANGE_RequirementInformation { - /** - * Name of the requirement. - */ - const char *name; /** * Which form should be run. Special values are diff --git a/src/lib/exchange_api_kyc_info.c b/src/lib/exchange_api_kyc_info.c @@ -78,10 +78,8 @@ parse_kyc_info_ok (struct TALER_EXCHANGE_KycInfoHandle *lh, .hr.http_status = MHD_HTTP_OK }; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_object_const ("requirements", - &jrequirements), - NULL), + GNUNET_JSON_spec_array_const ("requirements", + &jrequirements), GNUNET_JSON_spec_bool ("is_and_combinator", &lr.details.ok.is_and_combinator), GNUNET_JSON_spec_mark_optional ( @@ -109,9 +107,9 @@ parse_kyc_info_ok (struct TALER_EXCHANGE_KycInfoHandle *lh, return GNUNET_SYSERR; } lr.details.ok.requirements_length - = json_object_size (jrequirements); + = json_array_size (jrequirements); if ( ((size_t) lr.details.ok.requirements_length) - != json_object_size (jrequirements)) + != json_array_size (jrequirements)) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -125,7 +123,7 @@ parse_kyc_info_ok (struct TALER_EXCHANGE_KycInfoHandle *lh, const char *name; const json_t *jreq; const json_t *jvc; - unsigned int off; + size_t off; memset (vci, 0, @@ -134,10 +132,9 @@ parse_kyc_info_ok (struct TALER_EXCHANGE_KycInfoHandle *lh, 0, sizeof (requirements)); - off = 0; - json_object_foreach ((json_t *) jrequirements, name, jreq) + json_array_foreach ((json_t *) jrequirements, off, jreq) { - struct TALER_EXCHANGE_RequirementInformation *req = &requirements[off++]; + struct TALER_EXCHANGE_RequirementInformation *req = &requirements[off]; struct GNUNET_JSON_Specification ispec[] = { GNUNET_JSON_spec_string ("form", &req->form), @@ -154,7 +151,6 @@ parse_kyc_info_ok (struct TALER_EXCHANGE_KycInfoHandle *lh, GNUNET_JSON_spec_end () }; - req->name = name; if (GNUNET_OK != GNUNET_JSON_parse (jreq, ispec, diff --git a/src/testing/taler-unified-setup.sh b/src/testing/taler-unified-setup.sh @@ -518,7 +518,7 @@ then -c "$CONF" \ -L "$LOGLEVEL" \ 2> taler-exchange-secmod-cs.log & - $USE_VALGRIND taler-exchange-httpd \ + $USE_VALGRIND valgrind taler-exchange-httpd \ -c "$CONF" \ -L "$LOGLEVEL" 2> taler-exchange-httpd.log & echo " DONE" diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c @@ -499,9 +499,15 @@ run (void *cls, "reserve-101-close-kyc", "setup-account-key", MHD_HTTP_ACCEPTED), - // FIXME: use GET kyc-info to GET status - // FIXME: use POST kyc-start to initiate KYC - // Then this can work: + TALER_TESTING_cmd_get_kyc_info ( + "get-kyc-info", + "check-kyc-close-pending", + MHD_HTTP_OK), + TALER_TESTING_cmd_post_kyc_start ( + "start-kyc-process", + "get-kyc-info", + 0, + MHD_HTTP_OK), TALER_TESTING_cmd_proof_kyc_oauth2 ( "proof-close-kyc", "reserve-101-close-kyc",