merchant

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

commit e4f8b932c992139d2e51f2f192bbb66b399772ec
parent e76fe059808293206f43b293bf2dc2cdde1a6df2
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Wed,  6 Jun 2018 22:06:59 +0200

Implement 2-coined payment.

The payment generator has to generate a payment
where two coins are used; this way it's possible
to trigger "failed dependecy" HTTP errors when
testing the back-office site.

Diffstat:
Msrc/merchant-tools/taler-merchant-generate-payments_new.c | 63++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 58 insertions(+), 5 deletions(-)

diff --git a/src/merchant-tools/taler-merchant-generate-payments_new.c b/src/merchant-tools/taler-merchant-generate-payments_new.c @@ -126,7 +126,7 @@ run (void *cls, CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1", - "USD:15.03"), + "USD:25.05"), TALER_TESTING_cmd_exec_wirewatch ("wirewatch-1", @@ -134,7 +134,7 @@ run (void *cls, TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1", - is->exchange, + is->exchange, // picks port from config's [exchange]. "create-reserve-1", "USD:5", MHD_HTTP_OK), @@ -155,6 +155,23 @@ run (void *cls, "USD:5", MHD_HTTP_OK), + /* coin 4 & 5 will be deposited for the same + * contract; needed in case some testing utility + * wants to trigger a "failed dependency" error. */ + TALER_TESTING_cmd_withdraw_amount + ("withdraw-coin-4", + is->exchange, + "create-reserve-1", + "USD:5", + MHD_HTTP_OK), + + TALER_TESTING_cmd_withdraw_amount + ("withdraw-coin-5", + is->exchange, + "create-reserve-1", + "USD:5", + MHD_HTTP_OK), + TALER_TESTING_cmd_proposal ("create-proposal-1", merchant_url, @@ -187,6 +204,42 @@ run (void *cls, "USD:4.99", "USD:0.01"), + /* Doing the 2-coins payment; needed to generate the + * "failed dependency" response error, at /track/transaction. + * NOTE: not used here, but done just in case a testing + * program would need it. */ + TALER_TESTING_cmd_proposal + ("create-proposal-4&5", + merchant_url, + is->ctx, + MHD_HTTP_OK, + "{\"max_fee\":\ + {\"currency\":\"USD\",\ + \"value\":0,\ + \"fraction\":50000000},\ + \"refund_deadline\":\"\\/Date(0)\\/\",\ + \"pay_deadline\":\"\\/Date(99999999999)\\/\",\ + \"amount\":\ + {\"currency\":\"USD\",\ + \"value\":10,\ + \"fraction\":0},\ + \"summary\": \"2-coins payment\",\ + \"fulfillment_url\": \"https://example.com/\",\ + \"products\": [ {\"description\":\"2-coins payment\",\ + \"value\":\"{USD:10}\"} ] }", + NULL), + + TALER_TESTING_cmd_pay ("deposit-4&5", + merchant_url, + is->ctx, + MHD_HTTP_OK, + "create-proposal-4&5", + "withdraw-coin-4;" \ + "withdraw-coin-5", + "EUR:10", + "EUR:9.98", // no sense now + "EUR:0.02"), // no sense now + TALER_TESTING_cmd_rewind_ip ("rewind-payments", FIRST_INSTRUCTION, @@ -419,7 +472,7 @@ main (int argc, } if (NULL == (merchantd = TALER_TESTING_run_merchant - (default_config_file, merchant_url))) + (cfg_filename, merchant_url))) { TALER_LOG_ERROR ("Failed to launch the merchant\n"); terminate_process (merchantd); @@ -433,7 +486,7 @@ main (int argc, } if ( NULL == (bankd = TALER_TESTING_run_bank - (default_config_file, + (cfg_filename, bank_url))) { TALER_LOG_ERROR ("Failed to run the bank\n"); @@ -445,7 +498,7 @@ main (int argc, result = TALER_TESTING_setup_with_exchange (run, NULL, - default_config_file); + cfg_filename); terminate_process (merchantd); terminate_process (bankd);