aboutsummaryrefslogtreecommitdiff
path: root/src/testing/test_merchant_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/test_merchant_api.c')
-rw-r--r--src/testing/test_merchant_api.c125
1 files changed, 57 insertions, 68 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 32674332..a93ee179 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -120,15 +120,6 @@ static char *merchant_url_i1a;
*/
#define MERCHANT_ACCOUNT_NAME "3"
-/**
- * Payto URIs to use for testing accounts on the merchant.
- */
-static const char *payto_uris[] = {
- PAYTO_I1,
- "payto://iban/CH9300762011623852957?receiver-name=Test"
- /* Just for testing account inactivation. */
-};
-
static const char *order_1_transfers[] = {
"post-transfer-1",
NULL
@@ -223,8 +214,13 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_instances ("instance-create-default",
merchant_url,
"default",
- PAYTO_I1,
MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_post_account (
+ "instance-create-default-account",
+ merchant_url,
+ PAYTO_I1,
+ NULL, NULL,
+ MHD_HTTP_OK),
TALER_TESTING_cmd_merchant_kyc_get ("instance-create-kyc-0",
merchant_url,
NULL,
@@ -939,8 +935,13 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_instances ("instance-create-i1a",
merchant_url,
"i1a",
- PAYTO_I1,
MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_post_account (
+ "instance-create-i1a-account",
+ merchant_url_i1a,
+ PAYTO_I1,
+ NULL, NULL,
+ MHD_HTTP_OK),
TALER_TESTING_cmd_merchant_get_product ("get-nx-product-i1a-1",
merchant_url_i1a,
"nx-product",
@@ -1413,7 +1414,6 @@ run (void *cls,
"template-2",
"another template",
NULL,
- TALER_MCA_NONE,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("minimum_age", 0),
GNUNET_JSON_pack_time_rel ("pay_duration",
@@ -1429,13 +1429,21 @@ run (void *cls,
"template-nx",
MHD_HTTP_NOT_FOUND,
NULL),
+ TALER_TESTING_cmd_merchant_post_otp_devices (
+ "post-otp-device",
+ merchant_url,
+ "otp-dev",
+ "my OTP device",
+ "otp-key",
+ TALER_MCA_WITH_PRICE,
+ 0,
+ MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_patch_template (
"patch-templates-t3-nx",
merchant_url,
"template-3",
"updated template",
- NULL,
- TALER_MCA_WITH_PRICE,
+ "otp-dev",
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("minimum_age", 0),
GNUNET_JSON_pack_time_rel ("pay_duration",
@@ -1446,8 +1454,7 @@ run (void *cls,
merchant_url,
"template-amount",
"a different template with an amount",
- NULL, /* pos_key */
- TALER_MCA_NONE,
+ NULL,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("minimum_age", 0),
GNUNET_JSON_pack_time_rel ("pay_duration",
@@ -1458,6 +1465,7 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_using_templates (
"using-templates-t1",
"post-templates-t1",
+ NULL,
merchant_url,
"1",
"summary-1",
@@ -1468,6 +1476,7 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_using_templates (
"using-templates-t1-amount-missing",
"post-templates-t1",
+ NULL,
merchant_url,
"2",
"summary-1",
@@ -1478,6 +1487,7 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_using_templates (
"using-templates-t1-summary-missing",
"post-templates-t1",
+ NULL,
merchant_url,
"3",
NULL,
@@ -1488,6 +1498,7 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_using_templates (
"using-templates-t1-amount-conflict",
"post-templates-t3-amount",
+ NULL,
merchant_url,
"4",
"summary-1",
@@ -1498,6 +1509,7 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_using_templates (
"using-templates-t1-amount-duplicate",
"post-templates-t3-amount",
+ NULL,
merchant_url,
"4",
"summary-1",
@@ -1524,6 +1536,7 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_using_templates (
"post-templates-t1-deleted",
"post-templates-t1",
+ NULL,
merchant_url,
"0",
"summary-1",
@@ -1531,13 +1544,21 @@ run (void *cls,
GNUNET_TIME_UNIT_ZERO_TS,
GNUNET_TIME_UNIT_FOREVER_TS,
MHD_HTTP_NOT_FOUND),
+ TALER_TESTING_cmd_merchant_post_otp_devices (
+ "post-otp-device",
+ merchant_url,
+ "otp-dev-2",
+ "my OTP device",
+ "secret",
+ TALER_MCA_WITH_PRICE,
+ 0,
+ MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_post_templates2 (
"post-templates-with-pos-key",
merchant_url,
"template-key",
"a different template with POS KEY",
- "secret", /* pos_key */
- TALER_MCA_WITH_PRICE,
+ "otp-dev-2",
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("minimum_age", 0),
GNUNET_JSON_pack_time_rel ("pay_duration",
@@ -1547,6 +1568,7 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_using_templates (
"using-templates-pos-key",
"post-templates-with-pos-key",
+ "post-otp-device",
merchant_url,
"1",
"summary-1-pos",
@@ -1669,12 +1691,16 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_instances ("instance-create-default-setup",
merchant_url,
"default",
- PAYTO_I1,
MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_post_account (
+ "instance-create-default-account",
+ merchant_url,
+ PAYTO_I1,
+ NULL, NULL,
+ MHD_HTTP_OK),
TALER_TESTING_cmd_merchant_post_instances ("instance-create-i1",
merchant_url,
"i1",
- PAYTO_I1,
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_get_instances ("instances-get-i1",
merchant_url,
@@ -1690,8 +1716,6 @@ run (void *cls,
TALER_TESTING_cmd_merchant_patch_instance ("instance-patch-i1",
merchant_url,
"i1",
- 2,
- payto_uris,
"bob-the-merchant",
json_pack ("{s:s}",
"street",
@@ -1703,41 +1727,11 @@ run (void *cls,
GNUNET_TIME_UNIT_MINUTES,
GNUNET_TIME_UNIT_MINUTES,
MHD_HTTP_NO_CONTENT),
- TALER_TESTING_cmd_merchant_get_instance2 ("instances-get-i1-2",
- merchant_url,
- "i1",
- MHD_HTTP_OK,
- "instance-patch-i1",
- payto_uris,
- 2,
- NULL,
- 0),
- TALER_TESTING_cmd_merchant_patch_instance (
- "instance-patch-i1-inactivate-account",
- merchant_url,
- "i1",
- 1,
- payto_uris,
- "bob-the-merchant",
- json_pack ("{s:s}",
- "street",
- "bobstreet"),
- json_pack ("{s:s}",
- "street",
- "bobjuryst"),
- true,
- GNUNET_TIME_UNIT_MINUTES,
- GNUNET_TIME_UNIT_MINUTES,
- MHD_HTTP_NO_CONTENT),
- TALER_TESTING_cmd_merchant_get_instance2 ("instances-get-i1-3",
- merchant_url,
- "i1",
- MHD_HTTP_OK,
- "instance-patch-i1-inactivate-account",
- payto_uris,
- 1,
- &payto_uris[1],
- 1),
+ TALER_TESTING_cmd_merchant_get_instance ("instances-get-i1-2",
+ merchant_url,
+ "i1",
+ MHD_HTTP_OK,
+ "instance-patch-i1"),
TALER_TESTING_cmd_merchant_get_instance ("instances-get-i2-nx",
merchant_url,
"i2",
@@ -1746,7 +1740,6 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_instances2 ("instance-create-ACL",
merchant_url,
"i-acl",
- 0, NULL,
"controlled instance",
json_pack ("{s:s}", "city",
"shopcity"),
@@ -1763,8 +1756,6 @@ run (void *cls,
TALER_TESTING_cmd_merchant_patch_instance ("instance-patch-ACL",
merchant_url,
"i-acl",
- 1,
- payto_uris,
"controlled instance",
json_pack ("{s:s}",
"street",
@@ -1779,18 +1770,11 @@ run (void *cls,
TALER_TESTING_cmd_merchant_post_instances ("instance-create-i2",
merchant_url,
"i2",
- PAYTO_I1,
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_post_instances ("instance-create-i2-idem",
merchant_url,
"i2",
- PAYTO_I1,
MHD_HTTP_NO_CONTENT),
- TALER_TESTING_cmd_merchant_post_instances ("instance-create-i2-non-idem",
- merchant_url,
- "i2",
- "payto://other-method/?receiver-name=X",
- MHD_HTTP_CONFLICT),
TALER_TESTING_cmd_merchant_delete_instance ("instance-delete-i2",
merchant_url,
"i2",
@@ -1824,8 +1808,13 @@ run (void *cls,
"instance-create-default-after-purge",
merchant_url,
"default",
- PAYTO_I1,
MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_post_account (
+ "instance-create-default-account-after-purge",
+ merchant_url,
+ PAYTO_I1,
+ NULL, NULL,
+ MHD_HTTP_OK),
TALER_TESTING_cmd_merchant_get_products ("get-products-empty",
merchant_url,
MHD_HTTP_OK,