diff options
author | Christian Blättler <blatc2@bfh.ch> | 2024-04-26 11:47:34 +0200 |
---|---|---|
committer | Christian Blättler <blatc2@bfh.ch> | 2024-04-26 11:47:34 +0200 |
commit | e491838fc6143011634a0148bf03a0b7a3bca5f5 (patch) | |
tree | e32a05716012f164b5d69b34262e7df206ac46dd /src/testing | |
parent | 169ece9db401e031681a7e9337db1f5086f78d1d (diff) |
extend testing lib to support paying for orders with choices
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/testing_api_cmd_pay_order.c | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c index 0b84c8a6..f748a06a 100644 --- a/src/testing/testing_api_cmd_pay_order.c +++ b/src/testing/testing_api_cmd_pay_order.c @@ -23,6 +23,7 @@ * @author Christian Grothoff */ #include "platform.h" +#include <jansson.h> #include <taler/taler_exchange_service.h> #include <taler/taler_testing_lib.h> #include <taler/taler_signatures.h> @@ -107,6 +108,11 @@ struct PayState */ enum TALER_MerchantConfirmationAlgorithm pos_alg; + /** + * Wallet data json object. Used in the pay request if not NULL. + */ + const json_t *wallet_data; + }; @@ -438,7 +444,7 @@ pay_run (void *cls, ps->merchant_url, ps->session_id, h_proposal, - NULL, + ps->wallet_data, &ps->total_amount, &max_fee, &merchant_pub, @@ -560,14 +566,16 @@ pay_traits (void *cls, struct TALER_TESTING_Command -TALER_TESTING_cmd_merchant_pay_order (const char *label, - const char *merchant_url, - unsigned int http_status, - const char *proposal_reference, - const char *coin_reference, - const char *amount_with_fee, - const char *amount_without_fee, - const char *session_id) +TALER_TESTING_cmd_merchant_pay_order_choices (const char *label, + const char *merchant_url, + unsigned int http_status, + const char *proposal_reference, + const char *coin_reference, + const char *amount_with_fee, + const char *amount_without_fee, + const char *session_id, + int choice_index, + const char *input_reference) { struct PayState *ps; @@ -579,6 +587,12 @@ TALER_TESTING_cmd_merchant_pay_order (const char *label, ps->amount_with_fee = amount_with_fee; ps->amount_without_fee = amount_without_fee; ps->session_id = session_id; + if (0 <= choice_index) + { + ps->wallet_data = json_pack ("{s:i}", + "choice_index", + choice_index); + } { struct TALER_TESTING_Command cmd = { .cls = ps, @@ -593,4 +607,26 @@ TALER_TESTING_cmd_merchant_pay_order (const char *label, } +struct TALER_TESTING_Command +TALER_TESTING_cmd_merchant_pay_order (const char *label, + const char *merchant_url, + unsigned int http_status, + const char *proposal_reference, + const char *coin_reference, + const char *amount_with_fee, + const char *amount_without_fee, + const char *session_id) +{ + return TALER_TESTING_cmd_merchant_pay_order_choices (label, + merchant_url, + http_status, + proposal_reference, + coin_reference, + amount_with_fee, + amount_without_fee, + session_id, + -1); +} + + /* end of testing_api_cmd_pay_order.c */ |