diff options
Diffstat (limited to 'src/kyclogic/plugin_kyclogic_template.c')
-rw-r--r-- | src/kyclogic/plugin_kyclogic_template.c | 90 |
1 files changed, 58 insertions, 32 deletions
diff --git a/src/kyclogic/plugin_kyclogic_template.c b/src/kyclogic/plugin_kyclogic_template.c index e59c15da1..54f36e6f2 100644 --- a/src/kyclogic/plugin_kyclogic_template.c +++ b/src/kyclogic/plugin_kyclogic_template.c @@ -20,8 +20,8 @@ */ #include "platform.h" #include "taler_kyclogic_plugin.h" -#include <taler/taler_mhd_lib.h> -#include <taler/taler_json_lib.h> +#include "taler_mhd_lib.h" +#include "taler_json_lib.h" #include <regex.h> #include "taler_util.h" @@ -68,6 +68,11 @@ struct TALER_KYCLOGIC_ProviderDetails */ struct PluginState *ps; + /** + * Configuration section that configured us. + */ + char *section; + }; @@ -130,6 +135,11 @@ struct TALER_KYCLOGIC_ProofHandle * Closure for @e cb. */ void *cb_cls; + + /** + * Connection we are handling. + */ + struct MHD_Connection *connection; }; @@ -164,10 +174,26 @@ struct TALER_KYCLOGIC_WebhookHandle */ const struct TALER_KYCLOGIC_ProviderDetails *pd; + /** + * Connection we are handling. + */ + struct MHD_Connection *connection; }; /** + * Release configuration resources previously loaded + * + * @param[in] pd configuration to release + */ +static void +template_unload_configuration (struct TALER_KYCLOGIC_ProviderDetails *pd) +{ + GNUNET_free (pd); +} + + +/** * Load the configuration of the KYC provider. * * @param cls closure @@ -183,20 +209,22 @@ template_load_configuration (void *cls, pd = GNUNET_new (struct TALER_KYCLOGIC_ProviderDetails); pd->ps = ps; + pd->section = GNUNET_strdup (provider_section_name); GNUNET_break (0); // FIXME: parse config here! return pd; } /** - * Release configuration resources previously loaded + * Cancel KYC check initiation. * - * @param[in] pd configuration to release + * @param[in] ih handle of operation to cancel */ static void -template_unload_configuration (struct TALER_KYCLOGIC_ProviderDetails *pd) +template_initiate_cancel (struct TALER_KYCLOGIC_InitiateHandle *ih) { - GNUNET_free (pd); + GNUNET_break (0); // FIXME: add cancel logic here + GNUNET_free (ih); } @@ -221,6 +249,7 @@ template_initiate (void *cls, { struct TALER_KYCLOGIC_InitiateHandle *ih; + (void) cls; ih = GNUNET_new (struct TALER_KYCLOGIC_InitiateHandle); ih->legitimization_uuid = legitimization_uuid; ih->cb = cb; @@ -233,15 +262,15 @@ template_initiate (void *cls, /** - * Cancel KYC check initiation. + * Cancel KYC proof. * - * @param[in] ih handle of operation to cancel + * @param[in] ph handle of operation to cancel */ static void -template_initiate_cancel (struct TALER_KYCLOGIC_InitiateHandle *ih) +template_proof_cancel (struct TALER_KYCLOGIC_ProofHandle *ph) { - GNUNET_break (0); // FIXME: add cancel logic here - GNUNET_free (ih); + GNUNET_break (0); // FIXME: stop activities... + GNUNET_free (ph); } @@ -250,9 +279,9 @@ template_initiate_cancel (struct TALER_KYCLOGIC_InitiateHandle *ih) * * @param cls the @e cls of this struct with the plugin-specific state * @param pd provider configuration details - * @param url_path rest of the URL after `/kyc-webhook/` * @param connection MHD connection object (for HTTP headers) * @param account_id which account to trigger process for + * @param process_row row in the legitimization processes table the legitimization is for * @param provider_user_id user ID (or NULL) the proof is for * @param provider_legitimization_id legitimization ID the proof is for * @param cb function to call with the result @@ -262,9 +291,9 @@ template_initiate_cancel (struct TALER_KYCLOGIC_InitiateHandle *ih) static struct TALER_KYCLOGIC_ProofHandle * template_proof (void *cls, const struct TALER_KYCLOGIC_ProviderDetails *pd, - const char *url_path, struct MHD_Connection *connection, const struct TALER_PaytoHashP *account_id, + uint64_t process_row, const char *provider_user_id, const char *provider_legitimization_id, TALER_KYCLOGIC_ProofCallback cb, @@ -273,11 +302,16 @@ template_proof (void *cls, struct PluginState *ps = cls; struct TALER_KYCLOGIC_ProofHandle *ph; + (void) account_id; + (void) process_row; + (void) provider_user_id; + (void) provider_legitimization_id; ph = GNUNET_new (struct TALER_KYCLOGIC_ProofHandle); ph->ps = ps; ph->pd = pd; ph->cb = cb; ph->cb_cls = cb_cls; + ph->connection = connection; GNUNET_break (0); // FIXME: start check! return ph; @@ -285,15 +319,15 @@ template_proof (void *cls, /** - * Cancel KYC proof. + * Cancel KYC webhook execution. * - * @param[in] ph handle of operation to cancel + * @param[in] wh handle of operation to cancel */ static void -template_proof_cancel (struct TALER_KYCLOGIC_ProofHandle *ph) +template_webhook_cancel (struct TALER_KYCLOGIC_WebhookHandle *wh) { - GNUNET_break (0); // FIXME: stop activities... - GNUNET_free (ph); + GNUNET_break (0); /* FIXME: stop activity */ + GNUNET_free (wh); } @@ -307,7 +341,6 @@ template_proof_cancel (struct TALER_KYCLOGIC_ProofHandle *ph) * @param http_method HTTP method used for the webhook * @param url_path rest of the URL after `/kyc-webhook/` * @param connection MHD connection object (for HTTP headers) - * @param body_size number of bytes in @a body * @param body HTTP request body * @param cb function to call with the result * @param cb_cls closure for @a cb @@ -328,30 +361,23 @@ template_webhook (void *cls, struct PluginState *ps = cls; struct TALER_KYCLOGIC_WebhookHandle *wh; + (void) plc; + (void) plc_cls; + (void) http_method; + (void) url_path; + (void) body; wh = GNUNET_new (struct TALER_KYCLOGIC_WebhookHandle); wh->cb = cb; wh->cb_cls = cb_cls; wh->ps = ps; wh->pd = pd; + wh->connection = connection; GNUNET_break (0); /* FIXME: start activity */ return wh; } /** - * Cancel KYC webhook execution. - * - * @param[in] wh handle of operation to cancel - */ -static void -template_webhook_cancel (struct TALER_KYCLOGIC_WebhookHandle *wh) -{ - GNUNET_break (0); /* FIXME: stop activity */ - GNUNET_free (wh); -} - - -/** * Initialize Template.0 KYC logic plugin * * @param cls a configuration instance |