diff options
author | priscilla <priscilla.huang@efrei.net> | 2022-11-23 09:34:32 -0500 |
---|---|---|
committer | priscilla <priscilla.huang@efrei.net> | 2022-11-23 09:34:32 -0500 |
commit | 41fa5f3c3c9f147b8d20c8d8659384e93fe0f985 (patch) | |
tree | 5278141c56e3f7adc0e62017717d06c50e81da2a | |
parent | 7f1816686e8776f3228cc631c115490ed8028b8a (diff) |
template
-rw-r--r-- | src/include/taler_merchant_testing_lib.h | 133 |
1 files changed, 132 insertions, 1 deletions
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h index 92ce1a0b..efcfd7f6 100644 --- a/src/include/taler_merchant_testing_lib.h +++ b/src/include/taler_merchant_testing_lib.h @@ -1487,6 +1487,133 @@ TALER_TESTING_cmd_merchant_kyc_get (const char *label, unsigned int expected_http_status); +/* ****** Templates ******* */ + + +/** + * Define a "POST /templates" CMD. + * + * @param label command label. + * @param merchant_url base URL of the merchant serving the + * POST /templates request. + * @param template_id the ID of the template to query + * @param template_description description of the template + * @param image base64-encoded template image + * @param template_contract where the contract of the company is + * @param http_status expected HTTP response code. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_merchant_post_templates2 ( + const char *label, + const char *merchant_url, + const char *template_id, + const char *template_description, + const char *image, + json_t *template_contract, + unsigned int http_status); + + +/** + * Define a "POST /templates" CMD, simple version + * + * @param label command label. + * @param merchant_url base URL of the merchant serving the + * POST /templates request. + * @param template_id the ID of the template to create + * @param template_description description of the template + * @param http_status expected HTTP response code. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_merchant_post_templates (const char *label, + const char *merchant_url, + const char *template_id, + const char *template_description, + unsigned int http_status); + + +/** + * Define a "PATCH /templates/$ID" CMD. + * + * @param label command label. + * @param merchant_url base URL of the merchant serving the + * PATCH /template request. + * @param template_id the ID of the template to query + * @param template_description description of the template + * @param image base64-encoded template image + * @param template_contract contract of the company + * @param http_status expected HTTP response code. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_merchant_patch_template ( + const char *label, + const char *merchant_url, + const char *template_id, + const char *template_description, + const char *image, + json_t *template_contract, + unsigned int http_status); + + +/** + * Define a "GET /templates" CMD. + * + * @param label command label. + * @param merchant_url base URL of the merchant serving the + * GET /templates request. + * @param http_status expected HTTP response code. + * @param ... NULL-terminated list of labels (const char *) of + * template (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_templates (const char *label, + const char *merchant_url, + unsigned int http_status, + ...); + + +/** + * Define a "GET template" CMD. + * + * @param label command label. + * @param merchant_url base URL of the merchant serving the + * GET /templates/$ID request. + * @param template_id the ID of the template to query + * @param http_status expected HTTP response code. + * @param template_reference reference to a "POST /templates" or "PATCH /templates/$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_template (const char *label, + const char *merchant_url, + const char *template_id, + unsigned int http_status, + const char *template_reference); + + + +/** + * Define a "DELETE product" CMD. + * + * @param label command label. + * @param merchant_url base URL of the merchant serving the + * DELETE /products/$ID request. + * @param product_id the ID of the product to query + * @param http_status expected HTTP response code. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_merchant_delete_template (const char *label, + const char *merchant_url, + const char *template_id, + unsigned int http_status); + + /* ****** Specific traits supported by this component ******* */ @@ -1527,7 +1654,11 @@ TALER_TESTING_cmd_merchant_kyc_get (const char *label, op (order_terms, const json_t) \ op (h_contract_terms, const struct TALER_PrivateContractHashP) \ op (h_wire, const struct TALER_MerchantWireHashP) \ - op (proposal_reference, const char *) + op (proposal_reference, const char *) \ + op (template_description, const char *) \ + op (template_image, const char *) \ + op (template_id, const char *) \ + op (template_contract, const json_t) /** |