summaryrefslogtreecommitdiff
path: root/src/include/taler_merchant_testing_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/taler_merchant_testing_lib.h')
-rw-r--r--src/include/taler_merchant_testing_lib.h196
1 files changed, 145 insertions, 51 deletions
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) \