From a046899b2ccd452f786051a41bc385cfb574bbcb Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 20 Aug 2022 21:29:29 +0200 Subject: -major KYC update, fixes misc. issues --- src/lib/exchange_api_batch_withdraw.c | 8 ++++-- src/lib/exchange_api_deposits_get.c | 6 ++--- src/lib/exchange_api_kyc_check.c | 20 +++++++------- src/lib/exchange_api_kyc_wallet.c | 36 ++++++++++++++------------ src/lib/exchange_api_purse_create_with_merge.c | 4 +-- src/lib/exchange_api_purse_merge.c | 4 +-- src/lib/exchange_api_withdraw.c | 7 +++-- src/lib/exchange_api_withdraw2.c | 2 +- 8 files changed, 49 insertions(+), 38 deletions(-) (limited to 'src/lib') diff --git a/src/lib/exchange_api_batch_withdraw.c b/src/lib/exchange_api_batch_withdraw.c index 5389c7e1c..9bb158f87 100644 --- a/src/lib/exchange_api_batch_withdraw.c +++ b/src/lib/exchange_api_batch_withdraw.c @@ -207,8 +207,12 @@ handle_reserve_batch_withdraw_finished ( case MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS: { struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_uint64 ("legitimization_uuid", - &wr.details.accepted.legitimization_uuid), + GNUNET_JSON_spec_fixed_auto ( + "h_payto", + &wr.details.unavailable_for_legal_reasons.h_payto), + GNUNET_JSON_spec_uint64 ( + "requirement_row", + &wr.details.unavailable_for_legal_reasons.requirement_row), GNUNET_JSON_spec_end () }; diff --git a/src/lib/exchange_api_deposits_get.c b/src/lib/exchange_api_deposits_get.c index 9f2b6a972..7f83fad17 100644 --- a/src/lib/exchange_api_deposits_get.c +++ b/src/lib/exchange_api_deposits_get.c @@ -181,8 +181,8 @@ handle_deposit_wtid_finished (void *cls, GNUNET_JSON_spec_timestamp ("execution_time", &dr.details.accepted.execution_time), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_uint64 ("legitimization_uuid", - &dr.details.accepted.legitimization_uuid), + GNUNET_JSON_spec_uint64 ("requirement_row", + &dr.details.accepted.requirement_row), &no_legi), GNUNET_JSON_spec_bool ("kyc_ok", &dr.details.accepted.kyc_ok), @@ -200,7 +200,7 @@ handle_deposit_wtid_finished (void *cls, break; } if (no_legi) - dr.details.accepted.legitimization_uuid = 0; + dr.details.accepted.requirement_row = 0; dwh->cb (dwh->cb_cls, &dr); TALER_EXCHANGE_deposits_get_cancel (dwh); diff --git a/src/lib/exchange_api_kyc_check.c b/src/lib/exchange_api_kyc_check.c index ffb7a24b5..6dfbb48d7 100644 --- a/src/lib/exchange_api_kyc_check.c +++ b/src/lib/exchange_api_kyc_check.c @@ -98,11 +98,11 @@ handle_kyc_check_finished (void *cls, { struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("exchange_sig", - &ks.details.kyc_ok.exchange_sig), + &ks.details.success.exchange_sig), GNUNET_JSON_spec_fixed_auto ("exchange_pub", - &ks.details.kyc_ok.exchange_pub), + &ks.details.success.exchange_pub), GNUNET_JSON_spec_timestamp ("now", - &ks.details.kyc_ok.timestamp), + &ks.details.success.timestamp), GNUNET_JSON_spec_end () }; const struct TALER_EXCHANGE_Keys *key_state; @@ -120,7 +120,7 @@ handle_kyc_check_finished (void *cls, key_state = TALER_EXCHANGE_get_keys (kch->exchange); if (GNUNET_OK != TALER_EXCHANGE_test_signing_key (key_state, - &ks.details.kyc_ok.exchange_pub)) + &ks.details.success.exchange_pub)) { GNUNET_break_op (0); ks.http_status = 0; @@ -132,9 +132,9 @@ handle_kyc_check_finished (void *cls, if (GNUNET_OK != TALER_exchange_online_account_setup_success_verify ( &kch->h_payto, - ks.details.kyc_ok.timestamp, - &ks.details.kyc_ok.exchange_pub, - &ks.details.kyc_ok.exchange_sig)) + ks.details.success.timestamp, + &ks.details.success.exchange_pub, + &ks.details.success.exchange_sig)) { GNUNET_break_op (0); ks.http_status = 0; @@ -152,7 +152,7 @@ handle_kyc_check_finished (void *cls, { struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("kyc_url", - &ks.details.kyc_url), + &ks.details.accepted.kyc_url), GNUNET_JSON_spec_end () }; @@ -208,7 +208,7 @@ handle_kyc_check_finished (void *cls, struct TALER_EXCHANGE_KycCheckHandle * TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange, - uint64_t legitimization_uuid, + uint64_t requirement_row, const struct TALER_PaytoHashP *h_payto, enum TALER_KYCLOGIC_KycUserType ut, struct GNUNET_TIME_Relative timeout, @@ -241,7 +241,7 @@ TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange, / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us; GNUNET_asprintf (&arg_str, "/kyc-check/%llu/%s/%s?timeout_ms=%llu", - (unsigned long long) legitimization_uuid, + (unsigned long long) requirement_row, payto_str, TALER_KYCLOGIC_kyc_user_type2s (ut), timeout_ms); diff --git a/src/lib/exchange_api_kyc_wallet.c b/src/lib/exchange_api_kyc_wallet.c index bd5ef3bf2..63e4e500e 100644 --- a/src/lib/exchange_api_kyc_wallet.c +++ b/src/lib/exchange_api_kyc_wallet.c @@ -95,11 +95,28 @@ handle_kyc_wallet_finished (void *cls, case 0: ks.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; - case MHD_HTTP_OK: + case MHD_HTTP_NO_CONTENT: + break; + case MHD_HTTP_BAD_REQUEST: + ks.ec = TALER_JSON_get_error_code (j); + /* This should never happen, either us or the exchange is buggy + (or API version conflict); just pass JSON reply to the application */ + break; + case MHD_HTTP_FORBIDDEN: + ks.ec = TALER_JSON_get_error_code (j); + break; + case MHD_HTTP_NOT_FOUND: + ks.ec = TALER_JSON_get_error_code (j); + break; + case MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS: { struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_uint64 ("legitimization_uuid", - &ks.legitimization_uuid), + GNUNET_JSON_spec_fixed_auto ( + "h_payto", + &ks.details.unavailable_for_legal_reasons.h_payto), + GNUNET_JSON_spec_uint64 ( + "requirement_row", + &ks.details.unavailable_for_legal_reasons.requirement_row), GNUNET_JSON_spec_end () }; @@ -115,19 +132,6 @@ handle_kyc_wallet_finished (void *cls, } break; } - case MHD_HTTP_NO_CONTENT: - break; - case MHD_HTTP_BAD_REQUEST: - ks.ec = TALER_JSON_get_error_code (j); - /* This should never happen, either us or the exchange is buggy - (or API version conflict); just pass JSON reply to the application */ - break; - case MHD_HTTP_FORBIDDEN: - ks.ec = TALER_JSON_get_error_code (j); - break; - case MHD_HTTP_NOT_FOUND: - ks.ec = TALER_JSON_get_error_code (j); - break; case MHD_HTTP_INTERNAL_SERVER_ERROR: ks.ec = TALER_JSON_get_error_code (j); /* Server had an internal issue; we should retry, but this API diff --git a/src/lib/exchange_api_purse_create_with_merge.c b/src/lib/exchange_api_purse_create_with_merge.c index 546db24a4..9fd1d552f 100644 --- a/src/lib/exchange_api_purse_create_with_merge.c +++ b/src/lib/exchange_api_purse_create_with_merge.c @@ -298,8 +298,8 @@ handle_purse_create_with_merge_finished (void *cls, { struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_uint64 ( - "legitimization_uuid", - &dr.details.unavailable_for_legal_reasons.legitimization_uuid), + "requirement_row", + &dr.details.unavailable_for_legal_reasons.requirement_row), GNUNET_JSON_spec_end () }; diff --git a/src/lib/exchange_api_purse_merge.c b/src/lib/exchange_api_purse_merge.c index 8bef94710..fd11978d9 100644 --- a/src/lib/exchange_api_purse_merge.c +++ b/src/lib/exchange_api_purse_merge.c @@ -260,8 +260,8 @@ handle_purse_merge_finished (void *cls, { struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_uint64 ( - "legitimization_uuid", - &dr.details.unavailable_for_legal_reasons.legitimization_uuid), + "requirement_row", + &dr.details.unavailable_for_legal_reasons.requirement_row), GNUNET_JSON_spec_end () }; diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c index 6082ed780..6643cac6c 100644 --- a/src/lib/exchange_api_withdraw.c +++ b/src/lib/exchange_api_withdraw.c @@ -160,9 +160,12 @@ handle_reserve_withdraw_finished ( case MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS: { struct GNUNET_JSON_Specification spec[] = { + GNUNET_JSON_spec_fixed_auto ( + "h_payto", + &wr.details.unavailable_for_legal_reasons.h_payto), GNUNET_JSON_spec_uint64 ( - "legitimization_uuid", - &wr.details.unavailable_for_legal_reasons.legitimization_uuid), + "requirement_row", + &wr.details.unavailable_for_legal_reasons.requirement_row), GNUNET_JSON_spec_end () }; diff --git a/src/lib/exchange_api_withdraw2.c b/src/lib/exchange_api_withdraw2.c index 4e5ca0622..04881804a 100644 --- a/src/lib/exchange_api_withdraw2.c +++ b/src/lib/exchange_api_withdraw2.c @@ -316,7 +316,7 @@ handle_reserve_withdraw_finished (void *cls, { uint64_t ptu; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_uint64 ("legitimization_uuid", + GNUNET_JSON_spec_uint64 ("requirement_row", &ptu), GNUNET_JSON_spec_end () }; -- cgit v1.2.3