summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-12-18 14:41:37 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2018-12-18 14:41:37 +0100
commit4393961f913dd79c195070e520d83943ffd3024e (patch)
tree2a637940dd7ffb09fba755015569f80f05fb4032 /src
parentc08aea9d342b80cfa8282b201afad76e814e8f90 (diff)
downloadmerchant-4393961f913dd79c195070e520d83943ffd3024e.tar.gz
merchant-4393961f913dd79c195070e520d83943ffd3024e.tar.bz2
merchant-4393961f913dd79c195070e520d83943ffd3024e.zip
/pay: #5284
Diffstat (limited to 'src')
-rw-r--r--src/include/taler_merchant_testing_lib.h8
-rw-r--r--src/lib/test_merchant_api_new.c14
-rw-r--r--src/lib/test_merchant_api_twisted.c16
-rw-r--r--src/lib/testing_api_cmd_pay.c105
4 files changed, 32 insertions, 111 deletions
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
index 84077000..b74ebe0b 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -112,7 +112,6 @@ TALER_TESTING_cmd_proposal_lookup
*
* @param label command label.
* @param merchant_url merchant base url
- * @param ctx CURL context.
* @param http_status expected HTTP response code.
* @param proposal_reference the proposal whose payment status
* is going to be checked.
@@ -124,7 +123,6 @@ TALER_TESTING_cmd_proposal_lookup
struct TALER_TESTING_Command
TALER_TESTING_cmd_check_payment (const char *label,
const char *merchant_url,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status,
const char *proposal_reference,
unsigned int expect_paid);
@@ -133,7 +131,6 @@ TALER_TESTING_cmd_check_payment (const char *label,
*
* @param label command label.
* @param merchant_url merchant base url
- * @param ctx CURL context.
* @param http_status expected HTTP response code.
* @param proposal_reference the proposal whose payment status
* is going to be checked.
@@ -149,7 +146,6 @@ TALER_TESTING_cmd_check_payment (const char *label,
struct TALER_TESTING_Command
TALER_TESTING_cmd_pay (const char *label,
const char *merchant_url,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status,
const char *proposal_reference,
const char *coin_reference,
@@ -166,7 +162,6 @@ TALER_TESTING_cmd_pay (const char *label,
* @param merchant_url merchant base URL
* @param pay_reference reference to the payment to replay
* @param coin_reference reference to the coins to use
- * @param ctx main CURL context
* @param http_status expected HTTP response code
*
* @return the command
@@ -177,7 +172,6 @@ TALER_TESTING_cmd_pay_again (const char *label,
const char *pay_reference,
const char *coin_reference,
const char *refund_fee,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status);
/**
* Make a "pay abort" test command.
@@ -185,7 +179,6 @@ TALER_TESTING_cmd_pay_again (const char *label,
* @param label command label
* @param merchant_url merchant base URL
* @param pay_reference reference to the payment to abort
- * @param ctx main CURL context
* @param http_status expected HTTP response code
*
* @return the command
@@ -194,7 +187,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_pay_abort (const char *label,
const char *merchant_url,
const char *pay_reference,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status);
/**
diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c
index 52252311..e1a741cd 100644
--- a/src/lib/test_merchant_api_new.c
+++ b/src/lib/test_merchant_api_new.c
@@ -221,13 +221,11 @@ run (void *cls,
TALER_TESTING_cmd_check_payment ("check-payment-1",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-1",
GNUNET_NO),
TALER_TESTING_cmd_pay ("deposit-simple",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-1",
"withdraw-coin-1",
@@ -237,7 +235,6 @@ run (void *cls,
TALER_TESTING_cmd_check_payment ("check-payment-2",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-1",
GNUNET_YES),
@@ -245,12 +242,10 @@ run (void *cls,
TALER_TESTING_cmd_pay_abort ("pay-abort-2",
merchant_url,
"deposit-simple",
- is->ctx,
MHD_HTTP_FORBIDDEN),
TALER_TESTING_cmd_pay ("replay-simple",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-1",
"withdraw-coin-1",
@@ -309,7 +304,6 @@ run (void *cls,
TALER_TESTING_cmd_pay ("deposit-double-2",
merchant_url,
- is->ctx,
MHD_HTTP_FORBIDDEN,
"create-proposal-2",
"withdraw-coin-1",
@@ -405,7 +399,6 @@ run (void *cls,
TALER_TESTING_cmd_pay ("deposit-simple-2",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-2",
"withdraw-coin-2",
@@ -586,7 +579,6 @@ run (void *cls,
TALER_TESTING_cmd_pay ("pay-unincreased-proposal",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-unincreased-refund",
"withdraw-coin-unincreased-refund",
@@ -829,7 +821,6 @@ run (void *cls,
TALER_TESTING_cmd_pay ("deposit-tip-simple",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-tip-1",
"pickup-tip-1",
@@ -910,7 +901,6 @@ run (void *cls,
TALER_TESTING_cmd_pay ("pay-fail-partial-double-10",
merchant_url,
- is->ctx,
MHD_HTTP_FORBIDDEN,
"create-proposal-10",
"withdraw-coin-10a;withdraw-coin-1",
@@ -924,7 +914,6 @@ run (void *cls,
"pay-fail-partial-double-10",
"withdraw-coin-10a;withdraw-coin-10b",
"EUR:0.01",
- is->ctx,
MHD_HTTP_OK),
CMD_EXEC_AGGREGATOR ("run-aggregator-10"),
@@ -996,7 +985,6 @@ run (void *cls,
TALER_TESTING_cmd_pay ("pay-fail-partial-double-11-good",
merchant_url,
- is->ctx,
MHD_HTTP_NOT_ACCEPTABLE,
"create-proposal-11",
"withdraw-coin-11a",
@@ -1005,7 +993,6 @@ run (void *cls,
"EUR:0.01"),
TALER_TESTING_cmd_pay ("pay-fail-partial-double-11-bad",
merchant_url,
- is->ctx,
MHD_HTTP_FORBIDDEN,
"create-proposal-11",
"withdraw-coin-1",
@@ -1016,7 +1003,6 @@ run (void *cls,
TALER_TESTING_cmd_pay_abort ("pay-abort-11",
merchant_url,
"pay-fail-partial-double-11-good",
- is->ctx,
MHD_HTTP_OK),
TALER_TESTING_cmd_pay_abort_refund ("pay-abort-refund-11",
diff --git a/src/lib/test_merchant_api_twisted.c b/src/lib/test_merchant_api_twisted.c
index bb7b366e..48be4eef 100644
--- a/src/lib/test_merchant_api_twisted.c
+++ b/src/lib/test_merchant_api_twisted.c
@@ -224,7 +224,6 @@ run (void *cls,
TALER_TESTING_cmd_check_payment
("check-payment-fail",
twister_merchant_url,
- is->ctx,
MHD_HTTP_MULTIPLE_CHOICES,
"proposal-for-check-payment",
GNUNET_SYSERR), // any response != 200 gives "syserr"
@@ -235,7 +234,6 @@ run (void *cls,
TALER_TESTING_cmd_check_payment
("check-payment-fail-invalid",
twister_merchant_url,
- is->ctx,
0,
"proposal-for-check-payment",
GNUNET_SYSERR),
@@ -249,7 +247,6 @@ run (void *cls,
TALER_TESTING_cmd_check_payment
("check-payment-fail-invalid-0",
twister_merchant_url,
- is->ctx,
0,
"proposal-for-check-payment",
GNUNET_SYSERR),
@@ -536,7 +533,6 @@ run (void *cls,
TALER_TESTING_cmd_pay
("pay-unaggregation",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-unaggregation",
"withdraw-coin-unaggregation",
@@ -600,7 +596,6 @@ run (void *cls,
NULL),
TALER_TESTING_cmd_pay ("deposit-simple-5383",
twister_merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-5383",
"withdraw-coin-5383a;" \
@@ -699,14 +694,12 @@ run (void *cls,
TALER_TESTING_cmd_check_payment ("check-payment-1",
twister_merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-6",
GNUNET_NO),
TALER_TESTING_cmd_pay ("deposit-simple",
twister_merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-6",
"withdraw-coin-1;" \
@@ -717,7 +710,6 @@ run (void *cls,
TALER_TESTING_cmd_check_payment ("check-payment-2",
twister_merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-6",
GNUNET_YES),
@@ -826,7 +818,6 @@ run (void *cls,
* so we'll then have the right to abort. */
TALER_TESTING_cmd_pay ("deposit-simple-for-abort",
twister_merchant_url,
- is->ctx,
MHD_HTTP_NOT_ACCEPTABLE,
"create-proposal-abort-1",
"withdraw-coin-abort-1",
@@ -841,7 +832,6 @@ run (void *cls,
TALER_TESTING_cmd_pay_abort ("pay-abort-1",
twister_merchant_url,
"deposit-simple-for-abort",
- is->ctx,
0),
TALER_TESTING_cmd_delete_object
@@ -852,7 +842,6 @@ run (void *cls,
TALER_TESTING_cmd_pay_abort ("pay-abort-2",
twister_merchant_url,
"deposit-simple-for-abort",
- is->ctx,
0),
TALER_TESTING_cmd_modify_object_dl
@@ -865,7 +854,6 @@ run (void *cls,
TALER_TESTING_cmd_pay_abort ("pay-abort-3",
twister_merchant_url,
"deposit-simple-for-abort",
- is->ctx,
0),
TALER_TESTING_cmd_flip_download
@@ -876,7 +864,6 @@ run (void *cls,
TALER_TESTING_cmd_pay_abort ("pay-abort-4",
twister_merchant_url,
"deposit-simple-for-abort",
- is->ctx,
0),
/* just malforming the response. */
TALER_TESTING_cmd_malform_response
@@ -886,7 +873,6 @@ run (void *cls,
TALER_TESTING_cmd_pay_abort ("pay-abort-5",
twister_merchant_url,
"deposit-simple-for-abort",
- is->ctx,
0),
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-double-spend",
@@ -945,7 +931,6 @@ run (void *cls,
TALER_TESTING_cmd_pay ("deposit-simple-ok",
twister_merchant_url,
- is->ctx,
MHD_HTTP_OK,
"create-proposal-double-spend",
"withdraw-coin-double-spend",
@@ -962,7 +947,6 @@ run (void *cls,
* due to coin's bad signature. */
TALER_TESTING_cmd_pay ("deposit-simple-fail",
twister_merchant_url,
- is->ctx,
0,
"create-proposal-double-spend-1",
"withdraw-coin-double-spend",
diff --git a/src/lib/testing_api_cmd_pay.c b/src/lib/testing_api_cmd_pay.c
index 80f9d08e..d28143cc 100644
--- a/src/lib/testing_api_cmd_pay.c
+++ b/src/lib/testing_api_cmd_pay.c
@@ -67,11 +67,6 @@ struct PayState
const char *coin_reference;
/**
- * The curl context.
- */
- struct GNUNET_CURL_Context *ctx;
-
- /**
* The merchant base URL.
*/
const char *merchant_url;
@@ -132,15 +127,9 @@ struct CheckPaymentState
unsigned int expect_paid;
/**
- * The curl context.
- */
- struct GNUNET_CURL_Context *ctx;
-
- /**
* The merchant base URL.
*/
const char *merchant_url;
-
};
@@ -166,11 +155,6 @@ struct PayAgainState
const char *coin_reference;
/**
- * Main CURL context.
- */
- struct GNUNET_CURL_Context *ctx;
-
- /**
* Merchant URL.
*/
const char *merchant_url;
@@ -209,11 +193,6 @@ struct PayAbortState
const char *pay_reference;
/**
- * Main CURL context.
- */
- struct GNUNET_CURL_Context *ctx;
-
- /**
* Merchant URL.
*/
const char *merchant_url;
@@ -411,7 +390,7 @@ check_payment_run (void *cls,
order_id);
cps->cpo = TALER_MERCHANT_check_payment
- (cps->ctx,
+ (is->ctx,
cps->merchant_url,
"default", // only default instance for now.
order_id,
@@ -429,7 +408,6 @@ check_payment_run (void *cls,
*
* @param label command label.
* @param merchant_url merchant base url
- * @param ctx CURL context.
* @param http_status expected HTTP response code.
* @param proposal_reference the proposal whose payment status
* is going to be checked.
@@ -441,7 +419,6 @@ check_payment_run (void *cls,
struct TALER_TESTING_Command
TALER_TESTING_cmd_check_payment (const char *label,
const char *merchant_url,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status,
const char *proposal_reference,
unsigned int expect_paid)
@@ -453,7 +430,6 @@ TALER_TESTING_cmd_check_payment (const char *label,
cps->http_status = http_status;
cps->proposal_reference = proposal_reference;
cps->expect_paid = expect_paid;
- cps->ctx = ctx;
cps->merchant_url = merchant_url;
cmd.cls = cps;
@@ -737,7 +713,6 @@ pay_abort_cb (void *cls,
*
* @param merchant_url base URL of the merchant serving the
* request.
- * @param ctx CURL context.
* @param coin_reference reference to the CMD(s) that offer
* "coins" traits. It is possible to give multiple
* references by using semicolons to separate them.
@@ -757,7 +732,6 @@ pay_abort_cb (void *cls,
*/
static struct TALER_MERCHANT_Pay *
_pay_run (const char *merchant_url,
- struct GNUNET_CURL_Context *ctx,
const char *coin_reference,
const char *proposal_reference,
struct TALER_TESTING_Interpreter *is,
@@ -879,7 +853,7 @@ _pay_run (const char *merchant_url,
return NULL;
}
- ret = api_func (ctx,
+ ret = api_func (is->ctx,
merchant_url,
"default", // instance
h_proposal,
@@ -919,18 +893,16 @@ pay_run (void *cls,
struct PayState *ps = cls;
ps->is = is;
- if ( NULL ==
- ( ps->po = _pay_run (ps->merchant_url,
- ps->ctx,
- ps->coin_reference,
- ps->proposal_reference,
- is,
- ps->amount_with_fee,
- ps->amount_without_fee,
- ps->refund_fee,
- &TALER_MERCHANT_pay_wallet,
- &pay_cb,
- ps)) )
+ if (NULL == (ps->po = _pay_run (ps->merchant_url,
+ ps->coin_reference,
+ ps->proposal_reference,
+ is,
+ ps->amount_with_fee,
+ ps->amount_without_fee,
+ ps->refund_fee,
+ &TALER_MERCHANT_pay_wallet,
+ &pay_cb,
+ ps)))
TALER_TESTING_FAIL (is);
}
@@ -1034,7 +1006,6 @@ pay_traits (void *cls,
*
* @param label command label.
* @param merchant_url merchant base url
- * @param ctx CURL context.
* @param http_status expected HTTP response code.
* @param proposal_reference the proposal whose payment status
* is going to be checked.
@@ -1050,7 +1021,6 @@ pay_traits (void *cls,
struct TALER_TESTING_Command
TALER_TESTING_cmd_pay (const char *label,
const char *merchant_url,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status,
const char *proposal_reference,
const char *coin_reference,
@@ -1065,7 +1035,6 @@ TALER_TESTING_cmd_pay (const char *label,
ps->http_status = http_status;
ps->proposal_reference = proposal_reference;
ps->coin_reference = coin_reference;
- ps->ctx = ctx;
ps->merchant_url = merchant_url;
ps->amount_with_fee = amount_with_fee;
ps->amount_without_fee = amount_without_fee;
@@ -1154,18 +1123,16 @@ pay_abort_run (void *cls,
(pay_cmd, REFUND_FEE, &refund_fee))
TALER_TESTING_FAIL (is);
- if ( NULL ==
- ( pas->pao = _pay_run (pas->merchant_url,
- pas->ctx,
- coin_reference,
- proposal_reference,
- is,
- amount_with_fee,
- amount_without_fee,
- refund_fee,
- &TALER_MERCHANT_pay_abort,
- &pay_abort_cb,
- pas)) )
+ if (NULL == (pas->pao = _pay_run (pas->merchant_url,
+ coin_reference,
+ proposal_reference,
+ is,
+ amount_with_fee,
+ amount_without_fee,
+ refund_fee,
+ &TALER_MERCHANT_pay_abort,
+ &pay_abort_cb,
+ pas)))
TALER_TESTING_FAIL (is);
}
@@ -1211,7 +1178,6 @@ pay_abort_traits (void *cls,
* @param label command label
* @param merchant_url merchant base URL
* @param pay_reference reference to the payment to abort
- * @param ctx main CURL context
* @param http_status expected HTTP response code
*
* @return the command
@@ -1220,7 +1186,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_pay_abort (const char *label,
const char *merchant_url,
const char *pay_reference,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status)
{
struct PayAbortState *pas;
@@ -1229,7 +1194,6 @@ TALER_TESTING_cmd_pay_abort (const char *label,
pas = GNUNET_new (struct PayAbortState);
pas->http_status = http_status;
pas->pay_reference = pay_reference;
- pas->ctx = ctx;
pas->merchant_url = merchant_url;
cmd.cls = pas;
@@ -1361,18 +1325,16 @@ pay_again_run (void *cls,
(pay_cmd, AMOUNT_WITHOUT_FEE, &amount_without_fee))
TALER_TESTING_FAIL (is);
- if ( NULL ==
- ( pas->pao = _pay_run (pas->merchant_url,
- pas->ctx,
- pas->coin_reference,
- proposal_reference,
- is,
- amount_with_fee,
- amount_without_fee,
- pas->refund_fee,
- &TALER_MERCHANT_pay_wallet,
- &pay_again_cb,
- pas)) )
+ if (NULL == (pas->pao = _pay_run (pas->merchant_url,
+ pas->coin_reference,
+ proposal_reference,
+ is,
+ amount_with_fee,
+ amount_without_fee,
+ pas->refund_fee,
+ &TALER_MERCHANT_pay_wallet,
+ &pay_again_cb,
+ pas)))
TALER_TESTING_FAIL (is);
}
@@ -1410,7 +1372,6 @@ pay_again_cleanup (void *cls,
* @param merchant_url merchant base URL
* @param pay_reference reference to the payment to replay
* @param coin_reference reference to the coins to use
- * @param ctx main CURL context
* @param http_status expected HTTP response code
*
* @return the command
@@ -1421,7 +1382,6 @@ TALER_TESTING_cmd_pay_again (const char *label,
const char *pay_reference,
const char *coin_reference,
const char *refund_fee,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status)
{
@@ -1432,7 +1392,6 @@ TALER_TESTING_cmd_pay_again (const char *label,
pas->http_status = http_status;
pas->pay_reference = pay_reference;
pas->coin_reference = coin_reference;
- pas->ctx = ctx;
pas->merchant_url = merchant_url;
pas->refund_fee = refund_fee;