summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_merchant_service.h993
-rw-r--r--src/include/taler_merchant_testing_lib.h196
-rw-r--r--src/include/taler_merchantdb_plugin.h210
3 files changed, 1119 insertions, 280 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index c41080be..e92ea3b8 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -524,37 +524,11 @@ typedef void
/**
- * Information about an account of the merchant.
- */
-struct TALER_MERCHANT_AccountConfig
-{
- /**
- * Payto URI of the account.
- */
- const char *payto_uri;
-
- /**
- * Optional credit facade for the account.
- * Can be NULL.
- */
- const char *credit_facade_url;
-
- /**
- * Credit facade credentials for the account.
- * Can be NULL.
- */
- json_t *credit_facade_credentials;
-
-};
-
-/**
* Setup an new instance in the backend.
*
* @param ctx the context
* @param backend_url HTTP base URL for the backend
* @param instance_id identity of the instance to get information about
- * @param accounts_length how many bank accounts this instance has
- * @param accounts the bank accounts of the merchant instance
* @param name name of the merchant instance
* @param ut user type of the merchant instance
* @param address physical address of the merchant instance
@@ -573,8 +547,6 @@ TALER_MERCHANT_instances_post (
struct GNUNET_CURL_Context *ctx,
const char *backend_url,
const char *instance_id,
- unsigned int accounts_length,
- const struct TALER_MERCHANT_AccountConfig accounts[],
const char *name,
enum TALER_KYCLOGIC_KycUserType ut,
const json_t *address,
@@ -599,126 +571,6 @@ TALER_MERCHANT_instances_post_cancel (
/**
- * Handle for a POST /instances/$ID/account operation.
- */
-struct TALER_MERCHANT_AccountPostHandle;
-
-
-/**
- * Response for a POST /instances/$ID/account operation.
- */
-struct TALER_MERCHANT_AccountPostResponse
-{
- /**
- * HTTP response data
- */
- struct TALER_MERCHANT_HttpResponse hr;
-};
-
-
-/**
- * Function called with the result of the POST /instances/$ID/account operation.
- *
- * @param cls closure
- * @param par response data
- */
-typedef void
-(*TALER_MERCHANT_AccountPostCallback)(
- void *cls,
- const struct TALER_MERCHANT_AccountPostResponse *par);
-
-
-/**
- * Setup an new account for an instance in the backend.
- *
- * @param ctx the context
- * @param backend_url HTTP base URL for the backend
- * @param account the bank accounts to add to the merchant instance
- * @param cb function to call with the response
- * @param cb_cls closure for @a config_cb
- * @return the instances handle; NULL upon error
- */
-struct TALER_MERCHANT_AccountPostHandle *
-TALER_MERCHANT_account_post (
- struct GNUNET_CURL_Context *ctx,
- const char *backend_url,
- const struct TALER_MERCHANT_AccountConfig *account,
- TALER_MERCHANT_AccountPostCallback cb,
- void *cb_cls);
-
-
-/**
- * Cancel /account request. Must not be called by clients after
- * the callback was invoked.
- *
- * @param pah request to cancel.
- */
-void
-TALER_MERCHANT_account_post_cancel (
- struct TALER_MERCHANT_AccountPostHandle *pah);
-
-
-/**
- * Handle for a DELETE /instances/$ID/account/$H_WIRE operation.
- */
-struct TALER_MERCHANT_AccountDeleteHandle;
-
-
-/**
- * Response for a DELETE /instances/$ID/account operation.
- */
-struct TALER_MERCHANT_AccountDeleteResponse
-{
- /**
- * HTTP response data
- */
- struct TALER_MERCHANT_HttpResponse hr;
-};
-
-
-/**
- * Function called with the result of the DELETE /instances/$ID/account/$H_WIRE operation.
- *
- * @param cls closure
- * @param par response data
- */
-typedef void
-(*TALER_MERCHANT_AccountDeleteCallback)(
- void *cls,
- const struct TALER_MERCHANT_AccountDeleteResponse *par);
-
-
-/**
- * Remove bank account from an instance in the backend.
- *
- * @param ctx the context
- * @param backend_url HTTP base URL for the backend
- * @param h_wire wire hash of the bank accounts to delete
- * @param cb function to call with the response
- * @param cb_cls closure for @a config_cb
- * @return the instances handle; NULL upon error
- */
-struct TALER_MERCHANT_AccountDeleteHandle *
-TALER_MERCHANT_account_delete (
- struct GNUNET_CURL_Context *ctx,
- const char *backend_url,
- const struct TALER_MerchantWireHashP *h_wire,
- TALER_MERCHANT_AccountDeleteCallback cb,
- void *cb_cls);
-
-
-/**
- * Cancel /account request. Must not be called by clients after
- * the callback was invoked.
- *
- * @param pah request to cancel.
- */
-void
-TALER_MERCHANT_account_delete_cancel (
- struct TALER_MERCHANT_AccountDeleteHandle *pah);
-
-
-/**
* Handle for a PATCH /instances/$ID operation.
*/
struct TALER_MERCHANT_InstancePatchHandle;
@@ -744,8 +596,6 @@ typedef void
* or base URL of an instance if @a instance_id is NULL)
* @param instance_id identity of the instance to modify information about; NULL
* if the instance is identified as part of the @a backend_url
- * @param accounts_length length of the @a accounts array
- * @param accounts the bank accounts of the merchant instance
* @param name name of the merchant instance
* @param ut user type of the merchant instance
* @param address physical address of the merchant instance
@@ -763,8 +613,6 @@ TALER_MERCHANT_instance_patch (
struct GNUNET_CURL_Context *ctx,
const char *backend_url,
const char *instance_id,
- unsigned int accounts_length,
- const struct TALER_MERCHANT_AccountConfig accounts[static accounts_length],
const char *name,
enum TALER_KYCLOGIC_KycUserType ut,
const json_t *address,
@@ -848,39 +696,6 @@ struct TALER_MERCHANT_InstanceGetHandle;
/**
- * Details about a merchant's bank account.
- */
-struct TALER_MERCHANT_Account
-{
- /**
- * salt used to compute h_wire
- */
- struct TALER_WireSaltP salt;
-
- /**
- * payto:// URI of the account.
- */
- const char *payto_uri;
-
- /**
- * Credit facade URL of the account.
- */
- const char *credit_facade_url;
-
- /**
- * Hash of @e payto_uri and @e salt.
- */
- struct TALER_MerchantWireHashP h_wire;
-
- /**
- * true if the account is active,
- * false if it is historic.
- */
- bool active;
-};
-
-
-/**
* Details about an instance.
*/
struct TALER_MERCHANT_InstanceDetails
@@ -944,16 +759,6 @@ struct TALER_MERCHANT_InstanceGetResponse
struct
{
/**
- * Length of the @e accounts array.
- */
- unsigned int accounts_length;
-
- /**
- * bank accounts of the merchant instance
- */
- const struct TALER_MERCHANT_Account *accounts;
-
- /**
* Details about the instance.
*/
struct TALER_MERCHANT_InstanceDetails details;
@@ -1093,6 +898,420 @@ TALER_MERCHANT_instance_delete_cancel (
TALER_MERCHANT_instance_delete_cancel (arg)
+/* *************** Accounts **************** */
+
+/**
+ * Handle for a POST /instances/$ID/accounts operation.
+ */
+struct TALER_MERCHANT_AccountsPostHandle;
+
+
+/**
+ * Response for a POST /instances/$ID/account operation.
+ */
+struct TALER_MERCHANT_AccountsPostResponse
+{
+ /**
+ * HTTP response data
+ */
+ struct TALER_MERCHANT_HttpResponse hr;
+
+ /**
+ * Details depending on HTTP status.
+ */
+ union {
+
+ /**
+ * Details returned on #MHD_HTTP_OK.
+ */
+ struct {
+
+ /**
+ * Hash of @e payto_uri and @e salt.
+ */
+ struct TALER_MerchantWireHashP h_wire;
+
+ /**
+ * salt used to compute h_wire
+ */
+ struct TALER_WireSaltP salt;
+ } ok;
+
+ } details;
+};
+
+
+/**
+ * Function called with the result of the POST /instances/$ID/accounts operation.
+ *
+ * @param cls closure
+ * @param par response data
+ */
+typedef void
+(*TALER_MERCHANT_AccountsPostCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_AccountsPostResponse *par);
+
+
+/**
+ * Setup an new account for an instance in the backend.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param payto_uri URI of the bank account as per RFC 8905
+ * @param credit_facade_url credit facade for the account, can be NULL
+ * @param credit_facade_credentials credentials for credit facade, can be NULL
+ * @param account the bank accounts to add to the merchant instance
+ * @param cb function to call with the response
+ * @param cb_cls closure for @a config_cb
+ * @return the instances handle; NULL upon error
+ */
+struct TALER_MERCHANT_AccountsPostHandle *
+TALER_MERCHANT_accounts_post (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *payto_uri,
+ const char *credit_facade_url,
+ const json_t *credit_facade_credentials,
+ TALER_MERCHANT_AccountsPostCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel POST /accounts request. Must not be called by clients after
+ * the callback was invoked.
+ *
+ * @param pah request to cancel.
+ */
+void
+TALER_MERCHANT_accounts_post_cancel (
+ struct TALER_MERCHANT_AccountsPostHandle *pah);
+
+
+/**
+ * Handle for a GET /accounts/$ID operation.
+ */
+struct TALER_MERCHANT_AccountGetHandle;
+
+
+/**
+ * Details about a merchant's bank account.
+ */
+struct TALER_MERCHANT_AccountDetails
+{
+ /**
+ * salt used to compute h_wire
+ */
+ struct TALER_WireSaltP salt;
+
+ /**
+ * payto:// URI of the account.
+ */
+ const char *payto_uri;
+
+ /**
+ * Credit facade URL of the account.
+ */
+ const char *credit_facade_url;
+
+ /**
+ * Hash of @e payto_uri and @e salt.
+ */
+ struct TALER_MerchantWireHashP h_wire;
+
+ /**
+ * true if the account is active,
+ * false if it is historic.
+ */
+ bool active;
+};
+
+
+/**
+ * Response returned with details about an account.
+ */
+struct TALER_MERCHANT_AccountGetResponse
+{
+ /**
+ * HTTP response data
+ */
+ struct TALER_MERCHANT_HttpResponse hr;
+
+ union
+ {
+
+ /**
+ * Data returned on #MHD_HTTP_OK.
+ */
+ struct
+ {
+
+ /**
+ * bank accounts of the merchant instance
+ */
+ struct TALER_MERCHANT_AccountDetails ad;
+
+ } ok;
+ }
+ details;
+};
+
+
+/**
+ * Function called with the result of the GET /instances/$ID/accounts/$H_WIRE operation.
+ *
+ * @param cls closure
+ * @param igr response details
+ */
+typedef void
+(*TALER_MERCHANT_AccountGetCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_AccountGetResponse *igr);
+
+
+/**
+ * Get the details on one of the accounts of an instance. Will connect to the
+ * merchant backend and obtain information about the account. The respective
+ * information will be passed to the @a cb once available.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param instance_id identity of the instance to get information about
+ * @param h_wire hash of the wire details
+ * @param cb function to call with the
+ * backend's instances information
+ * @param cb_cls closure for @a config_cb
+ * @return the instances handle; NULL upon error
+ */
+struct TALER_MERCHANT_AccountGetHandle *
+TALER_MERCHANT_account_get (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *instance_id,
+ const struct TALER_MerchantWireHashP *h_wire,
+ TALER_MERCHANT_AccountGetCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel GET /accounts/$H_WIRE request. Must not be called by clients after
+ * the callback was invoked.
+ *
+ * @param igh request to cancel.
+ */
+void
+TALER_MERCHANT_account_get_cancel (
+ struct TALER_MERCHANT_AccountGetHandle *igh);
+
+
+/**
+ * Handle for a GET /accounts operation.
+ */
+struct TALER_MERCHANT_AccountsGetHandle;
+
+/**
+ * Individual account (minimal information
+ * returned via GET /accounts).
+ */
+struct TALER_MERCHANT_AccountEntry
+{
+ /**
+ * account payto URI.
+ */
+ const char *payto_uri;
+
+ /**
+ * Hash of @e payto_uri and salt.
+ */
+ struct TALER_MerchantWireHashP h_wire;
+
+};
+
+
+/**
+ * Response to a GET /accounts operation.
+ */
+struct TALER_MERCHANT_AccountsGetResponse
+{
+ /**
+ * HTTP response details
+ */
+ struct TALER_MERCHANT_HttpResponse hr;
+
+ /**
+ * Details depending on status.
+ */
+ union
+ {
+ /**
+ * Details if status is #MHD_HTTP_OK.
+ */
+ struct
+ {
+ /**
+ * length of the @e accounts array
+ */
+ unsigned int accounts_length;
+
+ /**
+ * array of accounts the requested instance offers
+ */
+ const struct TALER_MERCHANT_AccountEntry *accounts;
+ } ok;
+ } details;
+};
+
+
+/**
+ * Function called with the result of the GET /accounts operation.
+ *
+ * @param cls closure
+ * @param tgr response details
+ */
+typedef void
+(*TALER_MERCHANT_AccountsGetCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_AccountsGetResponse *tgr);
+
+
+/**
+ * Make a GET /accounts request.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param cb function to call with the backend information
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_AccountsGetHandle *
+TALER_MERCHANT_accounts_get (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ TALER_MERCHANT_AccountsGetCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel GET /accounts operation.
+ *
+ * @param tgh operation to cancel
+ */
+void
+TALER_MERCHANT_accounts_get_cancel (
+ struct TALER_MERCHANT_AccountsGetHandle *tgh);
+
+
+/**
+ * Handle for a PATCH /account operation.
+ */
+struct TALER_MERCHANT_AccountPatchHandle;
+
+
+/**
+ * Function called with the result of the PATCH /account operation.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ */
+typedef void
+(*TALER_MERCHANT_AccountPatchCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr);
+
+
+/**
+ * Make a PATCH /accounts/$H_WIRE request to update account details. Cannot be used to change the payto URI or the salt.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param h_wire identifies the account to patch
+ * @param credit_facade_url credit facade for the account, can be NULL
+ * @param credit_facade_credentials credentials for credit facade, can be NULL
+ * @param cb function to call with the backend's result
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_AccountPatchHandle *
+TALER_MERCHANT_account_patch (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const struct TALER_MerchantWireHashP *h_wire,
+ const char *credit_facade_url,
+ const json_t *credit_facade_credentials,
+ TALER_MERCHANT_AccountPatchCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel PATCH /accounts/$H_WIRE operation.
+ *
+ * @param[in] tph operation to cancel
+ */
+void
+TALER_MERCHANT_account_patch_cancel (
+ struct TALER_MERCHANT_AccountPatchHandle *tph);
+
+
+/**
+ * Handle for a DELETE /instances/$ID/account/$H_WIRE operation.
+ */
+struct TALER_MERCHANT_AccountDeleteHandle;
+
+
+/**
+ * Response for a DELETE /instances/$ID/account operation.
+ */
+struct TALER_MERCHANT_AccountDeleteResponse
+{
+ /**
+ * HTTP response data
+ */
+ struct TALER_MERCHANT_HttpResponse hr;
+};
+
+
+/**
+ * Function called with the result of the DELETE /instances/$ID/account/$H_WIRE operation.
+ *
+ * @param cls closure
+ * @param par response data
+ */
+typedef void
+(*TALER_MERCHANT_AccountDeleteCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_AccountDeleteResponse *par);
+
+
+/**
+ * Remove bank account from an instance in the backend.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param h_wire wire hash of the bank accounts to delete
+ * @param cb function to call with the response
+ * @param cb_cls closure for @a config_cb
+ * @return the instances handle; NULL upon error
+ */
+struct TALER_MERCHANT_AccountDeleteHandle *
+TALER_MERCHANT_account_delete (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const struct TALER_MerchantWireHashP *h_wire,
+ TALER_MERCHANT_AccountDeleteCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel /account request. Must not be called by clients after
+ * the callback was invoked.
+ *
+ * @param pah request to cancel.
+ */
+void
+TALER_MERCHANT_account_delete_cancel (
+ struct TALER_MERCHANT_AccountDeleteHandle *pah);
+
+
/* ********************* /products *********************** */
@@ -4922,6 +5141,364 @@ TALER_MERCHANT_kyc_get_cancel (
struct TALER_MERCHANT_KycGetHandle *kyc);
+/* ********************* /otp-devices *********************** */
+
+
+/**
+ * Handle for a GET /otp-devices operation.
+ */
+struct TALER_MERCHANT_OtpDevicesGetHandle;
+
+/**
+ * Individual OTP device (minimal information
+ * returned via GET /otp-devices).
+ */
+struct TALER_MERCHANT_OtpDeviceEntry
+{
+ /**
+ * OTP device identifier.
+ */
+ const char *otp_device_id;
+
+ /**
+ * OTP device description.
+ */
+ const char *device_description;
+
+};
+
+
+/**
+ * Response to a GET /otp-devices operation.
+ */
+struct TALER_MERCHANT_OtpDevicesGetResponse
+{
+ /**
+ * HTTP response details
+ */
+ struct TALER_MERCHANT_HttpResponse hr;
+
+ /**
+ * Details depending on status.
+ */
+ union
+ {
+ /**
+ * Details if status is #MHD_HTTP_OK.
+ */
+ struct
+ {
+ /**
+ * length of the @e otp_devices array
+ */
+ unsigned int otp_devices_length;
+
+ /**
+ * array of otp_devices the requested instance offers
+ */
+ const struct TALER_MERCHANT_OtpDeviceEntry *otp_devices;
+ } ok;
+ } details;
+};
+
+
+/**
+ * Function called with the result of the GET /otp-devices operation.
+ *
+ * @param cls closure
+ * @param tgr response details
+ */
+typedef void
+(*TALER_MERCHANT_OtpDevicesGetCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_OtpDevicesGetResponse *tgr);
+
+
+/**
+ * Make a GET /otp-devices request.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param cb function to call with the backend information
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_OtpDevicesGetHandle *
+TALER_MERCHANT_otp_devices_get (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ TALER_MERCHANT_OtpDevicesGetCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel GET /otp-devices operation.
+ *
+ * @param tgh operation to cancel
+ */
+void
+TALER_MERCHANT_otp_devices_get_cancel (
+ struct TALER_MERCHANT_OtpDevicesGetHandle *tgh);
+
+
+/**
+ * Handle for a GET /otp-device/$ID operation. Gets details
+ * about a single otp_device. Do not confused with a
+ * `struct TALER_MERCHANT_OtpDevicesGetHandle`, which
+ * obtains a list of all otp_devices.
+ */
+struct TALER_MERCHANT_OtpDeviceGetHandle;
+
+
+/**
+ * Details in a response to a GET /otp-devices request.
+ */
+struct TALER_MERCHANT_OtpDeviceGetResponse
+{
+ /**
+ * HTTP response details.
+ */
+ struct TALER_MERCHANT_HttpResponse hr;
+
+ /**
+ * Response details depending on the HTTP status.
+ */
+ union
+ {
+ /**
+ * Information returned if the status was #MHD_HTTP_OK.
+ */
+ struct
+ {
+
+ /**
+ * description of the otp_device
+ */
+ const char *otp_device_description;
+
+ /**
+ * OTP device key.
+ */
+ const char *otp_key;
+
+ /**
+ * current counter.
+ */
+ uint64_t otp_ctr;
+
+ /**
+ * OTP algorithm used.
+ */
+ enum TALER_MerchantConfirmationAlgorithm otp_alg;
+
+ } ok;
+
+ } details;
+
+};
+
+
+/**
+ * Function called with the result of the GET /otp-device/$ID operation.
+ *
+ * @param cls closure
+ * @param tgr HTTP response details
+ */
+typedef void
+(*TALER_MERCHANT_OtpDeviceGetCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_OtpDeviceGetResponse *tgr);
+
+
+/**
+ * Make a GET /otp-device/$ID request to get details about an
+ * individual OTP device.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param otp_device_id identifier of the otp_device to inquire about
+ * @param cb function to call with the backend's otp_device information
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_OtpDeviceGetHandle *
+TALER_MERCHANT_otp_device_get (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *otp_device_id,
+ TALER_MERCHANT_OtpDeviceGetCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel GET /otp-devices/$ID operation.
+ *
+ * @param tgh operation to cancel
+ */
+void
+TALER_MERCHANT_otp_device_get_cancel (
+ struct TALER_MERCHANT_OtpDeviceGetHandle *tgh);
+
+
+/**
+ * Handle for a POST /otp-devices operation.
+ */
+struct TALER_MERCHANT_OtpDevicesPostHandle;
+
+
+/**
+ * Function called with the result of the POST /otp-devices operation.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ */
+typedef void
+(*TALER_MERCHANT_OtpDevicesPostCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr);
+
+
+/**
+ * Make a POST /otp-devices request to add an OTP device
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param otp_id identifier to use for the OTP device
+ * @param otp_device_description description of the OTP device
+ * @param otp_key key of the OTP device
+ * @param otp_alg OTP algorithm used
+ * @param otp_ctr counter for counter-based OTP
+ * @param cb function to call with the backend's result
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_OtpDevicesPostHandle *
+TALER_MERCHANT_otp_devices_post (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *otp_id,
+ const char *otp_device_description,
+ const char *otp_key,
+ enum TALER_MerchantConfirmationAlgorithm otp_alg,
+ uint64_t otp_ctr,
+ TALER_MERCHANT_OtpDevicesPostCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel POST /otp-devices operation.
+ *
+ * @param[in] tph operation to cancel
+ */
+void
+TALER_MERCHANT_otp_devices_post_cancel (
+ struct TALER_MERCHANT_OtpDevicesPostHandle *tph);
+
+
+/**
+ * Handle for a PATCH /otp-device operation.
+ */
+struct TALER_MERCHANT_OtpDevicePatchHandle;
+
+
+/**
+ * Function called with the result of the PATCH /otp-device operation.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ */
+typedef void
+(*TALER_MERCHANT_OtpDevicePatchCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr);
+
+
+/**
+ * Make a PATCH /otp-device request to update OTP device details
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param otp_id identifier to use for the OTP device; the OTP device must exist,
+ * or the transaction will fail with a #MHD_HTTP_NOT_FOUND
+ * HTTP status code
+ * @param otp_device_description description of the otp_device
+ * @param otp_key key of the OTP device
+ * @param otp_alg OTP algorithm used
+ * @param otp_ctr counter for counter-based OTP
+ * @param cb function to call with the backend's result
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_OtpDevicePatchHandle *
+TALER_MERCHANT_otp_device_patch (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *otp_id,
+ const char *otp_device_description,
+ const char *otp_key,
+ enum TALER_MerchantConfirmationAlgorithm otp_alg,
+ uint64_t otp_ctr,
+ TALER_MERCHANT_OtpDevicePatchCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel PATCH /otp-device operation.
+ *
+ * @param[in] tph operation to cancel
+ */
+void
+TALER_MERCHANT_otp_device_patch_cancel (
+ struct TALER_MERCHANT_OtpDevicePatchHandle *tph);
+
+
+/**
+ * Handle for a DELETE /otp-device/$ID operation.
+ */
+struct TALER_MERCHANT_OtpDeviceDeleteHandle;
+
+
+/**
+ * Function called with the result of the DELETE /otp-device/$ID operation.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ */
+typedef void
+(*TALER_MERCHANT_OtpDeviceDeleteCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr);
+
+
+/**
+ * Make a DELETE /otp-device/$ID request to delete an OTP device.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param otp_device_id identifier of the OTP device
+ * @param cb function to call with the backend's deletion status
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_OtpDeviceDeleteHandle *
+TALER_MERCHANT_otp_device_delete (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *otp_device_id,
+ TALER_MERCHANT_OtpDeviceDeleteCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel DELETE /otp-device/$ID operation.
+ *
+ * @param[in] tdh operation to cancel
+ */
+void
+TALER_MERCHANT_otp_device_delete_cancel (
+ struct TALER_MERCHANT_OtpDeviceDeleteHandle *tdh);
+
+
/* ********************* /templates *********************** */
@@ -5053,25 +5630,15 @@ struct TALER_MERCHANT_TemplateGetResponse
const char *template_description;
/**
- * Shared key with the POS
+ * OTP device ID used by the POS, NULL if none.
*/
- const char *pos_key;
-
- /**
- * Option that add amount of the order
- */
- const enum TALER_MerchantConfirmationAlgorithm pos_alg;
+ const char *otp_id;
/**
* Template for the contract.
*/
const json_t *template_contract;
- /**
- * Algorithm used to generate confirmations for the merchant.
- */
- enum TALER_MerchantConfirmationAlgorithm mca;
-
} ok;
} details;
@@ -5146,8 +5713,7 @@ typedef void
* @param backend_url HTTP base URL for the backend
* @param template_id identifier to use for the template
* @param template_description description of the template
- * @param pos_key shared key with the POS
- * @param mca algorithm used to generate confirmations
+ * @param otp_id ID of the OTP device, or NULL if OTP is not used
* @param template_contract is the contract of the company
* @param cb function to call with the backend's result
* @param cb_cls closure for @a cb
@@ -5159,8 +5725,7 @@ TALER_MERCHANT_templates_post (
const char *backend_url,
const char *template_id,
const char *template_description,
- const char *pos_key,
- enum TALER_MerchantConfirmationAlgorithm mca,
+ const char *otp_id,
const json_t *template_contract,
TALER_MERCHANT_TemplatesPostCallback cb,
void *cb_cls);
@@ -5203,8 +5768,7 @@ typedef void
* or the transaction will fail with a #MHD_HTTP_NOT_FOUND
* HTTP status code
* @param template_description description of the template
- * @param pos_key shared key with the POS
- * @param mca algorithm used to generate confirmations
+ * @param otp_id device ID of the OTP device, or NULL if OTP is not used
* @param template_contract is the contract of the company
* @param cb function to call with the backend's result
* @param cb_cls closure for @a cb
@@ -5216,8 +5780,7 @@ TALER_MERCHANT_template_patch (
const char *backend_url,
const char *template_id,
const char *template_description,
- const char *pos_key,
- enum TALER_MerchantConfirmationAlgorithm mca,
+ const char *otp_id,
json_t *template_contract,
TALER_MERCHANT_TemplatePatchCallback cb,
void *cb_cls);
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
index bc888fa7..ded1ac5a 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -91,7 +91,6 @@ TALER_TESTING_cmd_merchant_get_instances (const char *label,
* @param merchant_url base URL of the merchant serving the
* POST /instances request.
* @param instance_id the ID of the instance to create
- * @param payto_uri payment URI to use
* @param http_status expected HTTP response code.
* @return the command.
*/
@@ -99,7 +98,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_instances (const char *label,
const char *merchant_url,
const char *instance_id,
- const char *payto_uri,
unsigned int http_status);
@@ -129,8 +127,6 @@ TALER_TESTING_cmd_merchant_post_instance_auth (const char *label,
* @param merchant_url base URL of the merchant serving the
* POST /instances request.
* @param instance_id the ID of the instance to query
- * @param accounts_length length of the @a payto_uris array
- * @param payto_uris URIs of the bank accounts of the merchant instance
* @param name name of the merchant instance
* @param address physical address of the merchant instance
* @param jurisdiction jurisdiction of the merchant instance
@@ -146,8 +142,6 @@ TALER_TESTING_cmd_merchant_post_instances2 (
const char *label,
const char *merchant_url,
const char *instance_id,
- unsigned int accounts_length,
- const char *payto_uris[],
const char *name,
json_t *address,
json_t *jurisdiction,
@@ -181,19 +175,39 @@ TALER_TESTING_cmd_merchant_post_account (
/**
+ * Define a "PATCH /account" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ * POST /instances request.
+ * @param create_account_ref reference to account setup command
+ * @param credit_facade_url credit facade URL to configure, can be NULL
+ * @param credit_facade_credentials credit facade credentials to use, can be NULL
+ * @param http_status expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_patch_account (
+ const char *label,
+ const char *merchant_url,
+ const char *create_account_ref,
+ const char *credit_facade_url,
+ const json_t *credit_facade_credentials,
+ unsigned int http_status);
+
+
+/**
* Define a "DELETE /account" CMD.
*
* @param label command label.
- * @param get_instance_ref reference to a GET instance command
- * @param payto_uri payto URI of the account to delete, must be in the response of the GET instance command
+ * @param create_account_ref reference to account setup command
* @param http_status expected HTTP response code.
* @return the command.
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_delete_account (
const char *label,
- const char *get_instance_ref,
- const char *payto_uri,
+ const char *create_account_ref,
unsigned int http_status);
@@ -220,8 +234,6 @@ TALER_TESTING_cmd_merchant_patch_instance (
const char *label,
const char *merchant_url,
const char *instance_id,
- unsigned int payto_uris_length,
- const char *payto_uris[],
const char *name,
json_t *address,
json_t *jurisdiction,
@@ -252,35 +264,6 @@ TALER_TESTING_cmd_merchant_get_instance (const char *label,
/**
- * Define a "GET instance" CMD that compares accounts returned.
- *
- * @param label command label.
- * @param merchant_url base URL of the merchant serving the
- * GET /instances/$ID request.
- * @param instance_id the ID of the instance to query
- * @param http_status expected HTTP response code.
- * @param instance_reference reference to a "POST /instances" or "PATCH /instances/$ID" CMD
- * that will provide what we expect the backend to return to us
- * @param active_accounts the accounts the merchant is actively using.
- * @param active_accounts_length length of @e active_accounts.
- * @param inactive_accounts the accounts the merchant is no longer using.
- * @param inactive_accounts_length length of @e inactive_accounts.
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_instance2 (const char *label,
- const char *merchant_url,
- const char *instance_id,
- unsigned int http_status,
- const char *instance_reference,
- const char *active_accounts[],
- unsigned int active_accounts_length,
- const char *inactive_accounts[],
- unsigned int
- inactive_accounts_length);
-
-
-/**
* Define a "PURGE instance" CMD.
*
* @param label command label.
@@ -1511,6 +1494,117 @@ TALER_TESTING_cmd_merchant_kyc_get (
enum TALER_AmlDecisionState expected_aml_state);
+/* ****** OTP devices ******* */
+
+
+/**
+ * Define a "POST /otp-devices" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ * POST /otps request.
+ * @param otp_id the ID of the otp device to modify
+ * @param otp_description description of the otp device
+ * @param otp_key base32-encoded key to verify the payment
+ * @param otp_alg is an option that show the amount of the order. it is linked with the @a otp_key
+ * @param otp_ctr counter to use (if in counter mode)
+ * @param http_status expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_post_otp_devices (
+ const char *label,
+ const char *merchant_url,
+ const char *otp_id,
+ const char *otp_description,
+ const char *otp_key,
+ enum TALER_MerchantConfirmationAlgorithm otp_alg,
+ uint64_t otp_ctr,
+ unsigned int http_status);
+
+
+/**
+ * Define a "PATCH /otp-devices/$ID" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ * PATCH /otp-devices request.
+ * @param otp_id the ID of the otp device to modify
+ * @param otp_description description of the otp device
+ * @param otp_key base32-encoded key to verify the payment
+ * @param otp_alg is an option that show the amount of the order. it is linked with the @a otp_key
+ * @param otp_ctr counter to use (if in counter mode)
+ * @param http_status expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_patch_otp_device (
+ const char *label,
+ const char *merchant_url,
+ const char *otp_id,
+ const char *otp_description,
+ const char *otp_key,
+ enum TALER_MerchantConfirmationAlgorithm otp_alg,
+ uint64_t otp_ctr,
+ unsigned int http_status);
+
+
+/**
+ * Define a "GET /otp-devices" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ * GET /otp-devices request.
+ * @param http_status expected HTTP response code.
+ * @param ... NULL-terminated list of labels (const char *) of
+ * otp (commands) we expect to be returned in the list
+ * (assuming @a http_code is #MHD_HTTP_OK)
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_get_otp_devices (const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ ...);
+
+
+/**
+ * Define a "GET otp device" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ * GET /otp-devices/$ID request.
+ * @param otp_id the ID of the otp to query
+ * @param http_status expected HTTP response code.
+ * @param otp_reference reference to a "POST /otp-devices" or "PATCH /otp-devices/$ID" CMD
+ * that will provide what we expect the backend to return to us
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_get_otp_device (const char *label,
+ const char *merchant_url,
+ const char *otp_id,
+ unsigned int http_status,
+ const char *otp_reference);
+
+
+/**
+ * Define a "DELETE otp device" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ * DELETE /otp-devices/$ID request.
+ * @param otp_id the ID of the otp to query
+ * @param http_status expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_delete_otp_device (const char *label,
+ const char *merchant_url,
+ const char *otp_id,
+ unsigned int http_status);
+
+
/* ****** Templates ******* */
/**
@@ -1521,8 +1615,7 @@ TALER_TESTING_cmd_merchant_kyc_get (
* POST /templates request.
* @param template_id the ID of the template to query
* @param template_description description of the template
- * @param pos_key base32-encoded key to verify the payment
- * @param pos_alg is an option that show the amount of the order. it is linked with the pos_key
+ * @param otp_id OTP device ID, NULL for none
* @param template_contract where the contract of the company is
* @param http_status expected HTTP response code.
* @return the command.
@@ -1533,8 +1626,7 @@ TALER_TESTING_cmd_merchant_post_templates2 (
const char *merchant_url,
const char *template_id,
const char *template_description,
- const char *pos_key,
- const enum TALER_MerchantConfirmationAlgorithm pos_alg,
+ const char *otp_id,
json_t *template_contract,
unsigned int http_status);
@@ -1566,8 +1658,7 @@ TALER_TESTING_cmd_merchant_post_templates (const char *label,
* PATCH /template request.
* @param template_id the ID of the template to query
* @param template_description description of the template
- * @param pos_key base32-encoded key to verify the payment
- * @param pos_alg is an option that show the amount of the order. it is linked with the pos_key
+ * @param otp_id OTP device to use
* @param template_contract contract of the company
* @param http_status expected HTTP response code.
* @return the command.
@@ -1578,8 +1669,7 @@ TALER_TESTING_cmd_merchant_patch_template (
const char *merchant_url,
const char *template_id,
const char *template_description,
- const char *pos_key,
- const enum TALER_MerchantConfirmationAlgorithm pos_alg,
+ const char *otp_id,
json_t *template_contract,
unsigned int http_status);
@@ -1645,6 +1735,7 @@ TALER_TESTING_cmd_merchant_delete_template (const char *label,
*
* @param label command label.
* @param template_ref label of command that created the template to use
+ * @param otp_ref label of command that created OTP device we use (or NULL for no OTP)
* @param merchant_url base URL of the merchant serving the
* POST /using-templates request.
* @param using_template_id template ID to use
@@ -1659,6 +1750,7 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_using_templates (
const char *label,
const char *template_ref,
+ const char *otp_ref,
const char *merchant_url,
const char *using_template_id,
const char *summary,
@@ -1909,8 +2001,10 @@ TALER_TESTING_cmd_checkserver2 (const char *label,
op (h_wire, const struct TALER_MerchantWireHashP) \
op (proposal_reference, const char) \
op (template_description, const char) \
- op (template_pos_key, const char) \
- op (template_pos_alg, const enum TALER_MerchantConfirmationAlgorithm) \
+ op (otp_device_description, const char) \
+ op (otp_id, const char) \
+ op (otp_key, const char) \
+ op (otp_alg, const enum TALER_MerchantConfirmationAlgorithm) \
op (template_id, const char) \
op (template_contract, const json_t) \
op (event_type, const char) \
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
index 1c0cd37c..14dedce5 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -96,20 +96,20 @@ struct TALER_MERCHANTDB_AccountDetails
/**
* Actual account address as a payto://-URI.
*/
- const char *payto_uri;
+ char *payto_uri;
/**
* Where can the taler-merchant-wirewatch helper
* download information about incoming transfers?
* NULL if not available.
*/
- const char *credit_facade_url;
+ char *credit_facade_url;
/**
* JSON with credentials to use to access the
* @e credit_facade_url.
*/
- const json_t *credit_facade_credentials;
+ json_t *credit_facade_credentials;
/**
* Is the account set for active use in new contracts?
@@ -219,9 +219,20 @@ typedef void
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct TALER_MerchantPrivateKeyP *merchant_priv,
const struct TALER_MERCHANTDB_InstanceSettings *is,
- const struct TALER_MERCHANTDB_InstanceAuthSettings *ias,
- unsigned int accounts_length,
- const struct TALER_MERCHANTDB_AccountDetails accounts[]);
+ const struct TALER_MERCHANTDB_InstanceAuthSettings *ias);
+
+
+/**
+ * Callback invoked with information about a bank account.
+ *
+ * @param cls closure
+ * @param ad details about the account
+ */
+typedef void
+(*TALER_MERCHANTDB_AccountCallback)(
+ void *cls,
+ const struct TALER_MERCHANTDB_AccountDetails *ad);
+
/**
* Typically called by `lookup_products`.
@@ -311,7 +322,7 @@ struct TALER_MERCHANTDB_ProductDetails
/**
* Typically called by `lookup_templates`.
*
- * @param cls a `json_t *` JSON array to build
+ * @param cls closure
* @param template_id ID of the template
* @param template_description description of the template
*/
@@ -322,6 +333,19 @@ typedef void
/**
+ * Typically called by `lookup_otp_devices`.
+ *
+ * @param cls closure
+ * @param otp_id ID of the OTP device
+ * @param otp_description description of the OTP device
+ */
+typedef void
+(*TALER_MERCHANTDB_OtpDeviceCallback)(void *cls,
+ const char *otp_id,
+ const char *otp_description);
+
+
+/**
* Details about a template.
*/
struct TALER_MERCHANTDB_TemplateDetails
@@ -332,19 +356,42 @@ struct TALER_MERCHANTDB_TemplateDetails
char *template_description;
/**
- * Base64-encoded key, or NULL.
+ * In this template contract, we can have additional information.
+ */
+ json_t *template_contract;
+
+ /**
+ * ID of the OTP device linked to the template, or NULL.
*/
- char *pos_key;
+ char *otp_id;
+};
+
+
+/**
+ * Details about an OTP device.
+ */
+struct TALER_MERCHANTDB_OtpDeviceDetails
+{
/**
- * In this template contract, we can have additional information.
+ * Description of the device.
*/
- json_t *template_contract;
+ char *otp_description;
+
+ /**
+ * Current usage counter value.
+ */
+ uint64_t otp_ctr;
+
+ /**
+ * Base64-encoded key.
+ */
+ char *otp_key;
/**
* Algorithm used to compute purchase confirmations.
*/
- enum TALER_MerchantConfirmationAlgorithm pos_algorithm;
+ enum TALER_MerchantConfirmationAlgorithm otp_algorithm;
};
@@ -1223,14 +1270,52 @@ struct TALER_MERCHANTDB_Plugin
*
* @param cls closure
* @param id identifier of the instance
- * @param account_details details about the account to update
+ * @param h_wire which account to update
+ * @param credit_facade_url new facade URL, can be NULL
+ * @param credit_facade_credentials new credentials, can be NULL
* @return database result code
*/
enum GNUNET_DB_QueryStatus
(*update_account)(
void *cls,
const char *id,
- const struct TALER_MERCHANTDB_AccountDetails *account_details);
+ const struct TALER_MerchantWireHashP *h_wire,
+ const char *credit_facade_url,
+ const json_t *credit_facade_credentials);
+
+
+ /**
+ * Obtain information about an instance's accounts.
+ *
+ * @param cls closure
+ * @param id identifier of the instance
+ * @param cb function to call on each account
+ * @param cb_cls closure for @a cb
+ * @return database result code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*select_accounts)(
+ void *cls,
+ const char *id,
+ TALER_MERCHANTDB_AccountCallback cb,
+ void *cb_cls);
+
+
+ /**
+ * Obtain detailed information about an instance's account.
+ *
+ * @param cls closure
+ * @param id identifier of the instance
+ * @param h_wire wire hash of the account
+ * @param[out] ad account details returned
+ * @return database result code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*select_account)(
+ void *cls,
+ const char *id,
+ const struct TALER_MerchantWireHashP *h_wire,
+ struct TALER_MERCHANTDB_AccountDetails *ad);
/**
@@ -2867,6 +2952,7 @@ struct TALER_MERCHANTDB_Plugin
* @param cls closure
* @param instance_id instance to insert template for
* @param template_id template identifier of template to insert
+ * @param otp_serial_id 0 if no OTP device is associated
* @param td the template details to insert
* @return database result code
*/
@@ -2874,10 +2960,106 @@ struct TALER_MERCHANTDB_Plugin
(*insert_template)(void *cls,
const char *instance_id,
const char *template_id,
+ uint64_t otp_serial_id,
const struct TALER_MERCHANTDB_TemplateDetails *td);
/**
+ * Delete information about an OTP device.
+ *
+ * @param cls closure
+ * @param instance_id instance to delete OTP device of
+ * @param otp_id otp device to delete
+ * @return DB status code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS
+ * if template unknown.
+ */
+ enum GNUNET_DB_QueryStatus
+ (*delete_otp) (void *cls,
+ const char *instance_id,
+ const char *otp_id);
+
+ /**
+ * Insert details about a particular OTP device.
+ *
+ * @param cls closure
+ * @param instance_id instance to insert OTP device for
+ * @param otp_id otp identifier of OTP device to insert
+ * @param td the OTP device details to insert
+ * @return database result code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*insert_otp) (void *cls,
+ const char *instance_id,
+ const char *otp_id,
+ const struct TALER_MERCHANTDB_OtpDeviceDetails *td);
+
+
+ /**
+ * Update details about a particular OTP device.
+ *
+ * @param cls closure
+ * @param instance_id instance to update OTP device for
+ * @param otp_id OTP device to update
+ * @param td update to the OTP device details on success, can be NULL
+ * (in that case we only want to check if the template exists)
+ * @return database result code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the template
+ * does not yet exist.
+ */
+ enum GNUNET_DB_QueryStatus
+ (*update_otp) (void *cls,
+ const char *instance_id,
+ const char *otp_id,
+ const struct TALER_MERCHANTDB_OtpDeviceDetails *td);
+
+ /**
+ * Lookup all of the OTP devices the given instance has configured.
+ *
+ * @param cls closure
+ * @param instance_id instance to lookup OTP devices for
+ * @param cb function to call on all OTP devices found
+ * @param cb_cls closure for @a cb
+ * @return database result code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*lookup_otp_devices) (void *cls,
+ const char *instance_id,
+ TALER_MERCHANTDB_OtpDeviceCallback cb,
+ void *cb_cls);
+
+
+ /**
+ * Lookup details about an OTP device.
+ *
+ * @param cls closure
+ * @param instance_id instance to lookup template for
+ * @param otp_id OTP device to lookup
+ * @param[out] td set to the OTP device details on success, can be NULL
+ * (in that case we only want to check if the template exists)
+ * @return database result code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*select_otp) (void *cls,
+ const char *instance_id,
+ const char *otp_id,
+ struct TALER_MERCHANTDB_OtpDeviceDetails *td);
+
+
+ /**
+ * Lookup serial number of an OTP device.
+ *
+ * @param cls closure
+ * @param instance_id instance to lookup template for
+ * @param otp_id OTP device to lookup
+ * @param[out] serial set to the OTP device serial number * @return database result code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*select_otp_serial) (void *cls,
+ const char *instance_id,
+ const char *otp_id,
+ uint64_t *serial);
+
+
+ /**
* Update details about a particular template.
*
* @param cls closure