summaryrefslogtreecommitdiff
path: root/src/include/taler_merchant_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-10-21 15:00:38 +0200
committerChristian Grothoff <christian@grothoff.org>2021-10-21 15:00:38 +0200
commit99e7729ede69e218198a8c846e8096ad83127f6b (patch)
tree4a246f9021c79f6249609299cfb2e5ab34e39e16 /src/include/taler_merchant_service.h
parent14c5d00ebd98fdb299fa16c9721588d55f8d3b35 (diff)
downloadmerchant-99e7729ede69e218198a8c846e8096ad83127f6b.tar.gz
merchant-99e7729ede69e218198a8c846e8096ad83127f6b.tar.bz2
merchant-99e7729ede69e218198a8c846e8096ad83127f6b.zip
start with /kyc support in libtalermerchant
Diffstat (limited to 'src/include/taler_merchant_service.h')
-rw-r--r--src/include/taler_merchant_service.h181
1 files changed, 179 insertions, 2 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index cc3063f6..82e81b4b 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -3497,8 +3497,8 @@ TALER_MERCHANT_merchant_tip_get (struct GNUNET_CURL_Context *ctx,
* @param tgh handle to the request to be canceled
*/
void
-TALER_MERCHANT_merchant_tip_get_cancel (struct
- TALER_MERCHANT_TipMerchantGetHandle *tgh);
+TALER_MERCHANT_merchant_tip_get_cancel (
+ struct TALER_MERCHANT_TipMerchantGetHandle *tgh);
/**
@@ -3734,4 +3734,181 @@ TALER_MERCHANT_tip_pickup2_cancel (
struct TALER_MERCHANT_TipPickup2Handle *tp);
+
+/* ********************* /kyc ************************** */
+
+/**
+ * Handle for GETing the KYC status of instance(s).
+ */
+struct TALER_MERCHANT_KycGetHandle;
+
+
+/**
+ * Information about KYC actions the merchant still must perform.
+ */
+struct TALER_MERCHANT_AccountKycRedirectDetail
+{
+
+ /**
+ * URL that the user should open in a browser to
+ * proceed with the KYC process (as returned
+ * by the exchange's /kyc-check/ endpoint).
+ */
+ const char *kyc_url;
+
+ /**
+ * Base URL of the exchange this is about.
+ */
+ const char *exchange_url;
+
+ /**
+ * Our bank wire account this is about.
+ */
+ const char *payto_uri;
+};
+
+
+/**
+ * Information about KYC status failures at the exchange.
+ */
+struct TALER_MERCHANT_ExchangeKycFailureDetail
+{
+ /**
+ * Base URL of the exchange this is about.
+ */
+ const char *exchange_url;
+
+ /**
+ * Error code indicating errors the exchange
+ * returned, or #TALER_EC_INVALID for none.
+ */
+ enum TALER_ErrorCode exchange_code;
+
+ /**
+ * HTTP status code returned by the exchange when we asked for
+ * information about the KYC status.
+ * 0 if there was no response at all.
+ */
+ unsigned int exchange_http_status;
+};
+
+
+/**
+ * Details in a response to a GET /kyc request.
+ */
+struct TALER_MERCHANT_KycResponse
+{
+ struct TALER_MERCHANT_HttpResponse hr;
+
+ /**
+ * Response details.
+ */
+ union
+ {
+ /**
+ * Information returned if the status was #MHD_HTTP_ACCEPTED,
+ * #MHD_HTTP_BAD_GATEWAY or #MHD_HTTP_GATEWAY_TIMEOUT.
+ */
+ struct
+ {
+
+ /**
+ * Array with information about KYC actions the merchant still must perform.
+ */
+ struct TALER_MERCHANT_AccountKycRedirectDetail *pending_kycs;
+
+ /**
+ * Array with information about KYC failures at the exchange.
+ */
+ struct TALER_MERCHANT_ExchangeKycFailureDetail *timeout_kycs;
+
+ /**
+ * Length of the @e pending_kycs array.
+ */
+ unsigned int pending_kycs_length;
+
+ /**
+ * Length of the @e timeout_kycs array.
+ */
+ unsigned int timeout_kycs_length;
+ } kyc_status;
+
+ } details;
+
+};
+
+
+/**
+ * Callback to with a response from a GET [/private]/kyc request
+ *
+ * @param cls closure
+ * @param kr response details
+ */
+typedef void
+(*TALER_MERCHANT_KycGetCallback) (
+ void *cls,
+ const struct TALER_MERCHANT_KycResponse *kr);
+
+
+/**
+ * Issue a GET /private/kycs/$KYC_ID (private variant) request to the backend.
+ * Returns KYC status of bank accounts.
+ *
+ * @param ctx execution context
+ * @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 cb function to call with the result
+ * @param cb_cls closure for @a cb
+ * @return handle for this operation, NULL upon errors
+ */
+struct TALER_MERCHANT_KycGetHandle *
+TALER_MERCHANT_kyc_get (struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const struct GNUNET_HashCode *h_wire,
+ const char *exchange_url,
+ struct GNUNET_TIME_Relative timeout,
+ TALER_MERCHANT_KycGetCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Issue a GET /management/instances/$INSTANCE/kyc request to the backend.
+ * Returns KYC status of bank accounts.
+ *
+ * @param ctx execution context
+ * @param backend_url base URL of the merchant backend
+ * @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 cb function to call with the result
+ * @param cb_cls closure for @a cb
+ * @return handle for this operation, NULL upon errors
+ */
+struct TALER_MERCHANT_KycGetHandle *
+TALER_MERCHANT_management_kyc_get (struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *instance_id,
+ const struct GNUNET_HashCode *h_wire,
+ const char *exchange_url,
+ struct GNUNET_TIME_Relative timeout,
+ TALER_MERCHANT_KycGetCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel a GET [/private]/kyc/$KYC_ID request.
+ *
+ * @param kyc handle to the request to be canceled
+ */
+void
+TALER_MERCHANT_kyc_get_cancel (
+ struct TALER_MERCHANT_KycGetHandle *kyc);
+
+
+
+
+
#endif /* _TALER_MERCHANT_SERVICE_H */