summaryrefslogtreecommitdiff
path: root/src/include/taler_merchant_testing_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/taler_merchant_testing_lib.h')
-rw-r--r--src/include/taler_merchant_testing_lib.h1057
1 files changed, 524 insertions, 533 deletions
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
index c805afba..47d081fc 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2018-2022 Taler Systems SA
+ (C) 2018-2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -27,6 +27,7 @@
#ifndef TALER_MERCHANT_TESTING_LIB_H
#define TALER_MERCHANT_TESTING_LIB_H
+#include <gnunet/gnunet_time_lib.h>
#include <taler/taler_testing_lib.h>
#include "taler_merchant_service.h"
@@ -36,33 +37,17 @@
#define MERCHANT_FAIL() \
do {GNUNET_break (0); return NULL; } while (0)
+
/**
- * Prepare the merchant execution. Create tables and check if
- * the port is available.
+ * Extract hostname (and port) from merchant base URL.
*
- * @param config_filename configuration filename.
- * @return the base url, or NULL upon errors. Must be freed
- * by the caller.
+ * @param merchant_url full merchant URL (e.g. "http://host:8080/foo/bar/")
+ * @return just the hostname and port ("hostname:8080")
*/
char *
-TALER_TESTING_prepare_merchant (const char *config_filename);
+TALER_MERCHANT_TESTING_extract_host (const char *merchant_url);
-/**
- * Start the merchant backend process. Assume the port
- * is available and the database is clean. Use the "prepare
- * merchant" function to do such tasks.
- *
- * @param config_filename configuration filename.
- * @param merchant_url merchant base URL, used to check
- * if the merchant was started right.
- * @return the process, or NULL if the process could not
- * be started.
- */
-struct GNUNET_OS_Process *
-TALER_TESTING_run_merchant (const char *config_filename,
- const char *merchant_url);
-
/* ************** Specific interpreter commands ************ */
@@ -107,8 +92,6 @@ TALER_TESTING_cmd_merchant_get_instances (const char *label,
* @param merchant_url base URL of the merchant serving the
* POST /instances request.
* @param instance_id the ID of the instance to create
- * @param payto_uri payment URI to use
- * @param currency currency to use for default fees
* @param http_status expected HTTP response code.
* @return the command.
*/
@@ -116,8 +99,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_instances (const char *label,
const char *merchant_url,
const char *instance_id,
- const char *payto_uri,
- const char *currency,
unsigned int http_status);
@@ -147,14 +128,10 @@ TALER_TESTING_cmd_merchant_post_instance_auth (const char *label,
* @param merchant_url base URL of the merchant serving the
* POST /instances request.
* @param instance_id the ID of the instance to query
- * @param accounts_length length of the @a accounts array
- * @param payto_uris URIs of the bank accounts of the merchant instance
* @param name name of the merchant instance
* @param address physical address of the merchant instance
* @param jurisdiction jurisdiction of the merchant instance
- * @param default_max_wire_fee default maximum wire fee merchant is willing to fully pay
- * @param default_wire_fee_amortization default amortization factor for excess wire fees
- * @param default_max_deposit_fee default maximum deposit fee merchant is willing to pay
+ * @param use_stefan enable STEFAN curve
* @param default_wire_transfer_delay default wire transfer delay merchant will ask for
* @param default_pay_delay default validity period for offers merchant makes
* @param auth_token authorization token needed to access the instance, can be NULL
@@ -166,14 +143,10 @@ TALER_TESTING_cmd_merchant_post_instances2 (
const char *label,
const char *merchant_url,
const char *instance_id,
- unsigned int accounts_length,
- const char *payto_uris[],
const char *name,
json_t *address,
json_t *jurisdiction,
- const char *default_max_wire_fee,
- uint32_t default_wire_fee_amortization,
- const char *default_max_deposit_fee,
+ bool use_stefan,
struct GNUNET_TIME_Relative default_wire_transfer_delay,
struct GNUNET_TIME_Relative default_pay_delay,
const char *auth_token,
@@ -181,20 +154,75 @@ TALER_TESTING_cmd_merchant_post_instances2 (
/**
+ * Define a "POST /account" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ * POST /instances request.
+ * @param payto_uri URIs of the bank account to add to the merchant instance
+ * @param credit_facade_url credit facade URL to configure, can be NULL
+ * @param credit_facade_credentials credit facade credentials to use, can be NULL
+ * @param http_status expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_post_account (
+ const char *label,
+ const char *merchant_url,
+ const char *payto_uri,
+ const char *credit_facade_url,
+ const json_t *credit_facade_credentials,
+ unsigned int http_status);
+
+
+/**
+ * Define a "PATCH /account" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ * POST /instances request.
+ * @param create_account_ref reference to account setup command
+ * @param credit_facade_url credit facade URL to configure, can be NULL
+ * @param credit_facade_credentials credit facade credentials to use, can be NULL
+ * @param http_status expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_patch_account (
+ const char *label,
+ const char *merchant_url,
+ const char *create_account_ref,
+ const char *credit_facade_url,
+ const json_t *credit_facade_credentials,
+ unsigned int http_status);
+
+
+/**
+ * Define a "DELETE /account" CMD.
+ *
+ * @param label command label.
+ * @param create_account_ref reference to account setup command
+ * @param http_status expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_delete_account (
+ const char *label,
+ const char *create_account_ref,
+ unsigned int http_status);
+
+
+/**
* Define a "PATCH /instances/$ID" CMD.
*
* @param label command label.
* @param merchant_url base URL of the merchant serving the
* PATCH /instance request.
* @param instance_id the ID of the instance to query
- * @param payto_uris_length length of the @a accounts array
- * @param payto_uris URIs of the bank accounts of the merchant instance
* @param name name of the merchant instance
* @param address physical address of the merchant instance
* @param jurisdiction jurisdiction of the merchant instance
- * @param default_max_wire_fee default maximum wire fee merchant is willing to fully pay
- * @param default_wire_fee_amortization default amortization factor for excess wire fees
- * @param default_max_deposit_fee default maximum deposit fee merchant is willing to pay
+ * @param use_stefan use STEFAN curve
* @param default_wire_transfer_delay default wire transfer delay merchant will ask for
* @param default_pay_delay default validity period for offers merchant makes
* @param http_status expected HTTP response code.
@@ -205,14 +233,10 @@ TALER_TESTING_cmd_merchant_patch_instance (
const char *label,
const char *merchant_url,
const char *instance_id,
- unsigned int payto_uris_length,
- const char *payto_uris[],
const char *name,
json_t *address,
json_t *jurisdiction,
- const char *default_max_wire_fee,
- uint32_t default_wire_fee_amortization,
- const char *default_max_deposit_fee,
+ bool use_stefan,
struct GNUNET_TIME_Relative default_wire_transfer_delay,
struct GNUNET_TIME_Relative default_pay_delay,
unsigned int http_status);
@@ -239,35 +263,6 @@ TALER_TESTING_cmd_merchant_get_instance (const char *label,
/**
- * Define a "GET instance" CMD that compares accounts returned.
- *
- * @param label command label.
- * @param merchant_url base URL of the merchant serving the
- * GET /instances/$ID request.
- * @param instance_id the ID of the instance to query
- * @param http_status expected HTTP response code.
- * @param instance_reference reference to a "POST /instances" or "PATCH /instances/$ID" CMD
- * that will provide what we expect the backend to return to us
- * @param active_accounts the accounts the merchant is actively using.
- * @param active_accounts_length length of @e active_accounts.
- * @param inactive_accounts the accounts the merchant is no longer using.
- * @param inactive_accounts_length length of @e inactive_accounts.
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_instance2 (const char *label,
- const char *merchant_url,
- const char *instance_id,
- unsigned int http_status,
- const char *instance_reference,
- const char *active_accounts[],
- unsigned int active_accounts_length,
- const char *inactive_accounts[],
- unsigned int
- inactive_accounts_length);
-
-
-/**
* Define a "PURGE instance" CMD.
*
* @param label command label.
@@ -321,9 +316,10 @@ TALER_TESTING_cmd_merchant_delete_instance (const char *label,
* @param image base64-encoded product image
* @param taxes list of taxes paid by the merchant
* @param total_stock in @a units, -1 to indicate "infinite" (i.e. electronic books)
+ * @param minimum_age minimum age required for buying this product
* @param address where the product is in stock
* @param next_restock when the next restocking is expected to happen, 0 for unknown,
- * #GNUNET_TIME_UNIT_FOREVER_ABS for 'never'.
+ * #GNUNET_TIME_UNIT_FOREVER_TS for 'never'.
* @param http_status expected HTTP response code.
* @return the command.
*/
@@ -339,6 +335,7 @@ TALER_TESTING_cmd_merchant_post_products2 (
const char *image,
json_t *taxes,
int64_t total_stock,
+ uint32_t minimum_age,
json_t *address,
struct GNUNET_TIME_Timestamp next_restock,
unsigned int http_status);
@@ -493,6 +490,7 @@ TALER_TESTING_cmd_merchant_delete_product (const char *label,
* Make the "proposal" command.
*
* @param label command label
+ * @param cfg configuration to use
* @param merchant_url base URL of the merchant serving
* the proposal request.
* @param http_status expected HTTP status.
@@ -505,6 +503,7 @@ TALER_TESTING_cmd_merchant_delete_product (const char *label,
struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_orders (
const char *label,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *merchant_url,
unsigned int http_status,
const char *order_id,
@@ -512,6 +511,7 @@ TALER_TESTING_cmd_merchant_post_orders (
struct GNUNET_TIME_Timestamp pay_deadline,
const char *amount);
+
/**
* Make the "proposal" command AVOIDING claiming the order.
*
@@ -535,10 +535,12 @@ TALER_TESTING_cmd_merchant_post_orders_no_claim (
struct GNUNET_TIME_Timestamp pay_deadline,
const char *amount);
+
/**
* Make the "proposal" command.
*
* @param label command label
+ * @param cfg configuration to use
* @param merchant_url base URL of the merchant serving
* the proposal request.
* @param http_status expected HTTP status.
@@ -560,6 +562,7 @@ TALER_TESTING_cmd_merchant_post_orders_no_claim (
struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_orders2 (
const char *label,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *merchant_url,
unsigned int http_status,
const char *order_id,
@@ -574,6 +577,64 @@ TALER_TESTING_cmd_merchant_post_orders2 (
/**
+ * Create an order with a specific fulfillment URL.
+ * Does not claim the order.
+ *
+ * @param label command label
+ * @param cfg configuration to use
+ * @param merchant_url base URL of the merchant serving
+ * the proposal request
+ * @param http_status expected HTTP status
+ * @param order_id ID of the order to create
+ * @param refund_deadline the deadline for refunds on this order
+ * @param pay_deadline the deadline for payment on this order
+ * @param fulfillment_url the fulfillment URL to use
+ * @param amount the amount this order is for
+ * @return the command
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_post_orders3 (
+ const char *label,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *merchant_url,
+ unsigned int http_status,
+ const char *order_id,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
+ const char *fulfillment_url,
+ const char *amount);
+
+
+/**
+ * Create an order with a choices array with input and output tokens.
+ *
+ * @param label command label
+ * @param cfg configuration to use
+ * @param merchant_url base URL of the merchant serving
+ * the proposal request.
+ * @param http_status expected HTTP status.
+ * @param token_family_reference label of the POST /tokenfamilies cmd.
+ * @param order_id the name of the order to add.
+ * @param refund_deadline the deadline for refunds on this order.
+ * @param pay_deadline the deadline for payment on this order.
+ * @param amount the amount this order is for.
+ * @return the command
+ */
+
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_post_orders_choices (
+ const char *label,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *merchant_url,
+ unsigned int http_status,
+ const char *token_family_reference,
+ const char *order_id,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
+ const char *amount);
+
+
+/**
* Define a "GET /orders" CMD.
*
* @param label command label.
@@ -581,7 +642,7 @@ TALER_TESTING_cmd_merchant_post_orders2 (
* GET /orders request.
* @param http_status expected HTTP response code.
* @param ... NULL-terminated list of labels (const char *) of
- * reserve (commands) we expect to be returned in the list
+ * order (commands) we expect to be returned in the list
* (assuming @a http_code is #MHD_HTTP_OK)
* @return the command.
*/
@@ -616,9 +677,10 @@ TALER_TESTING_cmd_poll_orders_start (const char *label,
* @param poll_start_reference reference to the #TALER_TESTING_cmd_poll_orders_start command
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_poll_orders_conclude (const char *label,
- unsigned int http_status,
- const char *poll_start_reference);
+TALER_TESTING_cmd_poll_orders_conclude (
+ const char *label,
+ unsigned int http_status,
+ const char *poll_start_reference);
/**
@@ -634,13 +696,41 @@ TALER_TESTING_cmd_poll_orders_conclude (const char *label,
* @param http_status expected HTTP response code for the request.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_wallet_get_order (const char *label,
- const char *merchant_url,
- const char *order_reference,
- bool paid,
- bool refunded,
- bool refund_pending,
- unsigned int http_status);
+TALER_TESTING_cmd_wallet_get_order (
+ const char *label,
+ const char *merchant_url,
+ const char *order_reference,
+ bool paid,
+ bool refunded,
+ bool refund_pending,
+ unsigned int http_status);
+
+
+/**
+ * Define a GET /orders/$ORDER_ID CMD.
+ *
+ * @param label the command label
+ * @param merchant_url base URL of the merchant which will
+ * serve the request.
+ * @param order_reference reference to a command that created an order.
+ * @param session_id session ID to check for
+ * @param paid whether the order has been paid for or not.
+ * @param refunded whether the order has been refunded.
+ * @param refund_pending whether the order has refunds that haven't been obtained.
+ * @param repurchase_order_ref command of a paid equivalent order the merchant should be referring us to, or NULL
+ * @param http_status expected HTTP response code for the request.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_wallet_get_order2 (
+ const char *label,
+ const char *merchant_url,
+ const char *order_reference,
+ const char *session_id,
+ bool paid,
+ bool refunded,
+ bool refund_pending,
+ const char *repurchase_order_ref,
+ unsigned int http_status);
/**
@@ -737,13 +827,14 @@ TALER_TESTING_cmd_wallet_poll_order_conclude2 (
* this parameter is ignored.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_order (const char *label,
- const char *merchant_url,
- const char *order_reference,
- enum TALER_MERCHANT_OrderStatusCode osc,
- bool refunded,
- unsigned int http_status,
- ...);
+TALER_TESTING_cmd_merchant_get_order (
+ const char *label,
+ const char *merchant_url,
+ const char *order_reference,
+ enum TALER_MERCHANT_OrderStatusCode osc,
+ bool refunded,
+ unsigned int http_status,
+ ...);
/**
@@ -770,16 +861,61 @@ TALER_TESTING_cmd_merchant_get_order (const char *label,
* @param http_status expected HTTP response code for the request.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_order2 (const char *label,
- const char *merchant_url,
- const char *order_reference,
- enum TALER_MERCHANT_OrderStatusCode osc,
- bool wired,
- const char **transfers,
- bool refunded,
- const char **refunds,
- const char **forgets,
- unsigned int http_status);
+TALER_TESTING_cmd_merchant_get_order2 (
+ const char *label,
+ const char *merchant_url,
+ const char *order_reference,
+ enum TALER_MERCHANT_OrderStatusCode osc,
+ bool wired,
+ const char **transfers,
+ bool refunded,
+ const char **refunds,
+ const char **forgets,
+ unsigned int http_status);
+
+
+/**
+ * Define a GET /private/orders/$ORDER_ID CMD.
+ *
+ * @param label the command label
+ * @param merchant_url base URL of the merchant which will
+ * serve the request.
+ * @param order_reference reference to a command that created an order.
+ * @param osc expected order status
+ * @param session_id session ID the payment must be bound to
+ * @param repurchase_order_ref command of a paid equivalent order the merchant should be referring us to, or NULL
+ * @param expected_http_status expected HTTP response code for the request.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_get_order3 (
+ const char *label,
+ const char *merchant_url,
+ const char *order_reference,
+ enum TALER_MERCHANT_OrderStatusCode osc,
+ const char *session_id,
+ const char *repurchase_order_ref,
+ unsigned int expected_http_status);
+
+
+/**
+ * Define a GET /private/orders/$ORDER_ID CMD.
+ *
+ * @param label the command label
+ * @param merchant_url base URL of the merchant which will
+ * serve the request.
+ * @param order_reference reference to a command that created an order.
+ * @param osc expected order status
+ * @param expected_min_age expected minimum age for the contract
+ * @param expected_http_status expected HTTP response code for the request.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_get_order4 (
+ const char *label,
+ const char *merchant_url,
+ const char *order_reference,
+ enum TALER_MERCHANT_OrderStatusCode osc,
+ uint32_t expected_min_age,
+ unsigned int expected_http_status);
/**
@@ -836,14 +972,15 @@ TALER_TESTING_cmd_merchant_claim_order (const char *label,
* @return the command
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_pay_order (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *proposal_reference,
- const char *coin_reference,
- const char *amount_with_fee,
- const char *amount_without_fee,
- const char *session_id);
+TALER_TESTING_cmd_merchant_pay_order (
+ const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ const char *proposal_reference,
+ const char *coin_reference,
+ const char *amount_with_fee,
+ const char *amount_without_fee,
+ const char *session_id);
/**
@@ -857,11 +994,12 @@ TALER_TESTING_cmd_merchant_pay_order (const char *label,
* @return the command
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_post_orders_paid (const char *label,
- const char *merchant_url,
- const char *pay_reference,
- const char *session_id,
- unsigned int http_status);
+TALER_TESTING_cmd_merchant_post_orders_paid (
+ const char *label,
+ const char *merchant_url,
+ const char *pay_reference,
+ const char *session_id,
+ unsigned int http_status);
/**
@@ -874,10 +1012,11 @@ TALER_TESTING_cmd_merchant_post_orders_paid (const char *label,
* @return the command
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_order_abort (const char *label,
- const char *merchant_url,
- const char *pay_reference,
- unsigned int http_status);
+TALER_TESTING_cmd_merchant_order_abort (
+ const char *label,
+ const char *merchant_url,
+ const char *pay_reference,
+ unsigned int http_status);
/**
@@ -916,12 +1055,13 @@ TALER_TESTING_cmd_merchant_forget_order (
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_order_refund (const char *label,
- const char *merchant_url,
- const char *reason,
- const char *order_id,
- const char *refund_amount,
- unsigned int http_code);
+TALER_TESTING_cmd_merchant_order_refund (
+ const char *label,
+ const char *merchant_url,
+ const char *reason,
+ const char *order_id,
+ const char *refund_amount,
+ unsigned int http_code);
/**
@@ -939,11 +1079,12 @@ TALER_TESTING_cmd_merchant_order_refund (const char *label,
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_wallet_order_refund (const char *label,
- const char *merchant_url,
- const char *order_ref,
- unsigned int http_code,
- ...);
+TALER_TESTING_cmd_wallet_order_refund (
+ const char *label,
+ const char *merchant_url,
+ const char *order_ref,
+ unsigned int http_code,
+ ...);
/**
@@ -957,10 +1098,11 @@ TALER_TESTING_cmd_wallet_order_refund (const char *label,
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_delete_order (const char *label,
- const char *merchant_url,
- const char *order_id,
- unsigned int http_status);
+TALER_TESTING_cmd_merchant_delete_order (
+ const char *label,
+ const char *merchant_url,
+ const char *order_id,
+ unsigned int http_status);
/* ******************* /transfers *************** */
@@ -1071,421 +1213,139 @@ TALER_TESTING_cmd_merchant_delete_transfer (const char *label,
unsigned int http_status);
-/* ******************* /reserves *************** */
-
-
/**
- * Define a "POST /reserves" CMD
+ * Run a command to fetch the KYC status of a merchant.
*
- * @param label command label.
- * @param merchant_url url to the murchant.
- * @param initial_balance initial amount in the reserve.
- * @param exchange_url url to the exchange
- * @param wire_method wire transfer method to use for this reserve
- * @param http_status expected HTTP response code.
- * @return the command.
+ * @param label the command label
+ * @param merchant_url base URL of the merchant
+ * @param instance_id instance to use, NULL if instance is part of @a merchant_url
+ * @param h_wire_ref label of command with a merchant wire hash trait
+ * of the bank account to check KYC for; NULL to check all accounts
+ * @param exchange_url base URL of the exchange to check KYC status for
+ * @param expected_http_status expected HTTP status
+ * @param expected_aml_state expected AML state (only effective if @e expected_http_status is #MHD_HTTP_OK)
+ * @return the command
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_post_reserves (const char *label,
- const char *merchant_url,
- const char *initial_balance,
- const char *exchange_url,
- const char *wire_method,
- unsigned int http_status);
+TALER_TESTING_cmd_merchant_kyc_get (
+ const char *label,
+ const char *merchant_url,
+ const char *instance_id,
+ const char *h_wire_ref,
+ const char *exchange_url,
+ unsigned int expected_http_status,
+ enum TALER_AmlDecisionState expected_aml_state);
-/**
- * This commands does not query the backend at all,
- * but just makes up a fake reserve.
- *
- * @param label command label.
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_post_reserves_fake (const char *label);
+/* ****** OTP devices ******* */
/**
- * Define a "GET reserve" CMD.
+ * Define a "POST /otp-devices" CMD.
*
* @param label command label.
- * @param merchant_url base URL of the merchant serving the request.
+ * @param merchant_url base URL of the merchant serving the
+ * POST /otps request.
+ * @param otp_id the ID of the otp device to modify
+ * @param otp_description description of the otp device
+ * @param otp_key base32-encoded key to verify the payment
+ * @param otp_alg is an option that show the amount of the order. it is linked with the @a otp_key
+ * @param otp_ctr counter to use (if in counter mode)
* @param http_status expected HTTP response code.
- * @param reserve_reference reference to a "POST /reserves" that provides the
- * information we are expecting.
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_reserve (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *reserve_reference);
+TALER_TESTING_cmd_merchant_post_otp_devices (
+ const char *label,
+ const char *merchant_url,
+ const char *otp_id,
+ const char *otp_description,
+ const char *otp_key,
+ enum TALER_MerchantConfirmationAlgorithm otp_alg,
+ uint64_t otp_ctr,
+ unsigned int http_status);
/**
- * Define a "GET reserve" CMD.
+ * Define a "PATCH /otp-devices/$ID" CMD.
*
* @param label command label.
- * @param merchant_url base URL of the merchant serving the request.
+ * @param merchant_url base URL of the merchant serving the
+ * PATCH /otp-devices request.
+ * @param otp_id the ID of the otp device to modify
+ * @param otp_description description of the otp device
+ * @param otp_key base32-encoded key to verify the payment
+ * @param otp_alg is an option that show the amount of the order. it is linked with the @a otp_key
+ * @param otp_ctr counter to use (if in counter mode)
* @param http_status expected HTTP response code.
- * @param reserve_reference reference to a "POST /reserves" that provides the
- * information we are expecting.
- * @param ... NULL-terminated list of labels (const char *) of
- * tip (commands) we expect to be returned in the list
- * (assuming @a http_code is #MHD_HTTP_OK)
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_reserve_with_tips (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *reserve_reference,
- ...);
+TALER_TESTING_cmd_merchant_patch_otp_device (
+ const char *label,
+ const char *merchant_url,
+ const char *otp_id,
+ const char *otp_description,
+ const char *otp_key,
+ enum TALER_MerchantConfirmationAlgorithm otp_alg,
+ uint64_t otp_ctr,
+ unsigned int http_status);
/**
- * Define a "GET /reserves" CMD
+ * Define a "GET /otp-devices" CMD.
*
* @param label command label.
- * @param merchant_url url to the merchant.
+ * @param merchant_url base URL of the merchant serving the
+ * GET /otp-devices request.
* @param http_status expected HTTP response code.
* @param ... NULL-terminated list of labels (const char *) of
- * reserve (commands) we expect to be returned in the list
+ * otp (commands) we expect to be returned in the list
* (assuming @a http_code is #MHD_HTTP_OK)
+ * @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_reserves (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- ...);
+TALER_TESTING_cmd_merchant_get_otp_devices (const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ ...);
/**
- * Define a "DELETE reserve" CMD.
+ * Define a "GET otp device" CMD.
*
* @param label command label.
* @param merchant_url base URL of the merchant serving the
- * DELETE /reserves/$RESERVE_PUB request.
- * @param reserve_reference command label of a command providing a reserve
+ * GET /otp-devices/$ID request.
+ * @param otp_id the ID of the otp to query
* @param http_status expected HTTP response code.
+ * @param otp_reference reference to a "POST /otp-devices" or "PATCH /otp-devices/$ID" CMD
+ * that will provide what we expect the backend to return to us
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_delete_reserve (const char *label,
+TALER_TESTING_cmd_merchant_get_otp_device (const char *label,
const char *merchant_url,
- const char *reserve_reference,
- unsigned int http_status);
+ const char *otp_id,
+ unsigned int http_status,
+ const char *otp_reference);
/**
- * Define a "PURGE reserve" CMD.
+ * Define a "DELETE otp device" CMD.
*
* @param label command label.
* @param merchant_url base URL of the merchant serving the
- * DELETE /reserves/$RESERVE_PUB request.
- * @param reserve_reference command label of a command providing a reserve
+ * DELETE /otp-devices/$ID request.
+ * @param otp_id the ID of the otp to query
* @param http_status expected HTTP response code.
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_purge_reserve (const char *label,
- const char *merchant_url,
- const char *reserve_reference,
- unsigned int http_status);
-
-
-/**
- * Define a get tips CMD.
- *
- * @param label the command label
- * @param merchant_url base URL of the merchant which will
- * server the /tip-query request.
- * @param http_status expected HTTP response code for the
- * /tip-query request.
- * @param ... NULL-terminated list of labels (const char *) of
- * tip (commands) we expect to be returned in the list
- * (assuming @a http_code is #MHD_HTTP_OK)
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_get_tips (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- ...);
-
-
-/**
- * Define a get tips CMD.
- *
- * @param label the command label
- * @param merchant_url base URL of the merchant which will
- * server the /tip-query request.
- * @param http_status expected HTTP response code for the
- * /tip-query request.
- * @param offset row to start querying the database from.
- * @param limit how many rows to return (with direction).
- * @param ... NULL-terminated list of labels (const char *) of
- * tip (commands) we expect to be returned in the list
- * (assuming @a http_code is #MHD_HTTP_OK)
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_get_tips2 (const char *label,
- const char *merchant_url,
- uint64_t offset,
- int64_t limit,
- unsigned int http_status,
- ...);
-
-
-/**
- * Define a GET /private/tips/$TIP_ID CMD.
- *
- * @param label the command label
- * @param merchant_url base URL of the merchant which will
- * serve the request.
- * @param tip_reference reference to a command that created a tip.
- * @param http_status expected HTTP response code for the request.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_tip (const char *label,
- const char *merchant_url,
- const char *tip_reference,
- unsigned int http_status);
-
-
-/**
- * Define a GET /private/tips/$TIP_ID CMD.
- *
- * @param label the command label
- * @param merchant_url base URL of the merchant which will
- * serve the request.
- * @param tip_reference reference to a command that created a tip.
- * @param http_status expected HTTP response code for the request.
- * @param ... NULL-terminated list of labels (const char *) of
- * pickup (commands) we expect to be returned in the list
- * (assuming @a http_code is #MHD_HTTP_OK)
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_tip_with_pickups (const char *label,
- const char *merchant_url,
- const char *tip_reference,
- unsigned int http_status,
- ...);
-
-/**
- * Define a GET /tips/$TIP_ID CMD.
- *
- * @param label the command label
- * @param merchant_url base URL of the merchant which will
- * serve the request.
- * @param tip_reference reference to a command that created a tip.
- * @param http_status expected HTTP response code for the request.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_wallet_get_tip (const char *label,
- const char *merchant_url,
- const char *tip_reference,
- unsigned int http_status);
-
-
-/**
- * Define a GET /tips/$TIP_ID CMD.
- *
- * @param label the command label
- * @param merchant_url base URL of the merchant which will
- * serve the request.
- * @param tip_reference reference to a command that created a tip.
- * @param amount_remaining the balance remaining after pickups.
- * @param http_status expected HTTP response code for the request.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_wallet_get_tip2 (const char *label,
- const char *merchant_url,
- const char *tip_reference,
- const char *amount_remaining,
- unsigned int http_status);
-
-
-/**
- * Create a /tip-authorize CMD.
- *
- * @param label this command label
- * @param merchant_url the base URL of the merchant that will
- * serve the /tip-authorize request.
- * @param exchange_url the base URL of the exchange that owns
- * the reserve from which the tip is going to be gotten.
- * @param http_status the HTTP response code which is expected
- * for this operation.
- * @param justification human-readable justification for this
- * tip authorization.
- * @param amount the amount to authorize for tipping.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_authorize (const char *label,
- const char *merchant_url,
- const char *exchange_url,
- unsigned int http_status,
- const char *justification,
- const char *amount);
-
-
-/**
- * Create a /tip-authorize CMD.
- *
- * @param label this command label
- * @param merchant_url the base URL of the merchant that will
- * serve the /tip-authorize request.
- * @param exchange_url the base URL of the exchange that owns
- * the reserve from which the tip is going to be gotten.
- * @param reserve_reference reference to a command that created
- * a reserve.
- * @param http_status the HTTP response code which is expected
- * for this operation.
- * @param justification human-readable justification for this
- * tip authorization.
- * @param amount the amount to authorize for tipping.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_authorize_from_reserve (const char *label,
+TALER_TESTING_cmd_merchant_delete_otp_device (const char *label,
const char *merchant_url,
- const char *exchange_url,
- const char *reserve_reference,
- unsigned int http_status,
- const char *justification,
- const char *amount);
-
-
-/**
- * Create a /tip-authorize CMD, specifying the Taler error code
- * that is expected to be returned by the backend.
- *
- * @param label this command label
- * @param merchant_url the base URL of the merchant that will
- * serve the /tip-authorize request.
- * @param exchange_url the base URL of the exchange that owns
- * the reserve from which the tip is going to be gotten.
- * @param http_status the HTTP response code which is expected
- * for this operation.
- * @param justification human-readable justification for this
- * tip authorization.
- * @param amount the amount to authorize for tipping.
- * @param ec expected Taler-defined error code.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_authorize_with_ec (const char *label,
- const char *merchant_url,
- const char *exchange_url,
- unsigned int http_status,
- const char *justification,
- const char *amount,
- enum TALER_ErrorCode ec);
-
-
-/**
- * Create a /tip-authorize CMD, specifying the Taler error code
- * that is expected to be returned by the backend.
- *
- * @param label this command label
- * @param merchant_url the base URL of the merchant that will
- * serve the /tip-authorize request.
- * @param exchange_url the base URL of the exchange that owns
- * the reserve from which the tip is going to be gotten.
- * @param reserve_reference reference to a command that created
- * a reserve.
- * @param http_status the HTTP response code which is expected
- * for this operation.
- * @param justification human-readable justification for this
- * tip authorization.
- * @param amount the amount to authorize for tipping.
- * @param ec expected Taler-defined error code.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_authorize_from_reserve_with_ec (
- const char *label,
- const char *merchant_url,
- const char *exchange_url,
- const char *reserve_reference,
- unsigned int http_status,
- const char *justification,
- const char *amount,
- enum TALER_ErrorCode ec);
-
-
-/**
- * This commands does not query the backend at all,
- * but just makes up a fake authorization id that will
- * be subsequently used by the "pick up" CMD in order
- * to test against such a case.
- *
- * @param label command label.
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_authorize_fake (const char *label);
-
-
-/**
- * Define a /tip-pickup CMD, equipped with the expected error
- * code.
- *
- * @param label the command label
- * @param merchant_url base URL of the backend which will serve
- * the /tip-pickup request.
- * @param http_status expected HTTP response code.
- * @param authorize_reference reference to a /tip-autorize CMD
- * that offers a tip id to pick up.
- * @param amounts array of string-defined amounts that specifies
- * which denominations will be accepted for tipping.
- * @param ec expected Taler error code.
- * @return the command
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_pickup_with_ec (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *authorize_reference,
- const char **amounts,
- enum TALER_ErrorCode ec);
-
-/**
- * Define a /tip-pickup CMD.
- *
- * @param label the command label
- * @param merchant_url base URL of the backend which will serve
- * the /tip-pickup request.
- * @param http_status expected HTTP response code.
- * @param authorize_reference reference to a /tip-autorize CMD
- * that offers a tip id to pick up.
- * @param amounts array of string-defined amounts that specifies
- * which denominations will be accepted for tipping.
- * @return the command
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_tip_pickup (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *authorize_reference,
- const char **amounts);
-
-
-/**
- * Run a command to fetch the KYC status of a merchant.
- *
- * @param label the command label
- * @param merchant_url base URL of the merchant
- * @param instance_id instance to use, NULL if instance is part of @a merchant_url
- * @param h_wire_ref label of command with a merchant wire hash trait
- * of the bank account to check KYC for; NULL to check all accounts
- * @param exchange_url base URL of the exchange to check KYC status for
- * @param expected_http_status expected HTTP status
- * @return the command
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_kyc_get (const char *label,
- const char *merchant_url,
- const char *instance_id,
- const char *h_wire_ref,
- const char *exchange_url,
- unsigned int expected_http_status);
+ const char *otp_id,
+ unsigned int http_status);
/* ****** Templates ******* */
@@ -1498,7 +1358,7 @@ TALER_TESTING_cmd_merchant_kyc_get (const char *label,
* POST /templates request.
* @param template_id the ID of the template to query
* @param template_description description of the template
- * @param image base64-encoded template image
+ * @param otp_id OTP device ID, NULL for none
* @param template_contract where the contract of the company is
* @param http_status expected HTTP response code.
* @return the command.
@@ -1509,7 +1369,7 @@ TALER_TESTING_cmd_merchant_post_templates2 (
const char *merchant_url,
const char *template_id,
const char *template_description,
- const char *image,
+ const char *otp_id,
json_t *template_contract,
unsigned int http_status);
@@ -1541,7 +1401,7 @@ TALER_TESTING_cmd_merchant_post_templates (const char *label,
* PATCH /template request.
* @param template_id the ID of the template to query
* @param template_description description of the template
- * @param image base64-encoded template image
+ * @param otp_id OTP device to use
* @param template_contract contract of the company
* @param http_status expected HTTP response code.
* @return the command.
@@ -1552,7 +1412,7 @@ TALER_TESTING_cmd_merchant_patch_template (
const char *merchant_url,
const char *template_id,
const char *template_description,
- const char *image,
+ const char *otp_id,
json_t *template_contract,
unsigned int http_status);
@@ -1618,21 +1478,64 @@ TALER_TESTING_cmd_merchant_delete_template (const char *label,
*
* @param label command label.
* @param template_ref label of command that created the template to use
+ * @param otp_ref label of command that created OTP device we use (or NULL for no OTP)
* @param merchant_url base URL of the merchant serving the
* POST /using-templates request.
+ * @param using_template_id template ID to use
* @param summary given by the customer to know what they did pay
* @param amount given by the customer to pay
+ * @param refund_deadline refund deadline to use for the contract
+ * @param pay_deadline pay deadline to use for the contract
* @param http_status expected HTTP response code.
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_post_using_templates (const char *label,
- const char *template_ref,
- const char *merchant_url,
- const char *summary,
- const char *amount,
- unsigned int http_status);
+TALER_TESTING_cmd_merchant_post_using_templates (
+ const char *label,
+ const char *template_ref,
+ const char *otp_ref,
+ const char *merchant_url,
+ const char *using_template_id,
+ const char *summary,
+ const char *amount,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
+ unsigned int http_status);
+
+/* ****** Token Families ******* */
+
+
+/**
+ * Define a "POST /tokenfamilies" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ * POST /tokenfamilies request.
+ * @param http_status expected HTTP response code.
+ * @param slug slug of the token family.
+ * @param name name of the token family.
+ * @param description description of the token family.
+ * @param description_i18n internationalized description of the token family.
+ * @param valid_after start of the validity time of the token family.
+ * @param valid_before end of the validity time of the token family.
+ * @param duration validity duration of an issued token of the token family.
+ * @param kind kind of the token family. either "subscription" or "discount".
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_post_tokenfamilies (
+ const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ const char *slug,
+ const char *name,
+ const char *description,
+ json_t *description_i18n,
+ struct GNUNET_TIME_Timestamp valid_after,
+ struct GNUNET_TIME_Timestamp valid_before,
+ struct GNUNET_TIME_Relative duration,
+ const char *kind);
/* ****** Webhooks ******* */
@@ -1767,6 +1670,84 @@ TALER_TESTING_cmd_merchant_delete_webhook (const char *label,
const char *webhook_id,
unsigned int http_status);
+/**
+ * Command to run the 'taler-merchant-webhook' program.
+ *
+ * @param label command label.
+ * @param config_filename configuration file used by the webhook.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_webhook (const char *label,
+ const char *config_filename);
+
+
+/**
+ * Command to run the 'taler-merchant-depositcheck' program.
+ *
+ * @param label command label.
+ * @param config_filename configuration file used by the deposit check helper.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_depositcheck (const char *label,
+ const char *config_filename);
+
+
+/**
+ * Command to run the 'taler-merchant-exchange' program.
+ *
+ * @param label command label.
+ * @param config_filename configuration file used by the webhook.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_run_tme (const char *label,
+ const char *config_filename);
+
+
+/**
+ * This function is used to start the web server.
+ *
+ * @param label command label
+ * @param port is the port of the web server
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_testserver (const char *label,
+ uint16_t port);
+
+
+/**
+ * This function is used to check the web server got the
+ * expected request from the web hook.
+ *
+ * @param label command label
+ * @param ref_operation reference to command to the previous set server status operation.
+ * @param index index to know which web server we check.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_checkserver (const char *label,
+ const char *ref_operation,
+ unsigned int index);
+
+
+/**
+ * This function is used to check that the web server
+ * got the expected request from the web hook.
+ *
+ * @param label command label
+ * @param ref_operation reference to command to the previous set server status operation.
+ * @param index index to know which web server we check.
+ * @param expected_url url of the webhook
+ * @param expected_method method of the webhook
+ * @param expected_header header of the webhook
+ * @param expected_body body of the webhook
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_checkserver2 (const char *label,
+ const char *ref_operation,
+ unsigned int index,
+ const char *expected_url,
+ const char *expected_method,
+ const char *expected_header,
+ const char *expected_body);
/* ****** Specific traits supported by this component ******* */
@@ -1779,28 +1760,25 @@ TALER_TESTING_cmd_merchant_delete_webhook (const char *label,
// FIXME: rename: refund_entry->refund_detail
#define TALER_MERCHANT_TESTING_SIMPLE_TRAITS(op) \
op (claim_nonce, const struct GNUNET_CRYPTO_EddsaPublicKey) \
- op (tip_id, const struct TALER_TipIdentifierP) \
op (pickup_id, const struct TALER_PickupIdentifierP) \
- op (instance_name, const char *) \
- op (instance_id, const char *) \
+ op (instance_name, const char) \
+ op (instance_id, const char) \
op (address, const json_t) \
- op (product_description, const char *) \
- op (product_image, const char *) \
+ op (product_description, const char) \
+ op (product_image, const char) \
op (product_stock, const int64_t) \
- op (product_unit, const char *) \
- op (product_id, const char *) \
- op (reason, const char *) \
- op (lock_uuid, const char *) \
- op (auth_token, const char *) \
+ op (product_unit, const char) \
+ op (product_id, const char) \
+ op (reason, const char) \
+ op (lock_uuid, const char) \
+ op (auth_token, const char) \
op (paths_length, const uint32_t) \
op (payto_length, const uint32_t) \
op (num_planchets, const uint32_t) \
op (i18n_description, const json_t) \
op (taxes, const json_t) \
op (fee, const struct TALER_Amount) \
- op (max_wire_fee, const struct TALER_Amount) \
- op (max_deposit_fee, const struct TALER_Amount) \
- op (wire_fee_amortization, const uint32_t) \
+ op (use_stefan, const bool) \
op (jurisdiction, const json_t) \
op (wire_delay, const struct GNUNET_TIME_Relative) \
op (pay_delay, const struct GNUNET_TIME_Relative) \
@@ -1808,18 +1786,25 @@ TALER_TESTING_cmd_merchant_delete_webhook (const char *label,
op (order_terms, const json_t) \
op (h_contract_terms, const struct TALER_PrivateContractHashP) \
op (h_wire, const struct TALER_MerchantWireHashP) \
- op (proposal_reference, const char *) \
- op (template_description, const char *) \
- op (template_image, const char *) \
- op (template_id, const char *) \
+ op (proposal_reference, const char) \
+ op (template_description, const char) \
+ op (otp_device_description, const char) \
+ op (otp_id, const char) \
+ op (otp_key, const char) \
+ op (otp_alg, const enum TALER_MerchantConfirmationAlgorithm) \
+ op (template_id, const char) \
op (template_contract, const json_t) \
- op (event_type, const char *) \
- op (url, const char *) \
- op (webhook_id, const char *) \
- op (http_method, const char *) \
- op (header_template, const char *) \
- op (body_template, const char *) \
- op (summary, const char *)
+ op (event_type, const char) \
+ op (webhook_id, const char) \
+ op (merchant_base_url, const char) \
+ op (url, const char) \
+ op (http_method, const char) \
+ op (header_template, const char) \
+ op (body_template, const char) \
+ op (summary, const char) \
+ op (token_family_slug, const char) \
+ op (token_family_duration, const struct GNUNET_TIME_Relative) \
+ op (token_family_kind, const char)
/**
@@ -1828,10 +1813,16 @@ TALER_TESTING_cmd_merchant_delete_webhook (const char *label,
* @param op macro to call
*/
#define TALER_MERCHANT_TESTING_INDEXED_TRAITS(op) \
- op (coin_reference, const char *) \
- op (paths, const char *) \
- op (payto_uris, const char *) \
- op (amounts, const struct TALER_Amount) \
+ op (coin_reference, const char) \
+ op (paths, const char) \
+ op (payto_uris, const char) \
+ op (h_wires, const struct TALER_MerchantWireHashP) \
+ op (amounts, const struct TALER_Amount) \
+ op (urls, const char) \
+ op (http_methods, const char) \
+ op (http_header, const char) \
+ op (http_body, const void) \
+ op (http_body_size, const size_t) \
op (planchet_secrets, const struct TALER_PlanchetMasterSecretP)