summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-12-19 12:12:16 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2018-12-19 12:12:16 +0100
commit6b184e2521dd680efb604efe7c521e0b794f236d (patch)
treea580c152916cd70c7aeed294877d71953ca5a5d5
parentee7f59d5fc2a03af38558aaec86197a4b9027009 (diff)
downloadmerchant-6b184e2521dd680efb604efe7c521e0b794f236d.tar.gz
merchant-6b184e2521dd680efb604efe7c521e0b794f236d.tar.bz2
merchant-6b184e2521dd680efb604efe7c521e0b794f236d.zip
#5459
-rw-r--r--src/lib/testing_api_cmd_history.c59
-rw-r--r--src/lib/testing_api_cmd_pay.c59
-rw-r--r--src/lib/testing_api_cmd_proposal.c25
-rw-r--r--src/lib/testing_api_cmd_refund.c35
-rw-r--r--src/lib/testing_api_cmd_rewind.c11
-rw-r--r--src/lib/testing_api_cmd_tip.c87
-rw-r--r--src/lib/testing_api_cmd_track.c24
7 files changed, 161 insertions, 139 deletions
diff --git a/src/lib/testing_api_cmd_history.c b/src/lib/testing_api_cmd_history.c
index 99703ea3..2c60af7e 100644
--- a/src/lib/testing_api_cmd_history.c
+++ b/src/lib/testing_api_cmd_history.c
@@ -315,17 +315,16 @@ history_run (void *cls,
* @param nrows how many row we want to receive, at most.
*/
static struct TALER_TESTING_Command
-TALER_TESTING_cmd_history2 (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- struct GNUNET_TIME_Absolute time,
- unsigned int nresult,
- unsigned long long start,
- int use_default_start,
- long long nrows)
+cmd_history2 (const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ struct GNUNET_TIME_Absolute time,
+ unsigned int nresult,
+ unsigned long long start,
+ int use_default_start,
+ long long nrows)
{
struct HistoryState *hs;
- struct TALER_TESTING_Command cmd;
hs = GNUNET_new (struct HistoryState);
hs->http_status = http_status;
@@ -336,10 +335,12 @@ TALER_TESTING_cmd_history2 (const char *label,
hs->merchant_url = merchant_url;
hs->use_default_start = use_default_start;
- cmd.cls = hs;
- cmd.label = label;
- cmd.run = &history_run;
- cmd.cleanup = &history_cleanup;
+ struct TALER_TESTING_Command cmd = {
+ .cls = hs,
+ .label = label,
+ .run = &history_run,
+ .cleanup = &history_cleanup
+ };
return cmd;
}
@@ -366,14 +367,14 @@ TALER_TESTING_cmd_history_default_start
unsigned int nresult,
long long nrows)
{
- return TALER_TESTING_cmd_history2 (label,
- merchant_url,
- http_status,
- time,
- nresult,
- -1, /* ignored */
- GNUNET_YES,
- nrows);
+ return cmd_history2 (label,
+ merchant_url,
+ http_status,
+ time,
+ nresult,
+ -1, /* ignored */
+ GNUNET_YES,
+ nrows);
}
@@ -400,14 +401,14 @@ TALER_TESTING_cmd_history (const char *label,
unsigned long long start,
long long nrows)
{
- return TALER_TESTING_cmd_history2 (label,
- merchant_url,
- http_status,
- time,
- nresult,
- start,
- GNUNET_NO,
- nrows);
+ return cmd_history2 (label,
+ merchant_url,
+ http_status,
+ time,
+ nresult,
+ start,
+ GNUNET_NO,
+ nrows);
}
diff --git a/src/lib/testing_api_cmd_pay.c b/src/lib/testing_api_cmd_pay.c
index 9d238f72..97fac91a 100644
--- a/src/lib/testing_api_cmd_pay.c
+++ b/src/lib/testing_api_cmd_pay.c
@@ -418,7 +418,6 @@ TALER_TESTING_cmd_check_payment (const char *label,
unsigned int expect_paid)
{
struct CheckPaymentState *cps;
- struct TALER_TESTING_Command cmd;
cps = GNUNET_new (struct CheckPaymentState);
cps->http_status = http_status;
@@ -426,10 +425,12 @@ TALER_TESTING_cmd_check_payment (const char *label,
cps->expect_paid = expect_paid;
cps->merchant_url = merchant_url;
- cmd.cls = cps;
- cmd.label = label;
- cmd.run = &check_payment_run;
- cmd.cleanup = &check_payment_cleanup;
+ struct TALER_TESTING_Command cmd = {
+ .cls = cps,
+ .label = label,
+ .run = &check_payment_run,
+ .cleanup = &check_payment_cleanup
+ };
return cmd;
@@ -1023,7 +1024,6 @@ TALER_TESTING_cmd_pay (const char *label,
const char *refund_fee)
{
struct PayState *ps;
- struct TALER_TESTING_Command cmd;
ps = GNUNET_new (struct PayState);
ps->http_status = http_status;
@@ -1034,11 +1034,13 @@ TALER_TESTING_cmd_pay (const char *label,
ps->amount_without_fee = amount_without_fee;
ps->refund_fee = refund_fee;
- cmd.cls = ps;
- cmd.label = label;
- cmd.run = &pay_run;
- cmd.cleanup = &pay_cleanup;
- cmd.traits = &pay_traits;
+ struct TALER_TESTING_Command cmd = {
+ .cls = ps,
+ .label = label,
+ .run = &pay_run,
+ .cleanup = &pay_cleanup,
+ .traits = &pay_traits
+ };
return cmd;
@@ -1183,18 +1185,19 @@ TALER_TESTING_cmd_pay_abort (const char *label,
unsigned int http_status)
{
struct PayAbortState *pas;
- struct TALER_TESTING_Command cmd;
pas = GNUNET_new (struct PayAbortState);
pas->http_status = http_status;
pas->pay_reference = pay_reference;
pas->merchant_url = merchant_url;
- cmd.cls = pas;
- cmd.label = label;
- cmd.run = &pay_abort_run;
- cmd.cleanup = &pay_abort_cleanup;
- cmd.traits = &pay_abort_traits;
+ struct TALER_TESTING_Command cmd = {
+ .cls = pas,
+ .label = label,
+ .run = &pay_abort_run,
+ .cleanup = &pay_abort_cleanup,
+ .traits = &pay_abort_traits
+ };
return cmd;
}
@@ -1380,7 +1383,6 @@ TALER_TESTING_cmd_pay_again (const char *label,
{
struct PayAgainState *pas;
- struct TALER_TESTING_Command cmd;
pas = GNUNET_new (struct PayAgainState);
pas->http_status = http_status;
@@ -1389,10 +1391,12 @@ TALER_TESTING_cmd_pay_again (const char *label,
pas->merchant_url = merchant_url;
pas->refund_fee = refund_fee;
- cmd.cls = pas;
- cmd.label = label;
- cmd.run = &pay_again_run;
- cmd.cleanup = &pay_again_cleanup;
+ struct TALER_TESTING_Command cmd = {
+ .cls = pas,
+ .label = label,
+ .run = &pay_again_run,
+ .cleanup = &pay_again_cleanup
+ };
return cmd;
}
@@ -1552,7 +1556,6 @@ TALER_TESTING_cmd_pay_abort_refund
unsigned int http_status)
{
struct PayAbortRefundState *pars;
- struct TALER_TESTING_Command cmd;
pars = GNUNET_new (struct PayAbortRefundState);
pars->abort_reference = abort_reference;
@@ -1561,10 +1564,12 @@ TALER_TESTING_cmd_pay_abort_refund
pars->refund_fee = refund_fee;
pars->http_status = http_status;
- cmd.cls = pars;
- cmd.label = label;
- cmd.run = &pay_abort_refund_run;
- cmd.cleanup = &pay_abort_refund_cleanup;
+ struct TALER_TESTING_Command cmd = {
+ .cls = pars,
+ .label = label,
+ .run = &pay_abort_refund_run,
+ .cleanup = &pay_abort_refund_cleanup
+ };
return cmd;
}
diff --git a/src/lib/testing_api_cmd_proposal.c b/src/lib/testing_api_cmd_proposal.c
index ac4ae0e7..8fc52d9f 100644
--- a/src/lib/testing_api_cmd_proposal.c
+++ b/src/lib/testing_api_cmd_proposal.c
@@ -473,7 +473,6 @@ TALER_TESTING_cmd_proposal (const char *label,
const char *order,
const char *instance)
{
- struct TALER_TESTING_Command cmd;
struct ProposalState *ps;
ps = GNUNET_new (struct ProposalState);
@@ -482,11 +481,14 @@ TALER_TESTING_cmd_proposal (const char *label,
ps->merchant_url = merchant_url;
ps->instance = (NULL == instance) ? "default": instance;
- cmd.cls = ps;
- cmd.label = label;
- cmd.run = &proposal_run;
- cmd.cleanup = &proposal_cleanup;
- cmd.traits = &proposal_traits;
+ struct TALER_TESTING_Command cmd = {
+ .cls = ps,
+ .label = label,
+ .run = &proposal_run,
+ .cleanup = &proposal_cleanup,
+ .traits = &proposal_traits
+ };
+
return cmd;
}
@@ -600,7 +602,6 @@ TALER_TESTING_cmd_proposal_lookup
const char *order_id)
{
struct ProposalLookupState *pls;
- struct TALER_TESTING_Command cmd;
pls = GNUNET_new (struct ProposalLookupState);
pls->http_status = http_status;
@@ -608,10 +609,12 @@ TALER_TESTING_cmd_proposal_lookup
pls->merchant_url = merchant_url;
pls->order_id = order_id;
- cmd.cls = pls;
- cmd.label = label;
- cmd.run = &proposal_lookup_run;
- cmd.cleanup = &proposal_lookup_cleanup;
+ struct TALER_TESTING_Command cmd = {
+ .cls = pls,
+ .label = label,
+ .run = &proposal_lookup_run,
+ .cleanup = &proposal_lookup_cleanup
+ };
return cmd;
}
diff --git a/src/lib/testing_api_cmd_refund.c b/src/lib/testing_api_cmd_refund.c
index d0efaf16..c8b825a6 100644
--- a/src/lib/testing_api_cmd_refund.c
+++ b/src/lib/testing_api_cmd_refund.c
@@ -511,7 +511,6 @@ TALER_TESTING_cmd_refund_increase
unsigned int http_code)
{
struct RefundIncreaseState *ris;
- struct TALER_TESTING_Command cmd;
ris = GNUNET_new (struct RefundIncreaseState);
ris->merchant_url = merchant_url;
@@ -521,11 +520,13 @@ TALER_TESTING_cmd_refund_increase
ris->reason = reason;
ris->http_code = http_code;
- cmd.cls = ris;
- cmd.label = label;
- cmd.run = &refund_increase_run;
- cmd.cleanup = &refund_increase_cleanup;
- cmd.traits = &refund_increase_traits;
+ struct TALER_TESTING_Command cmd = {
+ .cls = ris,
+ .label = label,
+ .run = &refund_increase_run,
+ .cleanup = &refund_increase_cleanup,
+ .traits = &refund_increase_traits
+ };
return cmd;
}
@@ -557,7 +558,6 @@ TALER_TESTING_cmd_refund_lookup
unsigned int http_code)
{
struct RefundLookupState *rls;
- struct TALER_TESTING_Command cmd;
rls = GNUNET_new (struct RefundLookupState);
rls->merchant_url = merchant_url;
@@ -566,10 +566,12 @@ TALER_TESTING_cmd_refund_lookup
rls->increase_reference = increase_reference;
rls->http_code = http_code;
- cmd.cls = rls;
- cmd.label = label;
- cmd.run = &refund_lookup_run;
- cmd.cleanup = &refund_lookup_cleanup;
+ struct TALER_TESTING_Command cmd = {
+ .cls = rls,
+ .label = label,
+ .run = &refund_lookup_run,
+ .cleanup = &refund_lookup_cleanup
+ };
return cmd;
}
@@ -607,7 +609,6 @@ TALER_TESTING_cmd_refund_lookup_with_amount
const char *refund_amount)
{
struct RefundLookupState *rls;
- struct TALER_TESTING_Command cmd;
rls = GNUNET_new (struct RefundLookupState);
rls->merchant_url = merchant_url;
@@ -617,10 +618,12 @@ TALER_TESTING_cmd_refund_lookup_with_amount
rls->http_code = http_code;
rls->refund_amount = refund_amount;
- cmd.cls = rls;
- cmd.label = label;
- cmd.run = &refund_lookup_run;
- cmd.cleanup = &refund_lookup_cleanup;
+ struct TALER_TESTING_Command cmd = {
+ .cls = rls,
+ .label = label,
+ .run = &refund_lookup_run,
+ .cleanup = &refund_lookup_cleanup
+ };
return cmd;
}
diff --git a/src/lib/testing_api_cmd_rewind.c b/src/lib/testing_api_cmd_rewind.c
index c9b603b9..2b65a70e 100644
--- a/src/lib/testing_api_cmd_rewind.c
+++ b/src/lib/testing_api_cmd_rewind.c
@@ -102,16 +102,17 @@ TALER_TESTING_cmd_rewind_ip
unsigned int *counter)
{
struct RewindIpState *ris;
- struct TALER_TESTING_Command cmd;
ris = GNUNET_new (struct RewindIpState);
ris->new_ip = new_ip;
ris->counter = counter;
- cmd.cls = ris;
- cmd.label = label;
- cmd.run = &rewind_ip_run;
- cmd.cleanup = &rewind_ip_cleanup;
+ struct TALER_TESTING_Command cmd = {
+ .cls = ris,
+ .label = label,
+ .run = &rewind_ip_run,
+ .cleanup = &rewind_ip_cleanup
+ };
return cmd;
}
diff --git a/src/lib/testing_api_cmd_tip.c b/src/lib/testing_api_cmd_tip.c
index 1aff5451..44043670 100644
--- a/src/lib/testing_api_cmd_tip.c
+++ b/src/lib/testing_api_cmd_tip.c
@@ -444,7 +444,6 @@ TALER_TESTING_cmd_tip_authorize_with_ec
enum TALER_ErrorCode ec)
{
struct TipAuthorizeState *tas;
- struct TALER_TESTING_Command cmd;
tas = GNUNET_new (struct TipAuthorizeState);
tas->merchant_url = merchant_url;
@@ -455,11 +454,13 @@ TALER_TESTING_cmd_tip_authorize_with_ec
tas->http_status = http_status;
tas->expected_ec = ec;
- cmd.label = label;
- cmd.cls = tas;
- cmd.run = &tip_authorize_run;
- cmd.cleanup = &tip_authorize_cleanup;
- cmd.traits = &tip_authorize_traits;
+ struct TALER_TESTING_Command cmd = {
+ .label = label,
+ .cls = tas,
+ .run = &tip_authorize_run,
+ .cleanup = &tip_authorize_cleanup,
+ .traits = &tip_authorize_traits
+ };
return cmd;
}
@@ -491,7 +492,6 @@ TALER_TESTING_cmd_tip_authorize (const char *label,
const char *amount)
{
struct TipAuthorizeState *tas;
- struct TALER_TESTING_Command cmd;
tas = GNUNET_new (struct TipAuthorizeState);
tas->merchant_url = merchant_url;
@@ -501,11 +501,13 @@ TALER_TESTING_cmd_tip_authorize (const char *label,
tas->amount = amount;
tas->http_status = http_status;
- cmd.label = label;
- cmd.cls = tas;
- cmd.run = &tip_authorize_run;
- cmd.cleanup = &tip_authorize_cleanup;
- cmd.traits = &tip_authorize_traits;
+ struct TALER_TESTING_Command cmd = {
+ .label = label,
+ .cls = tas,
+ .run = &tip_authorize_run,
+ .cleanup = &tip_authorize_cleanup,
+ .traits = &tip_authorize_traits
+ };
return cmd;
}
@@ -664,7 +666,6 @@ TALER_TESTING_cmd_tip_query_with_amounts
const char *expected_amount_available)
{
struct TipQueryState *tqs;
- struct TALER_TESTING_Command cmd;
tqs = GNUNET_new (struct TipQueryState);
tqs->merchant_url = merchant_url;
@@ -674,10 +675,12 @@ TALER_TESTING_cmd_tip_query_with_amounts
tqs->expected_amount_authorized = expected_amount_authorized;
tqs->expected_amount_available = expected_amount_available;
- cmd.cls = tqs;
- cmd.label = label;
- cmd.run = &tip_query_run;
- cmd.cleanup = &tip_query_cleanup;
+ struct TALER_TESTING_Command cmd = {
+ .cls = tqs,
+ .label = label,
+ .run = &tip_query_run,
+ .cleanup = &tip_query_cleanup
+ };
return cmd;
}
@@ -700,17 +703,18 @@ TALER_TESTING_cmd_tip_query (const char *label,
const char *instance)
{
struct TipQueryState *tqs;
- struct TALER_TESTING_Command cmd;
tqs = GNUNET_new (struct TipQueryState);
tqs->merchant_url = merchant_url;
tqs->instance = instance;
tqs->http_status = http_status;
- cmd.cls = tqs;
- cmd.label = label;
- cmd.run = &tip_query_run;
- cmd.cleanup = &tip_query_cleanup;
+ struct TALER_TESTING_Command cmd = {
+ .cls = tqs,
+ .label = label,
+ .run = &tip_query_run,
+ .cleanup = &tip_query_cleanup
+ };
return cmd;
}
@@ -1115,7 +1119,6 @@ TALER_TESTING_cmd_tip_pickup_with_ec
enum TALER_ErrorCode ec)
{
struct TipPickupState *tps;
- struct TALER_TESTING_Command cmd;
tps = GNUNET_new (struct TipPickupState);
tps->merchant_url = merchant_url;
@@ -1124,11 +1127,13 @@ TALER_TESTING_cmd_tip_pickup_with_ec
tps->http_status = http_status;
tps->expected_ec = ec;
- cmd.cls = tps;
- cmd.label = label;
- cmd.run = &tip_pickup_run;
- cmd.cleanup = &tip_pickup_cleanup;
- cmd.traits = &tip_pickup_traits;
+ struct TALER_TESTING_Command cmd = {
+ .cls = tps,
+ .label = label,
+ .run = &tip_pickup_run,
+ .cleanup = &tip_pickup_cleanup,
+ .traits = &tip_pickup_traits
+ };
return cmd;
}
@@ -1154,7 +1159,6 @@ TALER_TESTING_cmd_tip_pickup
const char **amounts)
{
struct TipPickupState *tps;
- struct TALER_TESTING_Command cmd;
tps = GNUNET_new (struct TipPickupState);
tps->merchant_url = merchant_url;
@@ -1162,11 +1166,13 @@ TALER_TESTING_cmd_tip_pickup
tps->amounts = amounts;
tps->http_status = http_status;
- cmd.cls = tps;
- cmd.label = label;
- cmd.run = &tip_pickup_run;
- cmd.cleanup = &tip_pickup_cleanup;
- cmd.traits = &tip_pickup_traits;
+ struct TALER_TESTING_Command cmd = {
+ .cls = tps,
+ .label = label,
+ .run = &tip_pickup_run,
+ .cleanup = &tip_pickup_cleanup,
+ .traits = &tip_pickup_traits
+ };
return cmd;
}
@@ -1185,15 +1191,16 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_tip_authorize_fake (const char *label)
{
struct TipAuthorizeState *tas;
- struct TALER_TESTING_Command cmd;
tas = GNUNET_new (struct TipAuthorizeState);
- cmd.label = label;
- cmd.cls = tas;
- cmd.run = &tip_authorize_fake_run;
- cmd.cleanup = &tip_authorize_cleanup;
- cmd.traits = &tip_authorize_traits;
+ struct TALER_TESTING_Command cmd = {
+ .label = label,
+ .cls = tas,
+ .run = &tip_authorize_fake_run,
+ .cleanup = &tip_authorize_cleanup,
+ .traits = &tip_authorize_traits
+ };
return cmd;
}
diff --git a/src/lib/testing_api_cmd_track.c b/src/lib/testing_api_cmd_track.c
index e8c80ff6..210263a6 100644
--- a/src/lib/testing_api_cmd_track.c
+++ b/src/lib/testing_api_cmd_track.c
@@ -500,18 +500,19 @@ TALER_TESTING_cmd_merchant_track_transaction
const char *pay_reference)
{
struct TrackTransactionState *tts;
- struct TALER_TESTING_Command cmd;
tts = GNUNET_new (struct TrackTransactionState);
tts->merchant_url = merchant_url;
tts->http_status = http_status;
tts->pay_reference = pay_reference;
- cmd.cls = tts;
- cmd.label = label;
- cmd.run = &track_transaction_run;
- cmd.cleanup = &track_transaction_cleanup;
- cmd.traits = &track_transaction_traits;
+ struct TALER_TESTING_Command cmd = {
+ .cls = tts,
+ .label = label,
+ .run = &track_transaction_run,
+ .cleanup = &track_transaction_cleanup,
+ .traits = &track_transaction_traits
+ };
return cmd;
}
@@ -537,17 +538,18 @@ TALER_TESTING_cmd_merchant_track_transfer
const char *check_bank_reference)
{
struct TrackTransferState *tts;
- struct TALER_TESTING_Command cmd;
tts = GNUNET_new (struct TrackTransferState);
tts->merchant_url = merchant_url;
tts->http_status = http_status;
tts->check_bank_reference = check_bank_reference;
- cmd.cls = tts;
- cmd.label = label;
- cmd.run = &track_transfer_run;
- cmd.cleanup = &track_transfer_cleanup;
+ struct TALER_TESTING_Command cmd = {
+ .cls = tts,
+ .label = label,
+ .run = &track_transfer_run,
+ .cleanup = &track_transfer_cleanup
+ };
return cmd;
}