aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-09-08 23:39:50 +0200
committerChristian Grothoff <christian@grothoff.org>2024-09-08 23:39:50 +0200
commitfd6e459cc7fcad3703c993e812f25a09e1ca9d36 (patch)
tree821fefcf4b7cff609c4f4df2ab33b9acd9c396e7 /src/include
parentaa29da994abd4b4dcb0648e67484589db7351ae9 (diff)
towards new /kyc API: test_kyc_api still fails, but getting close
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_merchant_service.h68
-rw-r--r--src/include/taler_merchant_testing_lib.h2
-rw-r--r--src/include/taler_merchantdb_plugin.h13
3 files changed, 38 insertions, 45 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index b1840ea8..05ea273b 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -4387,15 +4387,6 @@ struct TALER_MERCHANT_AccountKycRedirectDetail
struct TALER_AccountAccessTokenP access_token;
/**
- * URL that the user should open in a browser to
- * proceed with the KYC process (as returned
- * by the exchange's /kyc-check/ endpoint). Can
- * be NULL, specifically if KYC is satisfied but
- * the transactions are hanging in AML.
- */
- const char *kyc_url;
-
- /**
* Base URL of the exchange this is about.
*/
const char *exchange_url;
@@ -4442,31 +4433,25 @@ struct TALER_MERCHANT_AccountKycRedirectDetail
*/
enum TALER_ErrorCode exchange_code;
-};
-
-
-/**
- * Information about KYC status failures at the exchange.
- */
-struct TALER_MERCHANT_ExchangeKycFailureDetail
-{
/**
- * Base URL of the exchange this is about.
+ * Set to true if @e access_token was not given.
*/
- const char *exchange_url;
+ bool no_access_token;
/**
- * Error code indicating errors the exchange
- * returned, or #TALER_EC_INVALID for none.
+ * Set to true if the merchant backend could not
+ * get the exchanges ``/keys`` and thus could not
+ * determine default limits or determine an
+ * @e auth_conflict.
*/
- enum TALER_ErrorCode exchange_code;
+ bool no_keys;
/**
- * HTTP status code returned by the exchange when we asked for
- * information about the KYC status.
- * 0 if there was no response at all.
+ * Set to true if the given account cannot to KYC at the given exchange
+ * because no wire method exists that could be used to do the KYC auth wire
+ * transfer.
*/
- unsigned int exchange_http_status;
+ bool auth_conflict;
};
@@ -4486,32 +4471,22 @@ struct TALER_MERCHANT_KycResponse
union
{
/**
- * Information returned if the status was #MHD_HTTP_ACCEPTED,
- * #MHD_HTTP_BAD_GATEWAY or #MHD_HTTP_GATEWAY_TIMEOUT.
+ * Information returned if the status was #MHD_HTTP_OK.
*/
struct
{
/**
- * Array with information about KYC actions the merchant still must perform.
+ * Array with information about KYC actions the merchant may perform.
*/
- struct TALER_MERCHANT_AccountKycRedirectDetail *pending_kycs;
-
- /**
- * Array with information about KYC failures at the exchange.
- */
- struct TALER_MERCHANT_ExchangeKycFailureDetail *timeout_kycs;
+ struct TALER_MERCHANT_AccountKycRedirectDetail *kycs;
/**
* Length of the @e pending_kycs array.
*/
- unsigned int pending_kycs_length;
+ unsigned int kycs_length;
- /**
- * Length of the @e timeout_kycs array.
- */
- unsigned int timeout_kycs_length;
- } kyc_status;
+ } ok;
} details;
@@ -4538,7 +4513,11 @@ typedef void
* @param backend_url base URL of the merchant backend
* @param h_wire which bank account to query, NULL for all
* @param exchange_url which exchange to query, NULL for all
- * @param timeout how long to wait for a (positive) reply
+ * @param lpt target for long polling
+ * @param timeout how long to wait for an answer, including possibly long polling for the desired @a lpt status;
+ * note that when pulling for multiple accounts, any
+ * account reaching this status will cause the
+ * response to be returned
* @param cb function to call with the result
* @param cb_cls closure for @a cb
* @return handle for this operation, NULL upon errors
@@ -4549,6 +4528,7 @@ TALER_MERCHANT_kyc_get (
const char *backend_url,
const struct TALER_MerchantWireHashP *h_wire,
const char *exchange_url,
+ enum TALER_EXCHANGE_KycLongPollTarget lpt,
struct GNUNET_TIME_Relative timeout,
TALER_MERCHANT_KycGetCallback cb,
void *cb_cls);
@@ -4563,7 +4543,8 @@ TALER_MERCHANT_kyc_get (
* @param instance_id specific instance to query
* @param h_wire which bank account to query, NULL for all
* @param exchange_url which exchange to query, NULL for all
- * @param timeout how long to wait for a (positive) reply
+ * @param lpt target for long polling
+ * @param timeout how long to wait for a reply
* @param cb function to call with the result
* @param cb_cls closure for @a cb
* @return handle for this operation, NULL upon errors
@@ -4575,6 +4556,7 @@ TALER_MERCHANT_management_kyc_get (
const char *instance_id,
const struct TALER_MerchantWireHashP *h_wire,
const char *exchange_url,
+ enum TALER_EXCHANGE_KycLongPollTarget lpt,
struct GNUNET_TIME_Relative timeout,
TALER_MERCHANT_KycGetCallback cb,
void *cb_cls);
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
index 4833e4fe..c18274dc 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -1259,6 +1259,7 @@ TALER_TESTING_cmd_merchant_delete_transfer (const char *label,
* @param h_wire_ref label of command with a merchant wire hash trait
* of the bank account to check KYC for; NULL to check all accounts
* @param exchange_url base URL of the exchange to check KYC status for
+ * @param lpt target for long polling
* @param expected_http_status expected HTTP status
* @param expected_kyc_state expected KYC state (only effective if @e expected_http_status is #MHD_HTTP_OK/#MHD_HTTP_ACCEPTED)
* @return the command
@@ -1270,6 +1271,7 @@ TALER_TESTING_cmd_merchant_kyc_get (
const char *instance_id,
const char *h_wire_ref,
const char *exchange_url,
+ enum TALER_EXCHANGE_KycLongPollTarget lpt,
unsigned int expected_http_status,
bool expected_kyc_state);
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
index 5e50845c..41d7570d 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -854,16 +854,25 @@ typedef void
* @param exchange_url base URL of the exchange for which this is a status
* @param last_check when did we last get an update on our KYC status from the exchange
* @param kyc_ok true if we satisfied the KYC requirements
+ * @param access_token access token for the KYC SPA, NULL if we cannot access it yet (need KYC auth wire transfer)
+ * @param last_http_status last HTTP status from /kyc-check
+ * @param last_ec last Taler error code from /kyc-check
+ * @param in_aml_review true if the account is pending review
+ * @param jlimits JSON array of applicable AccountLimits, or NULL if unknown (like defaults apply)
*/
typedef void
(*TALER_MERCHANTDB_KycCallback)(
void *cls,
const struct TALER_MerchantWireHashP *h_wire,
- uint64_t exchange_kyc_serial,
const char *payto_uri,
const char *exchange_url,
struct GNUNET_TIME_Timestamp last_check,
- bool kyc_ok);
+ bool kyc_ok,
+ const struct TALER_AccountAccessTokenP *access_token,
+ unsigned int last_http_status,
+ enum TALER_ErrorCode last_ec,
+ bool in_aml_review,
+ const json_t *jlimits);
/**