From 6624576c0cdd81072256d8abbfe6dd1343f956c6 Mon Sep 17 00:00:00 2001 From: Jonathan Buchanan Date: Wed, 17 Jun 2020 21:35:09 -0400 Subject: implementations, tests, and renames for GET /tips/ & GET /private/tips/ --- src/include/taler_merchant_testing_lib.h | 273 +++++++++++++++---------------- 1 file changed, 136 insertions(+), 137 deletions(-) (limited to 'src/include/taler_merchant_testing_lib.h') diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h index 60846a9e..c7813176 100644 --- a/src/include/taler_merchant_testing_lib.h +++ b/src/include/taler_merchant_testing_lib.h @@ -661,6 +661,142 @@ TALER_TESTING_cmd_get_tips (const char *label, unsigned int http_status); +/** + * Define a GET /private/tips/$TIP_ID CMD. + * + * @param label the command label + * @param merchant_url base URL of the merchant which will + * serve the request. + * @param tip_reference reference to a command that created a tip. + * @param http_status expected HTTP response code for the request. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_merchant_get_tip (const char *label, + const char *merchant_url, + const char *tip_reference, + unsigned int http_status); + + +/** + * Define a GET /tips/$TIP_ID CMD. + * + * @param label the command label + * @param merchant_url base URL of the merchant which will + * serve the request. + * @param tip_reference reference to a command that created a tip. + * @param http_status expected HTTP response code for the request. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_wallet_get_tip (const char *label, + const char *merchant_url, + const char *tip_reference, + unsigned int http_status); + + +/** + * Create a /tip-authorize CMD, specifying the Taler error code + * that is expected to be returned by the backend. + * + * @param label this command label + * @param merchant_url the base URL of the merchant that will + * serve the /tip-authorize request. + * @param exchange_url the base URL of the exchange that owns + * the reserve from which the tip is going to be gotten. + * @param http_status the HTTP response code which is expected + * for this operation. + * @param justification human-readable justification for this + * tip authorization. + * @param amount the amount to authorize for tipping. + * @param ec expected Taler-defined error code. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_tip_authorize_with_ec (const char *label, + const char *merchant_url, + const char *exchange_url, + unsigned int http_status, + const char *justification, + const char *amount, + enum TALER_ErrorCode ec); + + +/** + * This commands does not query the backend at all, + * but just makes up a fake authorization id that will + * be subsequently used by the "pick up" CMD in order + * to test against such a case. + * + * @param label command label. + * @return the command. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_tip_authorize_fake (const char *label); + + +/** + * Create a /tip-authorize CMD. + * + * @param label this command label + * @param merchant_url the base URL of the merchant that will + * serve the /tip-authorize request. + * @param exchange_url the base URL of the exchange that owns + * the reserve from which the tip is going to be gotten. + * @param http_status the HTTP response code which is expected + * for this operation. + * @param justification human-readable justification for this + * tip authorization. + * @param amount the amount to authorize for tipping. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_tip_authorize (const char *label, + const char *merchant_url, + const char *exchange_url, + unsigned int http_status, + const char *justification, + const char *amount); + + +/** + * Define a /tip-pickup CMD, equipped with the expected error + * code. + * + * @param label the command label + * @param merchant_url base URL of the backend which will serve + * the /tip-pickup request. + * @param http_status expected HTTP response code. + * @param authorize_reference reference to a /tip-autorize CMD + * that offers a tip id to pick up. + * @param amounts array of string-defined amounts that specifies + * which denominations will be accepted for tipping. + * @param ec expected Taler error code. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_tip_pickup_with_ec (const char *label, + const char *merchant_url, + unsigned int http_status, + const char *authorize_reference, + const char **amounts, + enum TALER_ErrorCode ec); + +/** + * Define a /tip-pickup CMD. + * + * @param label the command label + * @param merchant_url base URL of the backend which will serve + * the /tip-pickup request. + * @param http_status expected HTTP response code. + * @param authorize_reference reference to a /tip-autorize CMD + * that offers a tip id to pick up. + * @param amounts array of string-defined amounts that specifies + * which denominations will be accepted for tipping. + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_tip_pickup (const char *label, + const char *merchant_url, + unsigned int http_status, + const char *authorize_reference, + const char **amounts); + + /* ******************** OLD ******************* */ @@ -1096,143 +1232,6 @@ TALER_TESTING_get_trait_refund_entry ( // FIXME: rename: entry->detail unsigned int index, const struct TALER_MERCHANT_RefundDetail **refund_entry); -/** - * Create a /tip-authorize CMD, specifying the Taler error code - * that is expected to be returned by the backend. - * - * @param label this command label - * @param merchant_url the base URL of the merchant that will - * serve the /tip-authorize request. - * @param exchange_url the base URL of the exchange that owns - * the reserve from which the tip is going to be gotten. - * @param http_status the HTTP response code which is expected - * for this operation. - * @param justification human-readable justification for this - * tip authorization. - * @param amount the amount to authorize for tipping. - * @param ec expected Taler-defined error code. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_tip_authorize_with_ec (const char *label, - const char *merchant_url, - const char *exchange_url, - unsigned int http_status, - const char *justification, - const char *amount, - enum TALER_ErrorCode ec); - - -/** - * This commands does not query the backend at all, - * but just makes up a fake authorization id that will - * be subsequently used by the "pick up" CMD in order - * to test against such a case. - * - * @param label command label. - * @return the command. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_tip_authorize_fake (const char *label); - - -/** - * Create a /tip-authorize CMD. - * - * @param label this command label - * @param merchant_url the base URL of the merchant that will - * serve the /tip-authorize request. - * @param exchange_url the base URL of the exchange that owns - * the reserve from which the tip is going to be gotten. - * @param http_status the HTTP response code which is expected - * for this operation. - * @param justification human-readable justification for this - * tip authorization. - * @param amount the amount to authorize for tipping. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_tip_authorize (const char *label, - const char *merchant_url, - const char *exchange_url, - unsigned int http_status, - const char *justification, - const char *amount); - -/** - * Define a /tip-query CMD. - * - * @param label the command label - * @param merchant_url base URL of the merchant which will - * server the /tip-query request. - * @param http_status expected HTTP response code for the - * /tip-query request. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_tip_query (const char *label, - const char *merchant_url, - unsigned int http_status); - -/** - * Define a /tip-query CMD equipped with a expected amount. - * - * @param label the command label - * @param merchant_url base URL of the merchant which will - * server the /tip-query request. - * @param http_status expected HTTP response code for the - * /tip-query request. - * @param expected_amount_picked_up expected amount already - * picked up. - * @param expected_amount_authorized expected amount that was - * authorized in the first place. - * @param expected_amount_available FIXME what is this? - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_tip_query_with_amounts (const char *label, - const char *merchant_url, - unsigned int http_status, - const char *expected_amount_picked_up, - const char *expected_amount_authorized, - const char *expected_amount_available); - -/** - * Define a /tip-pickup CMD, equipped with the expected error - * code. - * - * @param label the command label - * @param merchant_url base URL of the backend which will serve - * the /tip-pickup request. - * @param http_status expected HTTP response code. - * @param authorize_reference reference to a /tip-autorize CMD - * that offers a tip id to pick up. - * @param amounts array of string-defined amounts that specifies - * which denominations will be accepted for tipping. - * @param ec expected Taler error code. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_tip_pickup_with_ec (const char *label, - const char *merchant_url, - unsigned int http_status, - const char *authorize_reference, - const char **amounts, - enum TALER_ErrorCode ec); - -/** - * Define a /tip-pickup CMD. - * - * @param label the command label - * @param merchant_url base URL of the backend which will serve - * the /tip-pickup request. - * @param http_status expected HTTP response code. - * @param authorize_reference reference to a /tip-autorize CMD - * that offers a tip id to pick up. - * @param amounts array of string-defined amounts that specifies - * which denominations will be accepted for tipping. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_tip_pickup (const char *label, - const char *merchant_url, - unsigned int http_status, - const char *authorize_reference, - const char **amounts); /** * Make the instruction pointer point to @a new_ip -- cgit v1.2.3