merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 94f8e779a3a8706d5ade4f1871607132acb9e026
parent 280b0a6c5aa4917d85b0e480f9e08ce59b4588d9
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
Date:   Thu, 23 Jul 2020 20:00:13 -0400

test pay with NULL session_id

Diffstat:
Msrc/include/taler_merchant_testing_lib.h | 4+++-
Msrc/merchant-tools/taler-merchant-benchmark.c | 12++++++++----
Msrc/testing/test_merchant_api.c | 30++++++++++++++++++++----------
Msrc/testing/test_merchant_api_twisted.c | 12++++++++----
Msrc/testing/testing_api_cmd_pay_order.c | 12++++++++++--
5 files changed, 49 insertions(+), 21 deletions(-)

diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h @@ -722,6 +722,7 @@ TALER_TESTING_cmd_merchant_claim_order (const char *label, * @param amount_with_fee amount to pay, including the deposit * fee * @param amount_without_fee amount to pay, no fees included. + * @param session_id the session id to use for the payment (can be NULL). * @return the command */ struct TALER_TESTING_Command @@ -731,7 +732,8 @@ TALER_TESTING_cmd_merchant_pay_order (const char *label, const char *proposal_reference, const char *coin_reference, const char *amount_with_fee, - const char *amount_without_fee); + const char *amount_without_fee, + const char *session_id); /** * Make an "abort" test command. diff --git a/src/merchant-tools/taler-merchant-benchmark.c b/src/merchant-tools/taler-merchant-benchmark.c @@ -219,7 +219,8 @@ run (void *cls, "create-proposal-1", "withdraw-coin-1", CURRENCY_5, - CURRENCY_4_99), + CURRENCY_4_99, + NULL), TALER_TESTING_cmd_rewind_ip ("rewind-payments", "create-reserve", payments_number), @@ -239,7 +240,8 @@ run (void *cls, "create-proposal-2", "withdraw-coin-2", CURRENCY_5, - CURRENCY_4_99), + CURRENCY_4_99, + NULL), /* /track/transaction over deposit-simple-2 */ TALER_TESTING_cmd_exec_aggregator ("aggregate-1", @@ -296,7 +298,8 @@ run (void *cls, "create-unaggregated-proposal", "withdraw-coin-1", CURRENCY_5, - CURRENCY_4_99), + CURRENCY_4_99, + NULL), TALER_TESTING_cmd_rewind_ip ("rewind-unaggregated", "create-reserve-1", unaggregated_number), @@ -327,7 +330,8 @@ run (void *cls, "create-twocoins-proposal", "withdraw-coin-2;withdraw-coin-3", CURRENCY_10, - CURRENCY_9_98), + CURRENCY_9_98, + NULL), TALER_TESTING_cmd_exec_aggregator ("aggregate-twocoins", cfg_filename), TALER_TESTING_cmd_rewind_ip ("rewind-twocoins", diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c @@ -328,7 +328,8 @@ run (void *cls, "create-proposal-1", "withdraw-coin-1", "EUR:5", - "EUR:4.99"), + "EUR:4.99", + "session-0"), TALER_TESTING_cmd_poll_order_conclude ("poll-order-merchant-1-conclude", MHD_HTTP_OK, "poll-order-merchant-1-start"), @@ -350,7 +351,8 @@ run (void *cls, "create-proposal-1", "withdraw-coin-1", "EUR:5", - "EUR:4.99"), + "EUR:4.99", + "session-0"), TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-1"), CMD_EXEC_AGGREGATOR ("run-aggregator"), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-498c", @@ -556,7 +558,8 @@ run (void *cls, "create-proposal-2", "withdraw-coin-1", "EUR:5", - "EUR:4.99"), + "EUR:4.99", + NULL), #if 0 TALER_TESTING_cmd_history ("history-0", merchant_url, @@ -621,7 +624,8 @@ run (void *cls, "create-proposal-1r", "withdraw-coin-1r", "EUR:5", - "EUR:4.99"), + "EUR:4.99", + NULL), #if 0 TALER_TESTING_cmd_poll_payment_start ("poll-payment-refund-1", merchant_url, @@ -739,7 +743,8 @@ run (void *cls, "create-proposal-unincreased-refund", "withdraw-coin-unincreased-refund", "EUR:5", - "EUR:4.99"), + "EUR:4.99", + NULL), CMD_EXEC_AGGREGATOR ("run-aggregator-unincreased-refund"), TALER_TESTING_cmd_check_bank_transfer ( "check_bank_transfer-paid-unincreased-refund", @@ -965,7 +970,8 @@ run (void *cls, "create-proposal-tip-1", "pickup-tip-1", "EUR:5", // amount + fee - "EUR:4.99"), // amount - fee + "EUR:4.99", + NULL), // amount - fee CMD_EXEC_AGGREGATOR ("aggregator-tip-1"), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-tip-498c", EXCHANGE_URL, @@ -1011,14 +1017,16 @@ run (void *cls, "create-proposal-10", "withdraw-coin-10a;withdraw-coin-1", "EUR:5", - "EUR:4.99"), + "EUR:4.99", + NULL), TALER_TESTING_cmd_merchant_pay_order ("pay-again-10", merchant_url, MHD_HTTP_OK, "create-proposal-10", "withdraw-coin-10a;withdraw-coin-10b", "EUR:5", - "EUR:4.99"), + "EUR:4.99", + NULL), CMD_EXEC_AGGREGATOR ("run-aggregator-10"), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-9.97-10", EXCHANGE_URL, @@ -1063,14 +1071,16 @@ run (void *cls, "create-proposal-11", "withdraw-coin-11a", "EUR:5", - "EUR:4.99"), + "EUR:4.99", + NULL), TALER_TESTING_cmd_merchant_pay_order ("pay-fail-partial-double-11-bad", merchant_url, MHD_HTTP_CONFLICT, "create-proposal-11", "withdraw-coin-1", "EUR:5", - "EUR:4.99"), + "EUR:4.99", + NULL), TALER_TESTING_cmd_merchant_order_abort ("pay-abort-11", merchant_url, "pay-fail-partial-double-11-good", diff --git a/src/testing/test_merchant_api_twisted.c b/src/testing/test_merchant_api_twisted.c @@ -234,7 +234,8 @@ run (void *cls, "create-proposal-abort-1", "withdraw-coin-abort-1", "EUR:1.01", - "EUR:1.00"), // no sense now + "EUR:1.00", + NULL), // no sense now TALER_TESTING_cmd_delete_object ("hack-abort-1", PROXY_MERCHANT_CONFIG_FILE, "merchant_pub"), @@ -300,7 +301,8 @@ run (void *cls, "create-proposal-double-spend", "withdraw-coin-double-spend", "EUR:1.01", - "EUR:1.00"), // no sense now + "EUR:1.00", + NULL), // no sense now TALER_TESTING_cmd_flip_download ("hack-coin-history", PROXY_MERCHANT_CONFIG_FILE, "history.0.coin_sig"), @@ -312,7 +314,8 @@ run (void *cls, "create-proposal-double-spend-1", "withdraw-coin-double-spend", "EUR:1.01", - "EUR:1.00"), // no sense now + "EUR:1.00", + NULL), // no sense now /* max uint64 number: 9223372036854775807; try to overflow! */ TALER_TESTING_cmd_end () }; @@ -364,7 +367,8 @@ run (void *cls, "create-proposal-1", "withdraw-coin-1", "EUR:5", - "EUR:4.99"), + "EUR:4.99", + NULL), TALER_TESTING_cmd_malform_response ("malform-abort-merchant-exchange", PROXY_EXCHANGE_CONFIG_FILE), TALER_TESTING_cmd_merchant_order_abort ("pay-abort-1", diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c @@ -86,6 +86,11 @@ struct PayState * Signature from the merchant, set on success. */ struct TALER_MerchantSignatureP merchant_sig; + + /** + * The session for which the payment is made. + */ + const char *session_id; }; @@ -357,7 +362,7 @@ pay_run (void *cls, ps->h_contract_terms = *h_proposal; ps->oph = TALER_MERCHANT_order_pay (is->ctx, ps->merchant_url, - "", /* session ID */ + ps->session_id, h_proposal, &total_amount, &max_fee, @@ -487,6 +492,7 @@ pay_traits (void *cls, * @param amount_with_fee amount to pay, including the deposit * fee * @param amount_without_fee amount to pay, no fees included. + * @param session_id the session id to use for the payment (can be NULL). * @return the command */ struct TALER_TESTING_Command @@ -496,7 +502,8 @@ TALER_TESTING_cmd_merchant_pay_order (const char *label, const char *proposal_reference, const char *coin_reference, const char *amount_with_fee, - const char *amount_without_fee) + const char *amount_without_fee, + const char *session_id) { struct PayState *ps; @@ -507,6 +514,7 @@ TALER_TESTING_cmd_merchant_pay_order (const char *label, ps->merchant_url = merchant_url; ps->amount_with_fee = amount_with_fee; ps->amount_without_fee = amount_without_fee; + ps->session_id = session_id; { struct TALER_TESTING_Command cmd = { .cls = ps,