diff options
author | Christian Blättler <blatc2@bfh.ch> | 2024-04-10 08:01:28 +0200 |
---|---|---|
committer | Christian Blättler <blatc2@bfh.ch> | 2024-04-10 08:01:28 +0200 |
commit | d42cb68e0ce55310aac0ed0fb83e57ede8e63836 (patch) | |
tree | c26cd5c4704eed3e87a45b52a5f5fac7026d8049 /src/testing | |
parent | 983ad0943b4f0b9ddf7d1b7a14693e4b69395ea6 (diff) | |
parent | d4fd038d116381d76d1fdf8384101f8fa901ffe5 (diff) |
Merge branch 'master' into tokens
# Conflicts:
# src/backend/taler-merchant-httpd_private-post-orders.c
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_kyc_api.c | 497 | ||||
-rw-r--r-- | src/testing/test_merchant_api.c | 33 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_merchant_get_order.c | 61 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_orders.c | 27 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_products.c | 28 |
5 files changed, 398 insertions, 248 deletions
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c index 1bb9f472..6ef40b45 100644 --- a/src/testing/test_kyc_api.c +++ b/src/testing/test_kyc_api.c @@ -138,211 +138,250 @@ run (void *cls, /** * Move money to the exchange's bank account. */ - cmd_transfer_to_exchange ("create-reserve-1", - "EUR:10.02"), + cmd_transfer_to_exchange ( + "create-reserve-1", + "EUR:10.02"), /** * Make a reserve exist, according to the previous transfer. */ - TALER_TESTING_cmd_exec_wirewatch ("wirewatch-1", - CONFIG_FILE), - TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-2", - "EUR:10.02", - payer_payto, - exchange_payto, - "create-reserve-1"), - TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1", - "create-reserve-1", - "EUR:5", - 0, - MHD_HTTP_OK), - TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2", - "create-reserve-1", - "EUR:5", - 0, - MHD_HTTP_OK), - TALER_TESTING_cmd_merchant_get_orders ("get-orders-empty", - merchant_url, - MHD_HTTP_OK, - NULL), + TALER_TESTING_cmd_exec_wirewatch ( + "wirewatch-1", + CONFIG_FILE), + TALER_TESTING_cmd_check_bank_admin_transfer ( + "check_bank_transfer-2", + "EUR:10.02", + payer_payto, + exchange_payto, + "create-reserve-1"), + TALER_TESTING_cmd_withdraw_amount ( + "withdraw-coin-1", + "create-reserve-1", + "EUR:5", + 0, + MHD_HTTP_OK), + TALER_TESTING_cmd_withdraw_amount ( + "withdraw-coin-2", + "create-reserve-1", + "EUR:5", + 0, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_get_orders ( + "get-orders-empty", + merchant_url, + MHD_HTTP_OK, + NULL), /** * Check the reserve is depleted. */ - TALER_TESTING_cmd_status ("withdraw-status-1", - "create-reserve-1", - "EUR:0", - MHD_HTTP_OK), - TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-1", - cred.cfg, - merchant_url, - MHD_HTTP_OK, - "1", /* order ID */ - GNUNET_TIME_UNIT_ZERO_TS, - GNUNET_TIME_UNIT_FOREVER_TS, - true, - "EUR:5.0", - "x-taler-bank", - "", - "", - NULL), - TALER_TESTING_cmd_merchant_claim_order ("reclaim-1", - merchant_url, - MHD_HTTP_OK, - "create-proposal-1", - NULL), - TALER_TESTING_cmd_merchant_pay_order ("deposit-simple", - merchant_url, - MHD_HTTP_OK, - "create-proposal-1", - "withdraw-coin-1", - "EUR:5", - "EUR:4.99", - "session-0"), - TALER_TESTING_cmd_merchant_post_orders_paid ("verify-order-1-paid", - merchant_url, - "deposit-simple", - "session-1", - MHD_HTTP_OK), - TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-1"), - CMD_EXEC_AGGREGATOR ("run-aggregator"), + TALER_TESTING_cmd_status ( + "withdraw-status-1", + "create-reserve-1", + "EUR:0", + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_post_orders2 ( + "create-proposal-1", + cred.cfg, + merchant_url, + MHD_HTTP_OK, + "1", /* order ID */ + GNUNET_TIME_UNIT_ZERO_TS, + GNUNET_TIME_UNIT_FOREVER_TS, + true, + "EUR:5.0", + "x-taler-bank", + "", + "", + NULL), + TALER_TESTING_cmd_merchant_claim_order ( + "reclaim-1", + merchant_url, + MHD_HTTP_OK, + "create-proposal-1", + NULL), + TALER_TESTING_cmd_merchant_pay_order ( + "deposit-simple", + merchant_url, + MHD_HTTP_OK, + "create-proposal-1", + "withdraw-coin-1", + "EUR:5", + "EUR:4.99", + "session-0"), + TALER_TESTING_cmd_merchant_post_orders_paid ( + "verify-order-1-paid", + merchant_url, + "deposit-simple", + "session-1", + MHD_HTTP_OK), + TALER_TESTING_cmd_check_bank_empty ( + "check_bank_empty-1"), + CMD_EXEC_AGGREGATOR ( + "run-aggregator"), /* KYC: hence nothing happened at the bank yet: */ - TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-2"), + TALER_TESTING_cmd_check_bank_empty ( + "check_bank_empty-2"), /* KYC: we don't even know the legitimization UUID yet */ - TALER_TESTING_cmd_merchant_kyc_get ("kyc-pending-early", - merchant_url, - NULL, - NULL, - EXCHANGE_URL, - MHD_HTTP_NO_CONTENT, - TALER_AML_NORMAL), + TALER_TESTING_cmd_merchant_kyc_get ( + "kyc-pending-early", + merchant_url, + NULL, + NULL, + EXCHANGE_URL, + MHD_HTTP_NO_CONTENT, + TALER_AML_NORMAL), /* now we get the legi UUID by running taler-merchant-depositcheck */ - TALER_TESTING_cmd_depositcheck ("deposit-check", - CONFIG_FILE), + TALER_TESTING_cmd_depositcheck ( + "deposit-check", + CONFIG_FILE), /* Now we should get a status of pending */ - TALER_TESTING_cmd_merchant_kyc_get ("kyc-pending", - merchant_url, - NULL, - NULL, - EXCHANGE_URL, - MHD_HTTP_ACCEPTED, - TALER_AML_NORMAL), - TALER_TESTING_cmd_proof_kyc_oauth2 ("kyc-do", - "kyc-pending", - "kyc-provider-test-oauth2", - "pass", - MHD_HTTP_SEE_OTHER), + TALER_TESTING_cmd_merchant_kyc_get ( + "kyc-pending", + merchant_url, + NULL, + NULL, + EXCHANGE_URL, + MHD_HTTP_ACCEPTED, + TALER_AML_NORMAL), + TALER_TESTING_cmd_proof_kyc_oauth2 ( + "kyc-do", + "kyc-pending", + "kyc-provider-test-oauth2", + "pass", + MHD_HTTP_SEE_OTHER), CMD_EXEC_AGGREGATOR ("run-aggregator"), - TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-498c", - EXCHANGE_URL, - "EUR:4.98", - exchange_payto, - merchant_payto), - TALER_TESTING_cmd_merchant_post_transfer ("post-transfer-1", - &cred.ba, - merchant_payto, - merchant_url, - "EUR:4.98", - MHD_HTTP_NO_CONTENT, - "deposit-simple", - NULL), - TALER_TESTING_cmd_run_tme ("run taler-merchant-exchange-1", - CONFIG_FILE), - TALER_TESTING_cmd_merchant_get_transfers ("get-transfers-1", - merchant_url, - merchant_payto, - MHD_HTTP_OK, - "post-transfer-1", - NULL), - TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-3"), + TALER_TESTING_cmd_check_bank_transfer ( + "check_bank_transfer-498c", + EXCHANGE_URL, + "EUR:4.98", + exchange_payto, + merchant_payto), + TALER_TESTING_cmd_merchant_post_transfer ( + "post-transfer-1", + &cred.ba, + merchant_payto, + merchant_url, + "EUR:4.98", + MHD_HTTP_NO_CONTENT, + "deposit-simple", + NULL), + TALER_TESTING_cmd_run_tme ( + "run taler-merchant-exchange-1", + CONFIG_FILE), + TALER_TESTING_cmd_merchant_get_transfers ( + "get-transfers-1", + merchant_url, + merchant_payto, + MHD_HTTP_OK, + "post-transfer-1", + NULL), + TALER_TESTING_cmd_check_bank_empty ( + "check_bank_empty-3"), TALER_TESTING_cmd_end () }; struct TALER_TESTING_Command aml[] = { - TALER_TESTING_cmd_set_officer ("aml-officer", - NULL, - "Ernest&Young", - true, - false), - cmd_transfer_to_exchange ("create-reserve-big", - "EUR:100.02"), - TALER_TESTING_cmd_exec_wirewatch ("wirewatch-big", - CONFIG_FILE), - TALER_TESTING_cmd_take_aml_decision ("freeze", - "aml-officer", - "post-transfer-1", - "EUR:1", - "suspicious", - TALER_AML_FROZEN, - NULL, - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-big", - "EUR:100.02", - payer_payto, - exchange_payto, - "create-reserve-big"), - TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-aml", - "create-reserve-big", - "EUR:5", - 0, - MHD_HTTP_OK), - TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-aml", - cred.cfg, - merchant_url, - MHD_HTTP_OK, - "10-aml", /* order ID */ - GNUNET_TIME_UNIT_ZERO_TS, - GNUNET_TIME_UNIT_FOREVER_TS, - true, - "EUR:5.0", - "x-taler-bank", - "", - "", - NULL), - TALER_TESTING_cmd_merchant_claim_order ("reclaim-aml", - merchant_url, - MHD_HTTP_OK, - "create-proposal-aml", - NULL), - TALER_TESTING_cmd_merchant_pay_order ("deposit-simple", - merchant_url, - MHD_HTTP_OK, - "create-proposal-aml", - "withdraw-coin-aml", - "EUR:5", - "EUR:4.99", - "session-aml"), - TALER_TESTING_cmd_merchant_post_orders_paid ("verify-order-aml-paid", - merchant_url, - "deposit-simple", - "session-aml", - MHD_HTTP_OK), - TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-aml-1"), + TALER_TESTING_cmd_set_officer ( + "aml-officer", + NULL, + "Ernest&Young", + true, + false), + cmd_transfer_to_exchange ( + "create-reserve-big", + "EUR:100.02"), + TALER_TESTING_cmd_exec_wirewatch ( + "wirewatch-big", + CONFIG_FILE), + TALER_TESTING_cmd_take_aml_decision ( + "freeze", + "aml-officer", + "post-transfer-1", + "EUR:1", + "suspicious", + TALER_AML_FROZEN, + NULL, + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_check_bank_admin_transfer ( + "check_bank_transfer-big", + "EUR:100.02", + payer_payto, + exchange_payto, + "create-reserve-big"), + TALER_TESTING_cmd_withdraw_amount ( + "withdraw-coin-aml", + "create-reserve-big", + "EUR:5", + 0, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_post_orders2 ( + "create-proposal-aml", + cred.cfg, + merchant_url, + MHD_HTTP_OK, + "10-aml", /* order ID */ + GNUNET_TIME_UNIT_ZERO_TS, + GNUNET_TIME_UNIT_FOREVER_TS, + true, + "EUR:5.0", + "x-taler-bank", + "", + "", + NULL), + TALER_TESTING_cmd_merchant_claim_order ( + "reclaim-aml", + merchant_url, + MHD_HTTP_OK, + "create-proposal-aml", + NULL), + TALER_TESTING_cmd_merchant_pay_order ( + "deposit-simple", + merchant_url, + MHD_HTTP_OK, + "create-proposal-aml", + "withdraw-coin-aml", + "EUR:5", + "EUR:4.99", + "session-aml"), + TALER_TESTING_cmd_merchant_post_orders_paid ( + "verify-order-aml-paid", + merchant_url, + "deposit-simple", + "session-aml", + MHD_HTTP_OK), + TALER_TESTING_cmd_check_bank_empty ( + "check_bank_empty-aml-1"), CMD_EXEC_AGGREGATOR ("run-aggregator-aml-frozen"), /* AML-frozen: hence nothing happened at the bank yet: */ - TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-aml-2"), + TALER_TESTING_cmd_check_bank_empty ( + "check_bank_empty-aml-2"), /* Now we should get a status of frozen */ - TALER_TESTING_cmd_merchant_kyc_get ("aml-frozen", - merchant_url, - NULL, /* no instance ID */ - NULL, /* no wire ref */ - EXCHANGE_URL, - MHD_HTTP_ACCEPTED, - TALER_AML_FROZEN), - TALER_TESTING_cmd_sleep ("sleep to de-collide AML timestamps", - 1), - TALER_TESTING_cmd_take_aml_decision ("unfreeze", - "aml-officer", - "post-transfer-1", - "EUR:100", - "fine", - TALER_AML_NORMAL, - NULL, - MHD_HTTP_NO_CONTENT), - TALER_TESTING_cmd_merchant_kyc_get ("aml-unfrozen", - merchant_url, - NULL, /* no instance ID */ - NULL, /* no wire ref */ - EXCHANGE_URL, - MHD_HTTP_NO_CONTENT, - TALER_AML_NORMAL), + TALER_TESTING_cmd_merchant_kyc_get ( + "aml-frozen", + merchant_url, + NULL, /* no instance ID */ + NULL, /* no wire ref */ + EXCHANGE_URL, + MHD_HTTP_ACCEPTED, + TALER_AML_FROZEN), + TALER_TESTING_cmd_sleep ( + "sleep to de-collide AML timestamps", + 1), + TALER_TESTING_cmd_take_aml_decision ( + "unfreeze", + "aml-officer", + "post-transfer-1", + "EUR:100", + "fine", + TALER_AML_NORMAL, + NULL, + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_kyc_get ( + "aml-unfrozen", + merchant_url, + NULL, /* no instance ID */ + NULL, /* no wire ref */ + EXCHANGE_URL, + MHD_HTTP_NO_CONTENT, + TALER_AML_NORMAL), CMD_EXEC_AGGREGATOR ("run-aggregator-aml-normal"), TALER_TESTING_cmd_check_bank_transfer ( "check_bank_transfer-498c-post-unfreeze", @@ -350,47 +389,55 @@ run (void *cls, "EUR:4.98", exchange_payto, merchant_payto), - TALER_TESTING_cmd_merchant_post_transfer ("post-transfer-aml", - &cred.ba, - merchant_payto, - merchant_url, - "EUR:4.98", - MHD_HTTP_NO_CONTENT, - "deposit-simple", - NULL), - TALER_TESTING_cmd_run_tme ("run taler-merchant-exchange-2-aml", - CONFIG_FILE), - TALER_TESTING_cmd_merchant_get_transfers ("get-transfers-aml", - merchant_url, - merchant_payto, - MHD_HTTP_OK, - "post-transfer-1", - "post-transfer-aml", - NULL), + TALER_TESTING_cmd_merchant_post_transfer ( + "post-transfer-aml", + &cred.ba, + merchant_payto, + merchant_url, + "EUR:4.98", + MHD_HTTP_NO_CONTENT, + "deposit-simple", + NULL), + TALER_TESTING_cmd_run_tme ( + "run taler-merchant-exchange-2-aml", + CONFIG_FILE), + TALER_TESTING_cmd_merchant_get_transfers ( + "get-transfers-aml", + merchant_url, + merchant_payto, + MHD_HTTP_OK, + "post-transfer-1", + "post-transfer-aml", + NULL), TALER_TESTING_cmd_end () }; /* end of aml batch */ struct TALER_TESTING_Command commands[] = { /* general setup */ - TALER_TESTING_cmd_run_fakebank ("run-fakebank", - cred.cfg, - "exchange-account-exchange"), - TALER_TESTING_cmd_system_start ("start-taler", - CONFIG_FILE, - "-ema", - "-u", "exchange-account-exchange", - NULL), - TALER_TESTING_cmd_get_exchange ("get-exchange", - cred.cfg, - NULL, - true, - true), - TALER_TESTING_cmd_oauth ("start-oauth-service", - 6666), - TALER_TESTING_cmd_merchant_post_instances ("instance-create-default-setup", - merchant_url, - "default", - MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_run_fakebank ( + "run-fakebank", + cred.cfg, + "exchange-account-exchange"), + TALER_TESTING_cmd_system_start ( + "start-taler", + CONFIG_FILE, + "-ema", + "-u", "exchange-account-exchange", + NULL), + TALER_TESTING_cmd_get_exchange ( + "get-exchange", + cred.cfg, + NULL, + true, + true), + TALER_TESTING_cmd_oauth ( + "start-oauth-service", + 6666), + TALER_TESTING_cmd_merchant_post_instances ( + "instance-create-default-setup", + merchant_url, + "default", + MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_merchant_post_account ( "instance-create-default-account", merchant_url, @@ -437,4 +484,4 @@ main (int argc, } -/* end of test_merchant_api.c */ +/* end of test_kyc_api.c */ diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c index e9b492b3..ed07bce6 100644 --- a/src/testing/test_merchant_api.c +++ b/src/testing/test_merchant_api.c @@ -599,6 +599,20 @@ run (void *cls, "a product", "EUR:1", MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_post_products2 ("post-products-p4", + merchant_url, + "product-4age", + "an age-restricted product", + NULL, + "unit", + "EUR:1", + "", /* image */ + NULL, + 4, + 16 /* minimum age */, + NULL, + GNUNET_TIME_UNIT_FOREVER_TS, + MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_merchant_patch_product ("patch-products-p3", merchant_url, "product-3", @@ -673,6 +687,25 @@ run (void *cls, "product-3/3", "lock-product-p3", NULL), + TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-p4-age", + cred.cfg, + merchant_url, + MHD_HTTP_OK, + "order-p4-age", + GNUNET_TIME_UNIT_ZERO_TS, + GNUNET_TIME_UNIT_FOREVER_TS, + false, + "EUR:5.0", + "x-taler-bank", + "product-4age", + "", /* locks */ + NULL), + TALER_TESTING_cmd_merchant_get_order4 ("get-order-merchant-p4-age", + merchant_url, + "create-proposal-p4-age", + TALER_MERCHANT_OSC_CLAIMED, + 16, + MHD_HTTP_OK), TALER_TESTING_cmd_merchant_delete_order ("delete-order-paid", merchant_url, "1", diff --git a/src/testing/testing_api_cmd_merchant_get_order.c b/src/testing/testing_api_cmd_merchant_get_order.c index 1b235c93..6301c9f6 100644 --- a/src/testing/testing_api_cmd_merchant_get_order.c +++ b/src/testing/testing_api_cmd_merchant_get_order.c @@ -106,6 +106,11 @@ struct MerchantGetOrderState const char *repurchase_order_ref; /** + * Expected minimum age. + */ + unsigned int expected_min_age; + + /** * True if we should pass the 'allow_refunded_for_repurchase' flag. */ bool allow_refunded_for_repurchase; @@ -176,7 +181,9 @@ merchant_get_order_cb ( if (gos->osc != osr->details.ok.status) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Order paid does not match\n"); + "Order paid does not match: %d vs %d\n", + gos->osc, + osr->details.ok.status); TALER_TESTING_interpreter_fail (gos->is); return; } @@ -187,6 +194,17 @@ merchant_get_order_cb ( const struct TALER_TESTING_Command *order_cmd; struct TALER_Amount refunded_total; + if ( (0 != gos->expected_min_age) && + (gos->expected_min_age != + json_integer_value ( + json_object_get ( + osr->details.ok.details.paid.contract_terms, + "minimum_age"))) ) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (gos->is); + return; + } order_cmd = TALER_TESTING_interpreter_lookup_command ( gos->is, gos->order_reference); @@ -422,6 +440,17 @@ merchant_get_order_cb ( break; case TALER_MERCHANT_OSC_CLAIMED: /* FIXME: Check contract terms... */ + if ( (0 != gos->expected_min_age) && + (gos->expected_min_age != + json_integer_value ( + json_object_get ( + osr->details.ok.details.claimed.contract_terms, + "minimum_age"))) ) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (gos->is); + return; + } break; case TALER_MERCHANT_OSC_UNPAID: { @@ -754,6 +783,36 @@ TALER_TESTING_cmd_merchant_get_order3 ( } +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) +{ + struct MerchantGetOrderState *gos; + + gos = GNUNET_new (struct MerchantGetOrderState); + gos->merchant_url = merchant_url; + gos->order_reference = order_reference; + gos->osc = osc; + gos->expected_min_age = expected_min_age; + gos->http_status = expected_http_status; + { + struct TALER_TESTING_Command cmd = { + .cls = gos, + .label = label, + .run = &merchant_get_order_run, + .cleanup = &merchant_get_order_cleanup + }; + + return cmd; + } +} + + struct MerchantPollOrderConcludeState { /** diff --git a/src/testing/testing_api_cmd_post_orders.c b/src/testing/testing_api_cmd_post_orders.c index 5688d174..d5cfdddc 100644 --- a/src/testing/testing_api_cmd_post_orders.c +++ b/src/testing/testing_api_cmd_post_orders.c @@ -536,19 +536,20 @@ orders_run2 (void *cls, locks_length, uuid); } - ps->po = TALER_MERCHANT_orders_post2 (TALER_TESTING_interpreter_get_context ( - is), - ps->merchant_url, - order, - GNUNET_TIME_UNIT_ZERO, - ps->payment_target, - products_length, - products, - locks_length, - locks, - ps->make_claim_token, - &order_cb, - ps); + ps->po = TALER_MERCHANT_orders_post2 ( + TALER_TESTING_interpreter_get_context ( + is), + ps->merchant_url, + order, + GNUNET_TIME_UNIT_ZERO, + ps->payment_target, + products_length, + products, + locks_length, + locks, + ps->make_claim_token, + &order_cb, + ps); GNUNET_free (products_string); GNUNET_free (locks_string); GNUNET_array_grow (products, diff --git a/src/testing/testing_api_cmd_post_products.c b/src/testing/testing_api_cmd_post_products.c index e98ea3c5..4ffafddc 100644 --- a/src/testing/testing_api_cmd_post_products.c +++ b/src/testing/testing_api_cmd_post_products.c @@ -95,6 +95,11 @@ struct PostProductsState json_t *address; /** + * Minimum age requirement to use for the product. + */ + unsigned int minimum_age; + + /** * when the next restocking is expected to happen, 0 for unknown, */ struct GNUNET_TIME_Timestamp next_restock; @@ -168,7 +173,7 @@ post_products_run (void *cls, struct PostProductsState *pis = cls; pis->is = is; - pis->iph = TALER_MERCHANT_products_post ( + pis->iph = TALER_MERCHANT_products_post2 ( TALER_TESTING_interpreter_get_context (is), pis->merchant_url, pis->product_id, @@ -181,6 +186,7 @@ post_products_run (void *cls, pis->total_stock, pis->address, pis->next_restock, + pis->minimum_age, &post_products_cb, pis); GNUNET_assert (NULL != pis->iph); @@ -197,7 +203,7 @@ post_products_run (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue post_products_traits (void *cls, const void **ret, const char *trait, @@ -265,6 +271,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) @@ -288,6 +295,7 @@ TALER_TESTING_cmd_merchant_post_products2 ( pis->image = GNUNET_strdup (image); pis->taxes = taxes; /* ownership taken */ pis->total_stock = total_stock; + pis->minimum_age = minimum_age; pis->address = address; /* ownership taken */ pis->next_restock = next_restock; { @@ -305,12 +313,13 @@ TALER_TESTING_cmd_merchant_post_products2 ( struct TALER_TESTING_Command -TALER_TESTING_cmd_merchant_post_products (const char *label, - const char *merchant_url, - const char *product_id, - const char *description, - const char *price, - unsigned int http_status) +TALER_TESTING_cmd_merchant_post_products ( + const char *label, + const char *merchant_url, + const char *product_id, + const char *description, + const char *price, + unsigned int http_status) { return TALER_TESTING_cmd_merchant_post_products2 ( label, @@ -322,7 +331,8 @@ TALER_TESTING_cmd_merchant_post_products (const char *label, price, "", json_array (), - 4, + 4, /* total stock */ + 0, /* minimum age */ json_pack ("{s:s}", "street", "my street"), GNUNET_TIME_UNIT_ZERO_TS, http_status); |